Sycophant.WireProtocol.OpenAICompletions (sycophant v0.4.2)

Copy Markdown

Wire protocol adapter for the OpenAI Chat Completions API format.

Encodes Sycophant Request structs into the /v1/chat/completions JSON format and decodes responses back into Response structs. Used by any provider that implements the OpenAI-compatible API (OpenAI, OpenRouter, Together, DeepInfra, etc.).

Summary

Types

t()

@type t() :: %{
  optional(:stop) => [binary()],
  optional(:seed) => integer(),
  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(:frequency_penalty) => float(),
  optional(:presence_penalty) => float(),
  optional(:logprobs) => boolean(),
  optional(:top_logprobs) => integer()
}

Functions

param_schema()

Options:

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

  • :seed (integer/0) - Random seed for reproducible outputs

  • :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

  • :frequency_penalty (float/0) - Penalize repeated tokens

  • :presence_penalty (float/0) - Penalize tokens already present

  • :logprobs (boolean/0) - Return log probabilities of output tokens

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