pub struct OpenAiProvider { /* private fields */ }Implementations§
Source§impl OpenAiProvider
impl OpenAiProvider
pub fn new( base_url: impl Into<String>, api_key: impl Into<String>, model: impl Into<String>, ) -> Self
Sourcepub fn with_stream_tx(self, tx: StreamSender) -> Self
pub fn with_stream_tx(self, tx: StreamSender) -> Self
Enable streaming by providing a channel sender for partial tokens.
pub fn with_temperature(self, t: f64) -> Self
pub fn with_max_tokens(self, n: u32) -> Self
pub fn with_retry_policy(self, policy: RetryPolicy) -> Self
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 LlmProvider for OpenAiProvider
impl LlmProvider for OpenAiProvider
fn complete<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Source§fn complete_structured<'life0, 'async_trait>(
&'life0 self,
req: StructuredRequest,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn complete_structured<'life0, 'async_trait>(
&'life0 self,
req: StructuredRequest,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Request a JSON response conforming to a caller-supplied schema.
Default impl returns an error. Providers that support structured
output (e.g. OpenAI-compatible) override this.
Source§fn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
stream_tx: Option<StreamSender>,
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn stream<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
messages: &'life1 [Message],
tools: &'life2 [ToolSpec],
stream_tx: Option<StreamSender>,
) -> Pin<Box<dyn Future<Output = Result<Completion>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Stream a completion token-by-token. Read more
Auto Trait Implementations§
impl Freeze for OpenAiProvider
impl !RefUnwindSafe for OpenAiProvider
impl Send for OpenAiProvider
impl Sync for OpenAiProvider
impl Unpin for OpenAiProvider
impl UnsafeUnpin for OpenAiProvider
impl !UnwindSafe 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