Skip to main content

Provider

Trait Provider 

Source
pub trait Provider: Send + Sync {
    // Required methods
    fn api(&self) -> &str;
    fn stream(&self, request: Request) -> EventStream;
}
Expand description

A wire API: turns a model, a transcript and options into a streamed message.

Implementations never fail the call itself. Every outcome, including request errors and cancellation, arrives on the stream, which ends with exactly one StreamEvent::Done or StreamEvent::Error.

Required Methods§

Source

fn api(&self) -> &str

The wire API id this provider speaks, such as anthropic-messages.

Source

fn stream(&self, request: Request) -> EventStream

Starts streaming a response. Must be called inside a tokio runtime.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§