ExAthena.Request (ExAthena v0.12.2)

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

Functions

Build a request from a raw user prompt and options.

Types

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,
  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.