FalEx.Streaming (fal_ex v0.1.0)

View Source

Streaming client for handling Server-Sent Events (SSE) from fal.ai.

Provides real-time streaming of model outputs with support for partial results.

Summary

Functions

Closes a stream.

Creates a new streaming client.

Gets the next chunk from a stream.

Starts a streaming request to a fal endpoint.

Types

t()

@type t() :: %FalEx.Streaming{config: FalEx.Config.t()}

Functions

close(stream_handle)

Closes a stream.

create(config)

Creates a new streaming client.

next(stream_handle)

Gets the next chunk from a stream.

Returns:

  • {:ok, data, stream} - Data chunk received
  • {:done, stream} - Stream completed
  • {:error, reason} - Error occurred

stream(streaming, endpoint_id, opts \\ [])

Starts a streaming request to a fal endpoint.

Returns a stream handle that can be used to receive data chunks.

Options

  • :input - Input payload for the model
  • :method - HTTP method (default: :post)
  • :timeout - Stream timeout in ms (default: 15000)