AiProviderBase

Trait AiProviderBase 

Source
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§

Source

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

The name of the provider

Source

fn auth_header(&self, api_key: String) -> (HeaderName, String)

Returns the header name and value to authenticate the given api key

Source

fn api_key_env_var_name(&self) -> &str

The name of the environent variable expected to have the api key

Source

fn build_request( &self, client: &Client, sys_prompt: &str, user_prompt: &str, json_schema: &Schema, ) -> RequestBuilder

Build the provider-specific request

Implementors§