Expand description
Provider-neutral model port for tea-rs.
This crate defines model contracts but does not contain a live provider adapter or network transport.
§Example
use std::str::FromStr;
use tea_model::{
ModelCapabilities, ModelDisplayName, ModelSpec, ProviderId,
};
use tea_protocol::{ModelId, TokenCount};
let model = ModelSpec::new(
ModelId::from_str("example/model")?,
ProviderId::from_str("example")?,
ModelDisplayName::from_str("Example Model")?,
TokenCount::new(32_000)?,
TokenCount::new(8_000)?,
ModelCapabilities::text().with_reasoning().with_tools(true),
)?;
assert!(model.capabilities().supports_parallel_tool_calls());Structs§
- Function
Tool Definition - Model-visible client function tool.
- Hosted
Tool Completed - Complete provider-hosted tool activity safe for canonical projection.
- Hosted
Tool Definition - Model-visible provider-hosted tool.
- Hosted
Tool Started - Start of one provider-hosted tool activity.
- Model
Cancellation - Cooperative cancellation scope for an owned operation and its children.
- Model
Capabilities - Provider-neutral capabilities advertised by one model.
- Model
Completion - Successful terminal model completion data.
- Model
Display Name - Human-readable bounded model name.
- Model
Failure - Provider-neutral terminal model failure.
- Model
Ref - Complete canonical identity of one model advertised by one provider.
- Model
Registry - Immutable reference registry for a fixed runtime provider generation.
- Model
Request - Immutable provider-neutral snapshot for one model request.
- Model
Response Info - Metadata reported when a normalized provider response starts.
- Model
Source Citation - Provider-streamed citation awaiting canonical hosted call identity mapping.
- Model
Spec - Validated provider-neutral model specification.
- Model
Stream Index - Bounded zero-based content/tool index in one provider response.
- Model
Stream Summary - Summary of one fully validated normalized stream.
- Model
Stream Validator - Deterministic validator for normalized provider stream grammar.
- Provider
Id - A bounded canonical model-provider selector.
- Provider
Response Id - Bounded opaque response identifier returned by a provider.
- Provider
Tool Call Id - Bounded provider-scoped identifier joining streamed tool-call fragments.
- Reasoning
Options - Provider-neutral reasoning request.
- Reasoning
Profile - Validated provider-neutral reasoning levels supported by one model.
- Reasoning
Resolution - Result of resolving a requested reasoning level for one model.
- Tool
Arguments Delta - Incomplete provider tool-arguments fragment.
- Tool
Call Completed - Completed, parsed provider tool call safe for later canonical projection.
- Tool
Call Started - Start of one provider-streamed tool call.
- Utf8
Delta - Bounded non-empty UTF-8 text or thinking delta.
- WebSearch
Location - Bounded approximate user location for hosted web search.
- WebSearch
Options - Portable policy shared by hosted web-search adapters.
Enums§
- Hosted
Tool Kind - Provider-neutral kind of tool executed by the model provider.
- Hosted
Tool Options - Provider-neutral options for one hosted tool definition.
- Model
Event - One normalized provider stream event.
- Model
Failure Code - Stable provider-neutral model failure classification.
- Model
Registry Error - Invalid immutable provider-registry composition.
- Model
Request Error - Error returned when building or validating a model request.
- Model
Spec Error - Error returned when model limits are inconsistent.
- Model
Stream Value Error - Error returned by normalized stream value constructors.
- Model
Stream Violation - Normalized stream grammar violation.
- Model
Text Parse Error - Error returned when parsing bounded model text values.
- Model
Tool Definition - One model-visible client function or provider-hosted tool definition.
- Reasoning
Effort - Provider-neutral reasoning effort ordered from disabled to maximum.
Constants§
- MAX_
MODEL_ DELTA_ BYTES - Maximum UTF-8 bytes in one normalized text, thinking, or argument delta.
- MAX_
MODEL_ STREAM_ INDEX - Largest concurrent tool-call index supported in one response.
- MAX_
MODEL_ TOOLS - Maximum model-visible tools in one request.
- MAX_
PROVIDER_ OPAQUE_ ID_ BYTES - Maximum UTF-8 bytes in one opaque provider response or tool-call ID.
- MAX_
REQUEST_ MESSAGES - Maximum canonical messages in one model request.
- MAX_
SYSTEM_ PROMPT_ BYTES - Maximum UTF-8 bytes in a system prompt.
- MAX_
TOOL_ DESCRIPTION_ BYTES - Maximum UTF-8 bytes in one model-visible tool description.
- MAX_
TOOL_ SCHEMA_ BYTES - Maximum encoded JSON bytes in one tool input schema.
- MAX_
TOOL_ SCHEMA_ DEPTH - Maximum JSON nesting depth in one tool input schema.
- MAX_
WEB_ SEARCH_ DOMAINS - Maximum number of domains in one portable web-search policy.
- MAX_
WEB_ SEARCH_ DOMAIN_ BYTES - Maximum bytes in one canonical web-search domain.
- MAX_
WEB_ SEARCH_ LOCATION_ FIELD_ BYTES - Maximum bytes in one approximate location field.
Traits§
- Model
Provider - Object-safe provider-neutral model adapter port.
- Model
Router - Object-safe lookup port that routes provider-qualified model identities.
- Model
Stream - Provider-neutral asynchronous stream of normalized model events.
Type Aliases§
- BoxModel
Stream - Heap-owned object-safe model stream returned by provider adapters.