Expand description
Ferrin application-level messages.
Messageand its role structs: the conversation model applications build and persist. Content may be a plain string or a list of parts.- Part types:
UserPart,AssistantPart,ToolPartand the application-only partsImagePart,FilePart,ReasoningFilePart,ToolApprovalRequest,ToolApprovalResponse. Parts whose shape equals the provider specification (TextPart,ReasoningPart,CustomPart,ToolCallPart,ToolResultPart,ToolResultOutput) are re-exported fromferrin_spec. FileSource: application file payloads (bytes, base64, URL, provider reference, inline text, local path) plusdata_urlparsing.prune: removal of reasoning, tool calls and empty messages from a history.
Conversion to the provider Prompt (downloads, media type detection)
lives in the core crate.
Design: docs/01-architecture/03-core-data-model.md §7,
docs/01-architecture/05-prompt-conversion.md.
§Attribution
Portions of this crate are derived from the Vercel AI SDK (Apache-2.0,
Copyright 2023 Vercel, Inc.), translated from TypeScript to Rust and
modified. See the NOTICE file in the crate root.
Re-exports§
pub use data_url::DataUrl;pub use prune::PruneOptions;
Modules§
- data_
url - RFC 2397
data:URL parsing. - prune
- Message pruning: drop reasoning, tool calls and empty messages to control context size.
Structs§
- Approval
Id - Identifier of a tool approval request.
- Assistant
Message - An assistant message.
- Custom
Part - Provider-specific content identified by a
provider.typekind. - File
Part - A file in a user or assistant message.
- Image
Part - An image in a user message.
- Invalid
Data Content Error - Binary or data-URL content could not be decoded.
- Media
Type - An IANA media type such as
image/png, or a top-level type such asimage. - Reasoning
File Part - A reasoning artefact (for example an image the model reasoned over) in an assistant message.
- Reasoning
Part - Reasoning text produced by the model.
- System
Message - A system message.
- Text
Part - Text content.
- Tool
Approval Request - A request for user approval of a tool call, recorded in an assistant message.
- Tool
Approval Response - The user’s answer to a
ToolApprovalRequest, recorded in a tool message. - Tool
Call Id - Identifier of a tool call, assigned by the provider.
- Tool
Call Part - A tool call issued by the model in a previous step.
- Tool
Message - A tool message.
- Tool
Name - Name of a tool as exposed to the model.
- Tool
Result Part - The result of a tool call.
- User
Message - A user message.
Enums§
- Assistant
Content - Content of an assistant message: a string or a list of parts.
- Assistant
Part - A part of an assistant message.
- File
Data - The payload of a file: inline bytes, a URL, a provider reference or an inline text document.
- File
Source - Where the bytes of a file part come from.
- File
Source Error - A
FileSourcecould not be converted into provider file data. - Message
- A message in an application conversation, tagged by
role. - Role
- The role of a
Message. - Tool
Part - A part of a tool message.
- Tool
Result Content Part - A part of a multi-part tool result.
- Tool
Result Output - The output of a tool call as sent back to the model.
- User
Content - Content of a user message: a string or a list of parts.
- User
Part - A part of a user message.
Traits§
- Messages
Ext - Helpers for message histories.
Type Aliases§
- Provider
Options - Provider-specific request options, grouped by provider key.
- Provider
Reference - Provider-side resource identifiers, keyed by provider name.