Skip to main content

Crate unllm

Crate unllm 

Source
Expand description

Facade crate for the unllm protocol conversion ecosystem.

Re-exports§

pub use unllm_core as core;
pub use unllm_openai as openai;
pub use unllm_anthropic as anthropic;
pub use unllm_gemini as gemini;

Structs§

AssetLease
A temporary provider-managed asset and its cleanup token.
Candidate
A model candidate.
Capabilities
Capabilities supported by an adapter or configured route.
ConversionContext
Context applied to a single conversion.
ConversionOutcome
A successfully converted value and its non-fatal diagnostics.
Diagnostic
A stable diagnostic emitted during conversion.
DisabledMediaResolver
Resolver used when network media fetching is disabled.
EmbedRequest
A normalized embedding request.
EmbedResponse
A normalized embedding response.
Embedding
A single embedding vector.
GenerateRequest
A normalized generation request.
GenerateResponse
A normalized generation response.
GenerationParameters
Common generation controls.
ImageRequest
A normalized image request.
ImageResponse
A normalized image response.
Instruction
A high-priority instruction kept separate from conversation messages.
MediaAsset
A media value used by multimodal inputs and outputs.
Message
A conversation message.
ReasoningConfig
Common reasoning controls.
RequestEnvelope
Versioned serialized request contract.
ResponseEnvelope
Versioned serialized response contract.
StagingRequest
Describes why an asset needs to be staged at a provider.
StreamAccumulator
Reconstructs a useful complete response from normalized events.
StreamEventEnvelope
Versioned serialized stream event contract.
ToolCall
A completed tool call.
ToolDefinition
A portable function declaration.
ToolResult
A completed tool result.
UnllmError
A normalized error safe to encode for another protocol.
Usage
Token usage reported by an upstream provider.

Enums§

Annotation
A portable response annotation.
Capability
A capability that may be advertised by an adapter or route.
ContentDelta
A typed incremental content payload.
ContentPart
A typed content item.
ConversionMode
Conversion behavior when the target cannot represent source semantics.
DiagnosticSeverity
Diagnostic severity.
EmbeddingInput
Input accepted by the embedding operation.
ErrorKind
Stable high-level error categories used by the gateway.
FinishReason
A normalized finish reason.
ImageTask
Image operation details.
InstructionKind
The kind of high-priority instruction.
MediaSource
The backing source of a media asset.
Operation
A top-level inference operation.
Protocol
A protocol understood by unllm.
ResponseFormat
Structured output preference.
Role
A message author role.
StreamEvent
A normalized streaming event.
ToolChoice
Tool selection policy.
UnifiedRequest
Any normalized request.
UnifiedResponse
Any normalized response.

Constants§

SCHEMA_VERSION
The version of the canonical JSON envelope emitted by this crate.

Traits§

AssetStager
Stages media in a provider-managed file service.
DynAdapter
An object-safe protocol codec used for runtime dispatch.
MediaResolver
Resolves remote media into another supported representation.

Functions§

convert_request
Converts a complete request between two protocol adapters through the canonical model.
convert_response
Converts a complete response between two protocol adapters through the canonical model.
convert_stream_event
Converts one stream event between two protocol adapters.

Type Aliases§

EventStream
Runtime-neutral boxed stream of normalized events.
Extensions
Arbitrary JSON values keyed by provider namespace.