Sycophant.WireProtocol.OpenAIResponses (sycophant v0.4.2)

Copy Markdown

Wire protocol adapter for the OpenAI Responses API format.

Encodes Sycophant Request structs into the POST /v1/responses JSON format and decodes responses back into Response structs. Uses items instead of messages, flat tool definitions, and extracts system messages into the instructions field.

Summary

Types

t()

@type t() :: %{
  optional(:stop) => [binary()],
  optional(:include) => [binary()],
  optional(:cache_key) => binary(),
  optional(:store) => boolean(),
  optional(:metadata) => any(),
  optional(:max_tokens) => integer(),
  optional(:temperature) => float(),
  optional(:top_p) => float(),
  optional(:top_k) => integer(),
  optional(:reasoning_effort) =>
    :none | :minimal | :low | :medium | :high | :xhigh,
  optional(:reasoning_budget) => integer(),
  optional(:reasoning_summary) => :auto | :concise | :detailed | :none,
  optional(:service_tier) => binary(),
  optional(:tool_choice) => any(),
  optional(:parallel_tool_calls) => boolean(),
  optional(:top_logprobs) => integer(),
  optional(:cache_retention) => binary(),
  optional(:safety_identifier) => binary(),
  optional(:truncation) => :auto | :disabled,
  optional(:max_tool_calls) => integer(),
  optional(:stream_options) => any(),
  optional(:context_management) => any(),
  optional(:verbosity) => :low | :medium | :high,
  optional(:previous_response_id) => binary()
}

Functions

param_schema()

Options:

  • :stop (list of String.t/0) - Stop sequences

  • :include (list of String.t/0) - Additional output data to include in the response

  • :cache_key (String.t/0) - Cache key for prompt caching

  • :store (boolean/0) - Whether to store the response for later retrieval

  • :metadata (term/0) - Key-value metadata to attach to the response

  • :max_tokens (integer/0) - Maximum number of tokens to generate

  • :temperature (float/0) - Sampling temperature

  • :top_p (float/0) - Nucleus sampling threshold

  • :top_k (integer/0) - Top-K sampling

  • :reasoning_effort (:none | :minimal | :low | :medium | :high | :xhigh) - Extended thinking effort level

  • :reasoning_budget (integer/0) - Explicit reasoning token budget

  • :reasoning_summary (:auto | :concise | :detailed | :none) - How to summarize reasoning

  • :service_tier (String.t/0) - Service tier selection

  • :tool_choice (term/0) - Tool selection strategy

  • :parallel_tool_calls (boolean/0) - Allow parallel tool calls

  • :top_logprobs (integer/0) - Number of most likely tokens to return per position

  • :cache_retention ("in-memory" | "24h") - Cache retention policy

  • :safety_identifier (String.t/0) - Safety identifier for content filtering

  • :truncation (:auto | :disabled) - Context window overflow handling

  • :max_tool_calls (integer/0) - Maximum number of tool calls per response

  • :stream_options (term/0) - Options for streaming responses

  • :context_management (term/0) - Context management configuration

  • :verbosity (:low | :medium | :high) - Response verbosity level

  • :previous_response_id (String.t/0) - ID of a previous response to chain from