pub struct OpenAiProvider { /* private fields */ }Expand description
OpenAI provider (GPT-4o, o1, embeddings).
Implementations§
Source§impl OpenAiProvider
impl OpenAiProvider
Sourcepub fn embed_model(self, model: impl Into<String>) -> Self
pub fn embed_model(self, model: impl Into<String>) -> Self
Set the default embedding model.
Sourcepub fn base_url(self, base_url: impl Into<String>) -> Self
pub fn base_url(self, base_url: impl Into<String>) -> Self
Override the base URL (e.g. for an OpenAI-compatible gateway).
Sourcepub fn with_client(self, client: Client) -> Self
pub fn with_client(self, client: Client) -> Self
Provide a custom reqwest::Client (connection pooling, timeouts, …).
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 LlmProvider for OpenAiProvider
impl LlmProvider for OpenAiProvider
Source§fn chat<'life0, 'async_trait>(
&'life0 self,
req: ChatRequest,
) -> Pin<Box<dyn Future<Output = LlmResult<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat<'life0, 'async_trait>(
&'life0 self,
req: ChatRequest,
) -> Pin<Box<dyn Future<Output = LlmResult<ChatResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Single-shot chat completion.
Source§fn chat_stream<'life0, 'async_trait>(
&'life0 self,
req: ChatRequest,
) -> Pin<Box<dyn Future<Output = LlmResult<ChatStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chat_stream<'life0, 'async_trait>(
&'life0 self,
req: ChatRequest,
) -> Pin<Box<dyn Future<Output = LlmResult<ChatStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Streaming chat completion.
Source§fn embed<'life0, 'async_trait>(
&'life0 self,
req: EmbedRequest,
) -> Pin<Box<dyn Future<Output = LlmResult<EmbedResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn embed<'life0, 'async_trait>(
&'life0 self,
req: EmbedRequest,
) -> Pin<Box<dyn Future<Output = LlmResult<EmbedResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Generate embeddings.
Source§fn estimate_cost(&self, req: &ChatRequest) -> Option<CostEstimate>
fn estimate_cost(&self, req: &ChatRequest) -> Option<CostEstimate>
Pre-flight cost estimate (no network call).
None if unknown.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