LlmCall.Request (llm_call v0.1.0)

Copy Markdown View Source

A provider-neutral completion request.

system stays here rather than becoming a message because providers place it differently (leading message, top-level field, or instruction field). It is text-only: no protocol accepts a non-text system block, so a wider type would promise what validation refuses.

provider_options is keyed by provider namespace and is for features the canonical layer cannot express. params covers the sampling and length controls providers share.

Summary

Types

modalities()

@type modalities() :: [LlmCall.modality()]

output()

@type output() ::
  :text | :json_object | {:json_schema, String.t(), map(), boolean() | nil}

params()

@type params() :: %{
  optional(atom()) => nil | boolean() | number() | String.t() | [String.t()]
}

system()

@type system() :: nil | String.t() | [LlmCall.Content.Text.t()]

t()

@type t() :: %LlmCall.Request{
  messages: [LlmCall.Message.t()],
  modalities: modalities(),
  model: String.t(),
  output: output(),
  params: params(),
  provider_options: map(),
  reasoning: LlmCall.Reasoning.t() | nil,
  stream: boolean(),
  system: system(),
  tool_choice: tool_choice(),
  tools: [LlmCall.ToolSpec.t()]
}

tool_choice()

@type tool_choice() ::
  :auto | :none | :required | {:tool, String.t()} | {:allowed, [String.t()]}