pub enum ToolChoice {
Auto,
None,
Required,
Any,
Tool {
name: String,
},
Allowed {
mode: AllowedToolMode,
names: Vec<String>,
},
}Expand description
Portable tool-selection policy for a request.
Provider renderers map this policy into their native tool-choice shape after the selected model has validated whether tools, strict schemas, and forced choices are supported together.
§Examples
let choice = providers_kit::generation::ToolChoice::Tool {
name: "lookup_weather".into(),
};
assert!(matches!(choice, providers_kit::generation::ToolChoice::Tool { .. }));Variants§
Auto
Lets the provider choose whether tools should be used.
None
Disables tool calling for the request.
Required
Requires at least one tool call before completion.
Any
Allows any declared tool to be called.
Tool
Forces the provider to call one specific tool.
Allowed
Restricts tool calls to an explicit subset of tool names.
Fields
§
mode: AllowedToolModeEnforcement mode for the allowed-tool subset.
Trait Implementations§
Source§impl Clone for ToolChoice
impl Clone for ToolChoice
Source§impl Debug for ToolChoice
impl Debug for ToolChoice
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
impl Eq for ToolChoice
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 UnsafeUnpin 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.