pub struct OpenAICompatibleChatModel { /* private fields */ }
Expand description
An chat model that uses OpenAI’s API for the a remote chat model.
Implementations§
Source§impl OpenAICompatibleChatModel
impl OpenAICompatibleChatModel
Sourcepub fn builder() -> OpenAICompatibleChatModelBuilder<false>
pub fn builder() -> OpenAICompatibleChatModelBuilder<false>
Create a new builder for the OpenAI compatible chat model.
Trait Implementations§
Source§impl ChatModel for OpenAICompatibleChatModel
impl ChatModel for OpenAICompatibleChatModel
Source§fn add_messages_with_callback<'a>(
&'a self,
session: &'a mut Self::ChatSession,
messages: &[ChatMessage],
sampler: GenerationParameters,
on_token: impl FnMut(String) -> Result<(), Self::Error> + Send + Sync + 'static,
) -> impl Future<Output = Result<(), Self::Error>> + Send + 'a
fn add_messages_with_callback<'a>( &'a self, session: &'a mut Self::ChatSession, messages: &[ChatMessage], sampler: GenerationParameters, on_token: impl FnMut(String) -> Result<(), Self::Error> + Send + Sync + 'static, ) -> impl Future<Output = Result<(), Self::Error>> + Send + 'a
Add messages to the chat session with a callback that is called for each token. Read more
Source§impl Clone for OpenAICompatibleChatModel
impl Clone for OpenAICompatibleChatModel
Source§fn clone(&self) -> OpenAICompatibleChatModel
fn clone(&self) -> OpenAICompatibleChatModel
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl CreateChatSession for OpenAICompatibleChatModel
impl CreateChatSession for OpenAICompatibleChatModel
Source§type ChatSession = OpenAICompatibleChatSession
type ChatSession = OpenAICompatibleChatSession
The type of chat session.
Source§type Error = OpenAICompatibleChatModelError
type Error = OpenAICompatibleChatModelError
The type of error the chat session may return during operations.
Source§fn new_chat_session(&self) -> Result<Self::ChatSession, Self::Error>
fn new_chat_session(&self) -> Result<Self::ChatSession, Self::Error>
Create a new chat session for this model. Read more
Source§impl<T: Schema + DeserializeOwned> CreateDefaultChatConstraintsForType<T> for OpenAICompatibleChatModel
impl<T: Schema + DeserializeOwned> CreateDefaultChatConstraintsForType<T> for OpenAICompatibleChatModel
Source§type DefaultConstraints = SchemaParser<T>
type DefaultConstraints = SchemaParser<T>
The default constraints for this type that work with this chat model.
Source§fn create_default_constraints() -> Self::DefaultConstraints
fn create_default_constraints() -> Self::DefaultConstraints
Create
Self::DefaultConstraints
which parse the type T
for this chat model.Source§impl Debug for OpenAICompatibleChatModel
impl Debug for OpenAICompatibleChatModel
Source§impl<P> StructuredChatModel<SchemaParser<P>> for OpenAICompatibleChatModelwhere
P: Schema + DeserializeOwned,
impl<P> StructuredChatModel<SchemaParser<P>> for OpenAICompatibleChatModelwhere
P: Schema + DeserializeOwned,
Source§fn add_message_with_callback_and_constraints<'a>(
&'a self,
session: &'a mut Self::ChatSession,
messages: &[ChatMessage],
sampler: GenerationParameters,
_: SchemaParser<P>,
on_token: impl FnMut(String) -> Result<(), Self::Error> + Send + Sync + 'static,
) -> impl Future<Output = Result<P, Self::Error>> + Send + 'a
fn add_message_with_callback_and_constraints<'a>( &'a self, session: &'a mut Self::ChatSession, messages: &[ChatMessage], sampler: GenerationParameters, _: SchemaParser<P>, on_token: impl FnMut(String) -> Result<(), Self::Error> + Send + Sync + 'static, ) -> impl Future<Output = Result<P, Self::Error>> + Send + 'a
Add messages to the chat session with a callback that is called for each token and a constraints the response must follow. Read more
Auto Trait Implementations§
impl Freeze for OpenAICompatibleChatModel
impl !RefUnwindSafe for OpenAICompatibleChatModel
impl Send for OpenAICompatibleChatModel
impl Sync for OpenAICompatibleChatModel
impl Unpin for OpenAICompatibleChatModel
impl !UnwindSafe for OpenAICompatibleChatModel
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
Source§impl<M> ChatModelExt for Mwhere
M: CreateChatSession,
impl<M> ChatModelExt for Mwhere
M: CreateChatSession,
Source§fn chat(&self) -> Chat<Self>where
Self: Clone,
fn chat(&self) -> Chat<Self>where
Self: Clone,
Create a new chat session with the model.
Let’s start with a simple chat application: Read more
Source§fn task(&self, description: impl ToString) -> Task<Self>where
Self: Clone,
fn task(&self, description: impl ToString) -> Task<Self>where
Self: Clone,
Create a new task with the model. Read more
Source§fn boxed_chat_model(self) -> BoxedChatModel
fn boxed_chat_model(self) -> BoxedChatModel
Source§fn boxed_typed_chat_model<T>(self) -> BoxedStructuredChatModel<T>where
Self: StructuredChatModel<Self::DefaultConstraints, Error: Send + Sync + Error + 'static, ChatSession: ChatSession<Error: Error + Send + Sync + 'static> + Clone + Send + Sync + 'static> + CreateDefaultChatConstraintsForType<T> + Sized + Send + Sync + 'static,
T: 'static,
fn boxed_typed_chat_model<T>(self) -> BoxedStructuredChatModel<T>where
Self: StructuredChatModel<Self::DefaultConstraints, Error: Send + Sync + Error + 'static, ChatSession: ChatSession<Error: Error + Send + Sync + 'static> + Clone + Send + Sync + 'static> + CreateDefaultChatConstraintsForType<T> + Sized + Send + Sync + 'static,
T: 'static,
Erase the type of the structured chat model. This can be used to make multiple implementations of
StructuredChatModel
compatible with the same type. Read more