Expand description
Pure Rust translation engine for Switchyard.
The crate translates provider wire formats through a neutral Switchyard conversation IR. It intentionally has no dependency on provider SDKs, HTTP servers, Python objects, or FFI bindings.
Re-exports§
pub use util::normalize_anthropic_tool_use_ids;pub use util::sanitize_anthropic_tool_use_id;pub use util::PRESERVATION_METADATA_KEY;pub use diagnostic::*;pub use engine::*;pub use error::*;pub use policy::*;pub use stream::*;
Modules§
- codecs
- Buffered wire-format codecs that translate between provider JSON and IR.
- diagnostic
- Diagnostics emitted when translation preserves, drops, or degrades data.
- engine
- Registry-backed translation engine for buffered requests and responses.
- error
- Error types for request, response, and streaming translation.
- format
- Wire-format identifiers carried by the shared protocol types.
- llm
- Provider-neutral conversation types shared by routing, clients, and translation.
- policy
- Policy knobs that control translation strictness and target capabilities.
- stream
- Public compatibility module for streaming translation APIs.
- util
- Shared helpers for codec validation, diagnostics, and preservation metadata.
Structs§
- Format
Id - Extensible wire-format identifier used by codec registries.
- Instruction
Block - Instruction content separated from normal conversation messages.
- LlmRequest
- Normalized request representation shared by Switchyard components.
- LlmResponse
- Normalized response representation shared by Switchyard components.
- Message
- One normalized conversation message.
- Output
Params - Output budget and structured-output options.
- Preservation
Metadata - Exact source payloads retained for lossless round trips.
- Provider
Extensions - Provider-specific fields that do not have first-class conversation fields.
- Reasoning
Params - Provider reasoning controls preserved by translation.
- Response
Output - One assistant output item in a normalized response.
- Sampling
Params - Provider sampling parameters with common cross-provider names.
- Tool
Call - Normalized assistant tool call.
- Tool
Definition - Normalized tool definition.
- Tool
Result - Normalized tool result message content.
- Usage
- Normalized token usage counts.
Enums§
- Content
Block - Normalized content block variants carried by messages and tool results.
- File
Source - File payload forms supported by the conversation model.
- Image
Source - Image payload forms supported by the conversation model.
- LlmStream
Event - Provider-neutral event used between stream decoders and encoders.
- Media
Source - Audio and video payload forms supported by the conversation model.
- Role
- Actor role normalized across provider APIs.
- Stop
Reason - Normalized reason a model stopped producing output.
- Tool
Choice - Normalized tool choice policy.
- Wire
Format - Built-in provider API formats.