LLMProxy.Protocol.Request (llm_proxy v0.1.0)

Copy Markdown View Source

Boundary parser that normalizes OpenAI Chat, Anthropic Messages, and OpenAI Responses requests.

Summary

Types

protocol()

@type protocol() :: :openai_chat | :anthropic_messages | :openai_responses

t()

@type t() :: %LLMProxy.Protocol.Request{
  body: map(),
  max_tokens: non_neg_integer() | nil,
  messages: [ReqLLM.Message.t()],
  metadata: map() | nil,
  model: String.t() | nil,
  protocol: protocol(),
  reasoning_effort:
    :none | :minimal | :low | :medium | :high | :xhigh | :max | nil,
  stop: [String.t()] | String.t() | nil,
  stream: boolean() | nil,
  tags: [String.t()] | nil,
  temperature: number() | nil,
  tool_choice: term(),
  tools: [map()] | nil,
  top_p: number() | nil
}

Functions

native_body(request)

@spec native_body(t()) :: map()

parse(protocol, body)

@spec parse(protocol(), map()) ::
  {:ok, t()} | {:error, LLMProxy.Protocol.Request.Error.t()}

user_text(request)

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