Skip to main content

ProviderAdapter

Trait ProviderAdapter 

Source
pub trait ProviderAdapter:
    Send
    + Sync
    + 'static {
    // Required methods
    fn name(&self) -> &'static str;
    fn matches_path(&self, method: &Method, path: &str) -> bool;
    fn upstream_base(&self) -> &Url;
    fn request_pii_surfaces<'a>(
        &self,
        body: &'a mut Value,
    ) -> Vec<PiiSurface<'a>>;
    fn response_pii_surfaces<'a>(
        &self,
        body: &'a mut Value,
    ) -> Vec<PiiSurface<'a>>;
    fn sse_event_pii_surfaces<'a>(
        &self,
        event: &'a mut SseEvent,
    ) -> Vec<PiiSurface<'a>>;

    // Provided methods
    fn contract(&self) -> AdapterContract<'_> { ... }
    fn requests_json_output(&self, _request: &Value) -> bool { ... }
}

Required Methods§

Source

fn name(&self) -> &'static str

Source

fn matches_path(&self, method: &Method, path: &str) -> bool

Source

fn upstream_base(&self) -> &Url

Source

fn request_pii_surfaces<'a>(&self, body: &'a mut Value) -> Vec<PiiSurface<'a>>

Source

fn response_pii_surfaces<'a>(&self, body: &'a mut Value) -> Vec<PiiSurface<'a>>

Source

fn sse_event_pii_surfaces<'a>( &self, event: &'a mut SseEvent, ) -> Vec<PiiSurface<'a>>

Provided Methods§

Source

fn contract(&self) -> AdapterContract<'_>

Declares protocol and safety behavior while preserving old implementations.

Source

fn requests_json_output(&self, _request: &Value) -> bool

Reports whether request asked the model for JSON output (a JSON mode or a JSON schema), which makes every SurfaceSyntax::ModelOutput response surface a JSON document. The default, false, restores model output as free text.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§