pub struct OpenAiChatModel { /* private fields */ }
Implementations§
Source§impl OpenAiChatModel
impl OpenAiChatModel
pub fn new(config: OpenAiConfig) -> Result<OpenAiChatModel, Error>
Trait Implementations§
Source§impl LanguageModel for OpenAiChatModel
impl LanguageModel for OpenAiChatModel
Source§fn generate<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
OpenAiChatModel: 'async_trait,
fn generate<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<LlmResponse, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
OpenAiChatModel: 'async_trait,
Generate a complete response (non-streaming)
Source§fn generate_stream<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamChunk, Error>> + Send>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
OpenAiChatModel: 'async_trait,
fn generate_stream<'life0, 'async_trait>(
&'life0 self,
request: LlmRequest,
) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<StreamChunk, Error>> + Send>>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
OpenAiChatModel: 'async_trait,
Generate a streaming response
Default implementation falls back to non-streaming generate()
Auto Trait Implementations§
impl Freeze for OpenAiChatModel
impl !RefUnwindSafe for OpenAiChatModel
impl Send for OpenAiChatModel
impl Sync for OpenAiChatModel
impl Unpin for OpenAiChatModel
impl !UnwindSafe for OpenAiChatModel
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreCreates a shared type from an unshared type.