ExAthena.Request (ExAthena v0.20.0)

Copy Markdown View Source

A normalised inference request.

Every provider receives an ExAthena.Request and is responsible for mapping it to its own wire format. Keeping the shared shape here means callers don't need to think about whether they're talking to Ollama, OpenAI, or Claude.

Summary

Types

How hard a reasoning model should think before answering.

t()

Functions

Build a request from a raw user prompt and options.

Types

reasoning_effort()

@type reasoning_effort() :: :none | :minimal | :low | :medium | :high | :xhigh

How hard a reasoning model should think before answering.

The ladder is req_llm's canonical one, so a value set here means the same thing to every provider that understands the concept. nil sends nothing and leaves the model on its own default — which for Qwen3.8 is xhigh, the setting that spends whole completion budgets circling (#198).

t()

@type t() :: %ExAthena.Request{
  max_tokens: pos_integer() | nil,
  messages: [ExAthena.Messages.Message.t()],
  metadata: map() | nil,
  model: String.t() | nil,
  provider_opts: keyword() | nil,
  reasoning_effort: reasoning_effort() | nil,
  response_format: :text | :json | map() | nil,
  stop: [String.t()] | String.t() | nil,
  system_prompt: String.t() | nil,
  temperature: float() | nil,
  timeout_ms: pos_integer() | nil,
  tool_choice: :auto | :any | :none | map() | nil,
  tools: [map()] | nil,
  top_p: float() | nil
}

Functions

new(prompt, opts)

@spec new(
  String.t() | nil,
  keyword()
) :: t()

Build a request from a raw user prompt and options.

The prompt is prepended to opts[:messages] as a user message. Pass nil to start from a pre-built message list.

Images shorthand

Pass images: [%{data: binary(), media_type: String.t()}] to attach inline images to the trailing user message. Each entry may also use %{url: String.t()} for remote image URLs. When a non-empty prompt is given, a multimodal user message is built with the text first followed by image parts. When prompt is nil or "", image parts are merged into the last user message in :messages, or appended as a new user message.