Skip to main content

systemprompt_api/services/gateway/protocol/
mod.rs

1//! Protocol translation between caller and upstream LLM wire formats.
2//!
3//! The [`canonical`] model is the hub: [`inbound`] adapters parse caller
4//! requests into it and render responses back out, while [`outbound`] adapters
5//! send it to upstream providers and convert their replies and streams into
6//! [`canonical_response`] events. This indirection lets any supported inbound
7//! protocol target any supported upstream provider.
8
9pub mod canonical;
10pub mod canonical_response;
11pub mod inbound;
12pub mod outbound;
13
14pub use canonical::{
15    CanonicalContent, CanonicalMessage, CanonicalRequest, CanonicalTool, CanonicalToolChoice,
16    ImageSource, Role, ThinkingConfig,
17};
18pub use canonical_response::{
19    CanonicalEvent, CanonicalResponse, CanonicalStopReason, CanonicalUsage, ContentBlockKind,
20};
21pub use inbound::{InboundAdapter, InboundParseError, anthropic_messages, openai_responses};
22pub use outbound::{
23    OutboundAdapter, OutboundAdapterRegistration, OutboundCtx, OutboundOutcome,
24    anthropic as outbound_anthropic, openai_chat, openai_responses as outbound_openai_responses,
25};