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//!
9//! Copyright (c) systemprompt.io — Business Source License 1.1.
10//! See <https://systemprompt.io> for licensing details.
11
12pub mod canonical;
13pub mod canonical_response;
14pub mod inbound;
15pub mod outbound;
16
17pub use canonical::{
18    CanonicalContent, CanonicalMessage, CanonicalRequest, CanonicalTool, CanonicalToolChoice,
19    ImageSource, Role, ThinkingConfig,
20};
21pub use canonical_response::{
22    CanonicalEvent, CanonicalResponse, CanonicalStopReason, CanonicalUsage, CanonicalUsageUpdate,
23    ContentBlockKind,
24};
25pub use inbound::{InboundAdapter, InboundParseError, anthropic_messages, openai_responses};
26pub use outbound::{
27    OutboundAdapter, OutboundAdapterRegistration, OutboundCtx, OutboundOutcome,
28    anthropic as outbound_anthropic, openai_chat, openai_responses as outbound_openai_responses,
29};