Skip to main content

Module model

Module model 

Source
Expand description

Unified LLM interface types and traits.

Provides the shared types used across all LLM providers: Message, Response, StreamChunk, Tool, Request, and the Model trait.

Structs§

Choice
A completion choice (used for both streaming and non-streaming responses).
CompletionMeta
Common metadata shared between streaming and non-streaming completions
CompletionTokensDetails
Detailed breakdown of completion tokens
Delta
Message content in a completion response
FunctionCall
A function call within a tool call
Message
A message in the chat
MessageBuilder
A builder for messages
Request
A chat completion request.
Response
A chat completion response from the LLM
StreamChunk
A streaming chat completion chunk
Tool
A tool for the LLM
ToolCall
A tool call made by the model
Usage
Token usage statistics

Enums§

FinishReason
The reason the model stopped generating
Role
The role of a message
ToolChoice
Controls which tool is called by the model

Traits§

Model
Unified LLM provider trait.

Functions§

default_context_limit
Returns the default context limit (in tokens) for a known model ID.
estimate_tokens
Estimate total tokens across a slice of messages.