pub trait Provider:
Debug
+ Send
+ Sync {
type Config: Config;
type ChatRequest: Requestable;
type ChatResponse: Respondable;
type ChatResponseStream: Respondable;
// Required methods
fn config(&self) -> &Self::Config;
fn chat<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 (impl 'async_trait + HttpClient),
request: Self::ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<Self::ChatResponse, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn chat_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 (impl 'async_trait + HttpClient),
request: Self::ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Self::ChatResponseStream, Error>> + Send>>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn completions<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 (impl 'async_trait + HttpClient),
request: CompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}
Required Associated Types§
type Config: Config
type ChatRequest: Requestable
type ChatResponse: Respondable
type ChatResponseStream: Respondable
Required Methods§
fn config(&self) -> &Self::Config
fn chat<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 (impl 'async_trait + HttpClient),
request: Self::ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<Self::ChatResponse, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn chat_stream<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 (impl 'async_trait + HttpClient),
request: Self::ChatRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<Self::ChatResponseStream, Error>> + Send>>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn completions<'life0, 'life1, 'async_trait>(
&'life0 self,
client: &'life1 (impl 'async_trait + HttpClient),
request: CompletionRequest,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.