pub enum ToolReference {
Function {
name: String,
},
Mcp {
server_label: String,
name: Option<String>,
},
FileSearch,
WebSearchPreview,
ComputerUsePreview,
CodeInterpreter,
ImageGeneration,
}Expand description
Tool reference for ToolChoice::AllowedTools
Represents a reference to a specific tool in the allowed_tools array. Different tool types have different required fields.
Variants§
Function
Reference to a function tool
Mcp
Reference to an MCP tool
FileSearch
File search hosted tool
WebSearchPreview
Web search preview hosted tool
ComputerUsePreview
Computer use preview hosted tool
CodeInterpreter
Code interpreter hosted tool
ImageGeneration
Image generation hosted tool
Implementations§
Source§impl ToolReference
impl ToolReference
Sourcepub fn identifier(&self) -> String
pub fn identifier(&self) -> String
Get a unique identifier for this tool reference
Sourcepub fn function_name(&self) -> Option<&str>
pub fn function_name(&self) -> Option<&str>
Get the tool name if this is a function tool
Trait Implementations§
Source§impl Clone for ToolReference
impl Clone for ToolReference
Source§fn clone(&self) -> ToolReference
fn clone(&self) -> ToolReference
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 ToolReference
impl Debug for ToolReference
Source§impl<'de> Deserialize<'de> for ToolReference
impl<'de> Deserialize<'de> for ToolReference
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
Auto Trait Implementations§
impl Freeze for ToolReference
impl RefUnwindSafe for ToolReference
impl Send for ToolReference
impl Sync for ToolReference
impl Unpin for ToolReference
impl UnwindSafe for ToolReference
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