ExAgent. Message. Part. User
(ExAgent v3.0.0)
View Source
A user prompt part: a string or a non-empty list of content parts.
Stability — Stable.
Content parts are JSON-portable maps (atom or string keys):
%{"type" => "text", "text" => text}%{"type" => "image_url", "url" => url}—http,httpsordataURL%{"type" => "image", "data" => base64, "media_type" => "image/png"}%{"type" => "file", "data" => base64, "media_type" => media_type}, with an optional"filename". Examples are"application/pdf"and"audio/wav".- A versioned provider file reference built with
file_reference/4.
The model decides at request time whether it accepts each modality.
Summary
Functions
Build a v1 provider file reference for a prompt. For a PDF in Gemini,
pass :google, the URI returned by Gemini's Files API,
"application/pdf", and the declared file size in bytes.
For Anthropic, pass :anthropic and the opaque file_id returned by
its Files API. The model profile declares which media types it accepts.
Media types have no parameters and are stored in lowercase.
Types
@type content_part() :: %{required(String.t()) => String.t() | pos_integer()}
@type t() :: %ExAgent.Message.Part.User{ content: String.t() | [content_part()], timestamp: DateTime.t() | nil }
Functions
@spec file_reference(atom() | String.t(), String.t(), String.t(), pos_integer()) :: content_part()
Build a v1 provider file reference for a prompt. For a PDF in Gemini,
pass :google, the URI returned by Gemini's Files API,
"application/pdf", and the declared file size in bytes.
For Anthropic, pass :anthropic and the opaque file_id returned by
its Files API. The model profile declares which media types it accepts.
Media types have no parameters and are stored in lowercase.
The host verifies ownership, permissions and validity for the model's credentials on every run and resume. ExAgent stores the reference as prompt content. Its metadata occupies the history budget. The file stays at the provider.
Raises ArgumentError naming the invalid field.