Behaviour for streaming an LLM completion, plus the normalized stream handle the agent consumes.
Two implementations: a ReqLLM-backed adapter (the default, added with the agent
loop) and the scriptable Agentix.Test.MockProvider for deterministic,
key-free tests. The handle is defined from the ReqLLM StreamResponse shape so
the real adapter is a thin wrapper: a lazy stream of chunks, a cancel closure,
and a finalizer for the assembled message + usage (available only after the
stream is fully consumed).
Configure with config :agentix, :provider, MyProvider.
Summary
Callbacks
Starts a streaming completion for model over context. Returns {:ok, %Stream{}} or {:error, reason}. The caller consumes chunks fully, may call
cancel.() to abort, and calls finalize.() after consumption.
Callbacks
@callback stream(model :: term(), context :: ReqLLM.Context.t(), opts :: keyword()) :: {:ok, Agentix.Provider.Stream.t()} | {:error, term()}
Starts a streaming completion for model over context. Returns {:ok, %Stream{}} or {:error, reason}. The caller consumes chunks fully, may call
cancel.() to abort, and calls finalize.() after consumption.
Functions
@spec impl() :: module()
The configured provider implementation.
@spec stream(term(), ReqLLM.Context.t(), keyword()) :: {:ok, Agentix.Provider.Stream.t()} | {:error, term()}
Streams a completion via the configured provider.