pub trait Provider:
Send
+ Sync
+ 'static {
// Required methods
fn name(&self) -> &'static str;
fn complete<'life0, 'async_trait>(
&'life0 self,
model: Model,
messages: Vec<Message>,
system: Option<String>,
tools: Option<Vec<ToolSchema>>,
token: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, ApiError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided method
fn create_auth_flow(
&self,
_storage: Arc<dyn AuthStorage>,
) -> Option<Box<dyn DynAuthenticationFlow>> { ... }
}Expand description
Provider trait that all LLM providers must implement
Required Methods§
Sourcefn complete<'life0, 'async_trait>(
&'life0 self,
model: Model,
messages: Vec<Message>,
system: Option<String>,
tools: Option<Vec<ToolSchema>>,
token: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn complete<'life0, 'async_trait>(
&'life0 self,
model: Model,
messages: Vec<Message>,
system: Option<String>,
tools: Option<Vec<ToolSchema>>,
token: CancellationToken,
) -> Pin<Box<dyn Future<Output = Result<CompletionResponse, ApiError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Complete a prompt with the LLM
Provided Methods§
Sourcefn create_auth_flow(
&self,
_storage: Arc<dyn AuthStorage>,
) -> Option<Box<dyn DynAuthenticationFlow>>
fn create_auth_flow( &self, _storage: Arc<dyn AuthStorage>, ) -> Option<Box<dyn DynAuthenticationFlow>>
Create an authentication flow for this provider Returns None if the provider doesn’t support authentication
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".