Backplane. AiProtocol. Codec behaviour
(backplane_ai_protocol v1.7.2)
Copy Markdown
Pure provider codec facade.
Supported selectors are :anthropic, :openai, and :google. Request encoding accepts
stream: boolean(). Streaming functions retain state only in the value returned to the caller.
Transport, authentication, retries, and execution remain host-owned.
Summary
Callbacks
@callback decode_response(integer(), list(), binary() | map(), keyword()) :: {:ok, Backplane.AiProtocol.Response.t()} | {:error, Backplane.AiProtocol.Error.t()}
@callback encode_request( Backplane.AiProtocol.Request.t(), keyword() ) :: {:ok, map()} | {:error, Backplane.AiProtocol.Error.t()}
@callback stream_feed(term(), binary()) :: {:ok, term(), [Backplane.AiProtocol.StreamEvent.t()]} | {:error, Backplane.AiProtocol.Error.t(), term()}
@callback stream_finish(term(), atom()) :: {:ok, term(), [Backplane.AiProtocol.StreamEvent.t()]} | {:error, Backplane.AiProtocol.Error.t(), term()}
Functions
@spec decode_response(atom(), integer(), list(), binary() | map(), keyword()) :: {:ok, Backplane.AiProtocol.Response.t()} | {:error, Backplane.AiProtocol.Error.t()}
@spec encode_request(atom(), Backplane.AiProtocol.Request.t(), keyword()) :: {:ok, map()} | {:error, Backplane.AiProtocol.Error.t()}