ReqLLM. Message. ContentPart
(ReqLLM v1.26.0)
View Source
ContentPart represents a single piece of content within a message.
Supports multiple content types:
:text- Plain text content:image_url- Image from URL:video_url- Video from URL:image- Image from binary data:file- File attachment or uploaded file reference:thinking- Chain-of-thought thinking content:provider_block- An opaque, provider-owned block that must be replayed unchanged (e.g. Anthropicserver_tool_use/tool_search_tool_result)
Provider-owned file references are opt-in through owned_file_id/3. Legacy
file_id/1 values remain unowned and preserve their existing behavior.
See also
ReqLLM.Message- Multi-modal message composition using ContentPart collections
Summary
Functions
Returns redacted provider file metadata suitable for logs and diagnostics.
Returns whether a file reference has explicit provider ownership metadata.
Creates an explicitly provider-owned file reference.
Wraps a provider-owned content block that ReqLLM does not model itself.
Returns the full metadata record for an explicitly owned provider file.
Returns the Zoi schema for this module
Types
@type t() :: %ReqLLM.Message.ContentPart{ data: nil | nil | any(), file_id: nil | nil | binary(), filename: nil | nil | binary(), media_type: nil | nil | binary(), metadata: map(), text: nil | nil | binary(), type: :text | :image_url | :video_url | :image | :file | :thinking | :provider_block, url: nil | nil | binary() }
Functions
@spec inspect_provider_file(t() | map()) :: {:ok, ReqLLM.ProviderFileReference.t()} | :error
Returns redacted provider file metadata suitable for logs and diagnostics.
Returns whether a file reference has explicit provider ownership metadata.
Creates an explicitly provider-owned file reference.
Ownership is stored in the reserved "req_llm" -> "provider_file" metadata
namespace. Legacy file_id/1 references remain unowned and keep their existing
behavior.
Supported options are :media_type, :metadata, :purpose, :status,
:expires_at, :size, :sha256, and :provider_metadata.
Wraps a provider-owned content block that ReqLLM does not model itself.
The raw block lives in :data exactly as the provider returned it, and
:metadata carries the owning :provider (plus a :block_type for
inspection). The owning provider's encoder replays the block verbatim in
the assistant turn; every other provider drops it. Anthropic's tool-search
blocks (server_tool_use, tool_search_tool_result) are the first case —
the API rejects a replayed assistant turn that lost them when extended
thinking is on ("thinking blocks … cannot be modified").
@spec provider_file_reference(t() | map()) :: {:ok, ReqLLM.ProviderFileReference.t()} | :error
Returns the full metadata record for an explicitly owned provider file.
Returns the Zoi schema for this module