LLMProxy.Response (llm_proxy v0.1.0)

Copy Markdown View Source

Internal non-stream LLMProxy response.

The generated model turn is stored as a canonical ReqLLM.Response struct. HTTP routes render protocol wire maps at the boundary with to_openai/1.

Summary

Types

t()

@type t() :: %LLMProxy.Response{
  cache_hit: boolean(),
  cache_ttl_ms: pos_integer() | nil,
  cacheable: boolean(),
  message: ReqLLM.Response.t(),
  model: String.t(),
  provider: module(),
  provider_name: String.t() | nil,
  provider_response: term(),
  request: LLMProxy.Protocol.Request.t(),
  trace_id: String.t() | nil,
  usage: LLMProxy.Usage.t()
}

Functions

put_text(response, text)

@spec put_text(t(), String.t()) :: t()

to_openai(response)

@spec to_openai(t()) :: map()

to_openai_chat_completion(response, model, id, usage, empty_content, created_at \\ nil)

@spec to_openai_chat_completion(
  ReqLLM.Response.t(),
  String.t(),
  String.t(),
  LLMProxy.Usage.t() | map() | nil,
  String.t() | nil,
  pos_integer() | nil
) :: map()

to_responses(response, model, created_at \\ nil)

@spec to_responses(ReqLLM.Response.t(), String.t(), pos_integer() | nil) :: map()