pub struct DynBoundChatModel { /* private fields */ }Expand description
A dynamically-typed chat model bound with tools.
This is the dynamic dispatch version of BoundChatModel, useful when
working with Arc<dyn ChatModel> or boxed trait objects.
Implementations§
Source§impl DynBoundChatModel
impl DynBoundChatModel
Sourcepub fn new(
model: Arc<dyn ChatModel>,
tools: Vec<Arc<dyn Tool + Send + Sync>>,
) -> Self
pub fn new( model: Arc<dyn ChatModel>, tools: Vec<Arc<dyn Tool + Send + Sync>>, ) -> Self
Create a new dynamically-typed bound chat model.
Sourcepub fn with_tool_choice(self, tool_choice: ToolChoice) -> Self
pub fn with_tool_choice(self, tool_choice: ToolChoice) -> Self
Set the tool choice.
Sourcepub fn tool_definitions(&self) -> Vec<ToolDefinition>
pub fn tool_definitions(&self) -> Vec<ToolDefinition>
Get the tool definitions.
Sourcepub fn tool_choice(&self) -> Option<&ToolChoice>
pub fn tool_choice(&self) -> Option<&ToolChoice>
Get the tool choice.
Sourcepub async fn invoke(&self, messages: Vec<BaseMessage>) -> BaseMessage
pub async fn invoke(&self, messages: Vec<BaseMessage>) -> BaseMessage
Invoke the model with messages.
This generates a response using the bound tools.
Trait Implementations§
Source§impl Clone for DynBoundChatModel
impl Clone for DynBoundChatModel
Source§fn clone(&self) -> DynBoundChatModel
fn clone(&self) -> DynBoundChatModel
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DynBoundChatModel
impl !RefUnwindSafe for DynBoundChatModel
impl Send for DynBoundChatModel
impl Sync for DynBoundChatModel
impl Unpin for DynBoundChatModel
impl !UnwindSafe for DynBoundChatModel
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