Skip to main content

Crate tea_model

Crate tea_model 

Source
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§

FunctionToolDefinition
Model-visible client function tool.
HostedToolCompleted
Complete provider-hosted tool activity safe for canonical projection.
HostedToolDefinition
Model-visible provider-hosted tool.
HostedToolStarted
Start of one provider-hosted tool activity.
ModelCancellation
Cooperative cancellation scope for an owned operation and its children.
ModelCapabilities
Provider-neutral capabilities advertised by one model.
ModelCompletion
Successful terminal model completion data.
ModelDisplayName
Human-readable bounded model name.
ModelFailure
Provider-neutral terminal model failure.
ModelRef
Complete canonical identity of one model advertised by one provider.
ModelRegistry
Immutable reference registry for a fixed runtime provider generation.
ModelRequest
Immutable provider-neutral snapshot for one model request.
ModelResponseInfo
Metadata reported when a normalized provider response starts.
ModelSourceCitation
Provider-streamed citation awaiting canonical hosted call identity mapping.
ModelSpec
Validated provider-neutral model specification.
ModelStreamIndex
Bounded zero-based content/tool index in one provider response.
ModelStreamSummary
Summary of one fully validated normalized stream.
ModelStreamValidator
Deterministic validator for normalized provider stream grammar.
ProviderId
A bounded canonical model-provider selector.
ProviderResponseId
Bounded opaque response identifier returned by a provider.
ProviderToolCallId
Bounded provider-scoped identifier joining streamed tool-call fragments.
ReasoningOptions
Provider-neutral reasoning request.
ReasoningProfile
Validated provider-neutral reasoning levels supported by one model.
ReasoningResolution
Result of resolving a requested reasoning level for one model.
ToolArgumentsDelta
Incomplete provider tool-arguments fragment.
ToolCallCompleted
Completed, parsed provider tool call safe for later canonical projection.
ToolCallStarted
Start of one provider-streamed tool call.
Utf8Delta
Bounded non-empty UTF-8 text or thinking delta.
WebSearchLocation
Bounded approximate user location for hosted web search.
WebSearchOptions
Portable policy shared by hosted web-search adapters.

Enums§

HostedToolKind
Provider-neutral kind of tool executed by the model provider.
HostedToolOptions
Provider-neutral options for one hosted tool definition.
ModelEvent
One normalized provider stream event.
ModelFailureCode
Stable provider-neutral model failure classification.
ModelRegistryError
Invalid immutable provider-registry composition.
ModelRequestError
Error returned when building or validating a model request.
ModelSpecError
Error returned when model limits are inconsistent.
ModelStreamValueError
Error returned by normalized stream value constructors.
ModelStreamViolation
Normalized stream grammar violation.
ModelTextParseError
Error returned when parsing bounded model text values.
ModelToolDefinition
One model-visible client function or provider-hosted tool definition.
ReasoningEffort
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§

ModelProvider
Object-safe provider-neutral model adapter port.
ModelRouter
Object-safe lookup port that routes provider-qualified model identities.
ModelStream
Provider-neutral asynchronous stream of normalized model events.

Type Aliases§

BoxModelStream
Heap-owned object-safe model stream returned by provider adapters.