Skip to main content

UpstreamDialect

Trait UpstreamDialect 

Source
pub trait UpstreamDialect: Send + Sync {
    // Required methods
    fn shape(
        &self,
        ctx: &RequestContext,
        upstream: &Upstream,
        principal: &Principal,
        builder: &mut ShapedRequestBuilder,
    ) -> Result<ShapedRequest, DialectError>;
    fn normalize_error(&self, status: StatusCode, body: &Bytes) -> Option<Bytes>;
}
Expand description

Upstream dialect boundary for request shaping and error normalization.

Required Methods§

Source

fn shape( &self, ctx: &RequestContext, upstream: &Upstream, principal: &Principal, builder: &mut ShapedRequestBuilder, ) -> Result<ShapedRequest, DialectError>

Shapes a downstream Anthropic-compatible request for the selected upstream.

Source

fn normalize_error(&self, status: StatusCode, body: &Bytes) -> Option<Bytes>

Normalizes an upstream error body to Anthropic error shape when possible.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§