Skip to main content

llm_dialect/
lib.rs

1//! llm-dialect: pure sans-I/O translation between LLM wire formats.
2//!
3//! Parse an Anthropic (`/v1/messages`), OpenAI chat (`/v1/chat/completions`),
4//! or OpenAI Responses (`/v1/responses`) wire request into the canonical
5//! [`items`] model, flatten to the [`canonical`] `ChatRequest` an engine
6//! consumes ([`dialect::deflate`]), and render the engine's responses/
7//! streams back to the caller's dialect ([`dialect::*`]).
8//!
9//! The mapping is pure: no async runtime, no HTTP types in the public
10//! signatures, no wall clock, no randomness — ids and timestamps are supplied
11//! by the caller at the sanctioned factory boundaries. The optional `axum`
12//! feature adds the SSE pump ([`dialect::sse`]) and per-dialect stream
13//! `Response` shells for embedders that *are* an axum service.
14
15pub mod canonical;
16pub mod dialect;
17pub mod error;
18pub mod items;