pub struct BoxedStructuredChatModel<T> { /* private fields */ }
Expand description
A boxed StructuredChatModel
.
Trait Implementations§
Source§impl<T> ChatModel for BoxedStructuredChatModel<T>
impl<T> ChatModel for BoxedStructuredChatModel<T>
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<T: Clone> Clone for BoxedStructuredChatModel<T>
impl<T: Clone> Clone for BoxedStructuredChatModel<T>
Source§fn clone(&self) -> BoxedStructuredChatModel<T>
fn clone(&self) -> BoxedStructuredChatModel<T>
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<T> CreateChatSession for BoxedStructuredChatModel<T>
impl<T> CreateChatSession for BoxedStructuredChatModel<T>
Source§type ChatSession = BoxedChatSession
type ChatSession = BoxedChatSession
The type of chat session.
Source§type Error = Box<dyn Error + Send + Sync>
type Error = Box<dyn Error + Send + Sync>
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> CreateDefaultChatConstraintsForType<T> for BoxedStructuredChatModel<T>where
T: 'static,
impl<T> CreateDefaultChatConstraintsForType<T> for BoxedStructuredChatModel<T>where
T: 'static,
Source§type DefaultConstraints = BoxedChatConstraintsForType<T>
type DefaultConstraints = BoxedChatConstraintsForType<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<T: 'static> StructuredChatModel<BoxedChatConstraintsForType<T>> for BoxedStructuredChatModel<T>
impl<T: 'static> StructuredChatModel<BoxedChatConstraintsForType<T>> for BoxedStructuredChatModel<T>
Source§fn add_message_with_callback_and_constraints<'a>(
&'a self,
session: &'a mut Self::ChatSession,
messages: &[ChatMessage],
sampler: GenerationParameters,
constraints: BoxedChatConstraintsForType<T>,
on_token: impl FnMut(String) -> Result<(), Self::Error> + Send + Sync + 'static,
) -> impl Future<Output = Result<T, Self::Error>> + Send + 'a
fn add_message_with_callback_and_constraints<'a>( &'a self, session: &'a mut Self::ChatSession, messages: &[ChatMessage], sampler: GenerationParameters, constraints: BoxedChatConstraintsForType<T>, on_token: impl FnMut(String) -> Result<(), Self::Error> + Send + Sync + 'static, ) -> impl Future<Output = Result<T, 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<T> Freeze for BoxedStructuredChatModel<T>
impl<T> !RefUnwindSafe for BoxedStructuredChatModel<T>
impl<T> Send for BoxedStructuredChatModel<T>
impl<T> Sync for BoxedStructuredChatModel<T>
impl<T> Unpin for BoxedStructuredChatModel<T>
impl<T> !UnwindSafe for BoxedStructuredChatModel<T>
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