Skip to main content

Module model

Module model 

Source
Expand description

Core data models shared by agents, tools, and model adapters.

The types in this module form the data contract between Anda runtimes, model providers, agents, tools, and clients. They cover:

Structs§

AgentInput
Request sent to an agent for processing.
AgentOutput
Output produced by an agent execution.
ByteArrayB64
Wrapper around [u8; N] to serialize and deserialize efficiently. If the serialization format is human readable (formats like JSON and YAML), it will be encoded in Base64URL. Otherwise, it will be serialized as a byte array.
ByteBufB64
Wrapper around Vec<u8> to serialize and deserialize efficiently. If the serialization format is human readable (formats like JSON and YAML), it will be encoded in Base64URL. Otherwise, it will be serialized as a byte array.
CompletionRequest
Provider-neutral completion request.
Document
A document with metadata and content.
Documents
Collection of documents that can be injected into a completion prompt.
Function
Represents a function definition with its metadata.
FunctionDefinition
Defines a callable function with its metadata and schema.
Message
Chat message sent to or returned by an LLM provider.
PartialAgentOutput
RequestMeta
Metadata attached to an agent or tool request.
Resource
Represents a resource for AI Agents.
ResourceRef
Borrowed view of a Resource suitable for serialization.
ToolCall
Tool call requested by an LLM or returned by a tool execution pipeline.
ToolInput
Request sent to a tool for processing.
ToolOutput
Output produced by a tool execution.
Usage
Usage statistics for an agent, model, or tool execution.
Xid
Represents a unique identifier with 12 bytes. Based on the xid. See: https://github.com/rs/xid

Enums§

ContentPart
A single content item inside a chat message.
ModelEffort
Provider-agnostic reasoning/thinking effort requested for a completion.
PromptCommand

Traits§

CompletionFeatures
LLM completion capability exposed by an agent context.

Functions§

estimate_tokens
Estimates token count using a small, provider-independent heuristic.
inline_data_from_data_url
Parses a data URL string and extracts the inline data and MIME type, if applicable.
part_to_data_url
Converts a content part with inline data to a data URL string.
platform_text_encoding
Returns the platform-local text encoding used for legacy text files.
prompt_with_resources
select_resources
Removes and returns resources matching any of the supported tags.
text_encoding_for_label
Resolves a text encoding label, accepting both utf8 and standard Encoding Standard labels.
text_encoding_label
Returns the normalized label used by Anda for a decoded text encoding.
text_from
Attempts to decode the given byte vector as text and checks if it looks like text content.
text_from_bytes
Attempts to decode bytes as text and checks if it looks like text content.
text_from_bytes_with_encoding
Attempts to decode bytes as text using UTF-8 first and an explicit fallback encoding second.
text_resource_documents
update_resources
Updates resource metadata before persistence.
utf8_text_from
Attempts to decode the given byte vector as UTF-8 text and checks if it looks like text content.
utf8_text_from_bytes
Attempts to decode the given byte slice as UTF-8 text and checks if it looks like text content.
windows_code_page_encoding
Maps a Windows code page number to an Encoding Standard decoder when supported.