pub struct Tool {
pub name: String,
pub description: String,
pub input_schema: Value,
}Expand description
A tool the model may call, defined by a name, description, and JSON Schema.
Fields§
§name: StringTool name the model uses to invoke it.
description: StringHuman-readable description guiding when to use the tool.
input_schema: ValueJSON Schema for the tool’s input object.
Implementations§
Source§impl Tool
impl Tool
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
input_schema: Value,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, input_schema: Value, ) -> Self
Build a tool from its parts.
Sourcepub fn from_schema<T: ToolSchema>() -> Self
pub fn from_schema<T: ToolSchema>() -> Self
Build a tool from any type implementing ToolSchema (e.g. via the
#[derive(ToolSchema)] macro).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tool
impl<'de> Deserialize<'de> for Tool
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 StructuralPartialEq for Tool
Auto Trait Implementations§
impl Freeze for Tool
impl RefUnwindSafe for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl UnsafeUnpin for Tool
impl UnwindSafe for Tool
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