LlmCall.Dialect.OpenAI.Responses (llm_call v0.1.0)

Copy Markdown View Source

OpenAI Responses (POST /v1/responses).

Responses is a separate protocol from Chat Completions, not an endpoint toggle. A request is a list of typed input items; a response is a list of typed output items. System instructions move to instructions, tool results become function_call_output items, and server-side state is expressed with store and previous_response_id in provider_options.

Streaming uses semantic response.* events rather than delta chunks, and has no [DONE] sentinel: the stream ends after response.completed, response.failed, response.incomplete, or error.

For a persistent WebSocket connection with stream_id lanes, see LlmCall.Dialect.OpenAI.Responses.Connection.

Reasoning items are decoded as Content.Thinking, with encrypted_content kept in signature. Replaying a reasoning item is not supported: a canonical Content.Thinking carries no item id, so sending it as input is a validation error rather than a silently dropped item.

An assistant turn goes back as an easy-input message — {"type": "message", "role": "assistant", "content": [{"type": "input_text", …}]} — because the alternative shape, the original output item, requires the item id and status that a canonical Message does not carry.

text is a reserved envelope key, since format is derived from output; the documented text.verbosity knob is therefore not reachable from provider_options. A tool's parameters and strict are only sent when set.

Summary

Functions

Validates the request and encodes it as a POST to the codec's @path.

The path used by both the HTTP and WebSocket transports.

Functions

encode_request(request, config)

@spec encode_request(LlmCall.Request.t(), LlmCall.Config.t()) ::
  {:ok, LlmCall.EncodedRequest.t()} | {:error, LlmCall.Error.t()}

Validates the request and encodes it as a POST to the codec's @path.

path()

@spec path() :: String.t()

The path used by both the HTTP and WebSocket transports.