pub enum ToolChoice {
Auto,
None,
Required,
Specific(String),
}Expand description
Strategy for how the LLM should handle tool selection.
Controls whether the LLM must use tools, can choose to use them, or is restricted from using them.
§Example
use multi_llm::{RequestConfig, ToolChoice};
// Let the model decide
let config = RequestConfig {
tool_choice: Some(ToolChoice::Auto),
..Default::default()
};
// Force a specific tool
let config = RequestConfig {
tool_choice: Some(ToolChoice::Specific("get_weather".to_string())),
..Default::default()
};Variants§
Auto
Let the model decide whether and which tools to use.
The model may call zero, one, or multiple tools based on the conversation.
None
Disable tool use entirely for this request.
Even if tools are defined, the model will not call them.
Required
Force the model to use at least one tool.
Useful when you know a tool call is needed but don’t care which one.
Specific(String)
Force the model to use a specific tool by name.
The model will call exactly this tool (if arguments can be determined).
Trait Implementations§
Source§impl Clone for ToolChoice
impl Clone for ToolChoice
Source§fn clone(&self) -> ToolChoice
fn clone(&self) -> ToolChoice
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 moreSource§impl Debug for ToolChoice
impl Debug for ToolChoice
Source§impl Default for ToolChoice
impl Default for ToolChoice
Source§fn default() -> ToolChoice
fn default() -> ToolChoice
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for ToolChoice
impl<'de> Deserialize<'de> for ToolChoice
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for ToolChoice
impl PartialEq for ToolChoice
Source§impl Serialize for ToolChoice
impl Serialize for ToolChoice
impl StructuralPartialEq for ToolChoice
Auto Trait Implementations§
impl Freeze for ToolChoice
impl RefUnwindSafe for ToolChoice
impl Send for ToolChoice
impl Sync for ToolChoice
impl Unpin for ToolChoice
impl UnwindSafe for ToolChoice
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