pub trait AiProviderBase: Send + Sync {
// Required methods
fn provider_name(&self) -> &'static str;
fn auth_header(&self, api_key: String) -> (HeaderName, String);
fn api_key_env_var_name(&self) -> &str;
fn build_request(
&self,
client: &Client,
sys_prompt: &str,
user_prompt: &str,
json_schema: &Schema,
) -> RequestBuilder;
}
Expand description
A trait that defines the provider-specific logic for the generic AiClient
Required Methods§
Sourcefn provider_name(&self) -> &'static str
fn provider_name(&self) -> &'static str
The name of the provider
Sourcefn auth_header(&self, api_key: String) -> (HeaderName, String)
fn auth_header(&self, api_key: String) -> (HeaderName, String)
Returns the header name and value to authenticate the given api key
Sourcefn api_key_env_var_name(&self) -> &str
fn api_key_env_var_name(&self) -> &str
The name of the environent variable expected to have the api key
Sourcefn build_request(
&self,
client: &Client,
sys_prompt: &str,
user_prompt: &str,
json_schema: &Schema,
) -> RequestBuilder
fn build_request( &self, client: &Client, sys_prompt: &str, user_prompt: &str, json_schema: &Schema, ) -> RequestBuilder
Build the provider-specific request