pub struct OpenAiProvider {
pub id: String,
pub base_url: String,
pub api_key_env: Option<String>,
pub http: Client,
}Expand description
Speaks POST {base}/v1/chat/completions (OpenAI Chat Completions API).
Fields§
§id: StringLadder prefix / trace label for this provider ("openai", "groq", "together", …).
base_url: StringBase URL, e.g. https://api.openai.com or https://api.groq.com/openai.
api_key_env: Option<String>Env var the API key is read from, e.g. "GROQ_API_KEY". None for the built-in openai
provider (resolves via Auth: authorization header or OPENAI_API_KEY) and for keyless
local endpoints (Ollama / vLLM).
http: ClientShared, connection-pooled HTTP client.
Trait Implementations§
Source§impl Clone for OpenAiProvider
impl Clone for OpenAiProvider
Source§fn clone(&self) -> OpenAiProvider
fn clone(&self) -> OpenAiProvider
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OpenAiProvider
impl Debug for OpenAiProvider
Source§impl Provider for OpenAiProvider
impl Provider for OpenAiProvider
Source§fn complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 ModelRequest,
auth: &'life2 Auth,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
req: &'life1 ModelRequest,
auth: &'life2 Auth,
) -> Pin<Box<dyn Future<Output = Result<ModelResponse, ProviderError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Call the model and normalize the result. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for OpenAiProvider
impl !UnwindSafe for OpenAiProvider
impl Freeze for OpenAiProvider
impl Send for OpenAiProvider
impl Sync for OpenAiProvider
impl Unpin for OpenAiProvider
impl UnsafeUnpin for OpenAiProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more