pub struct ToolSchema {
pub name: String,
pub description: String,
pub parameters: Value,
}Expand description
The definition of a tool as exposed to the model.
The model decides whether to call the tool and how to generate arguments
from name / description / parameters; Provider implementations map
it to the vendor’s wire format.
§Example
use molo::tool::ToolSchema;
use serde_json::json;
let schema = ToolSchema {
name: "get_weather".into(),
description: "Get the weather for a given city".into(),
parameters: json!({
"type": "object",
"properties": {
"city": { "type": "string", "description": "City name" }
},
"required": ["city"]
}),
};
assert_eq!(schema.name, "get_weather");Fields§
§name: StringTool name (the basis on which the model selects a tool).
description: StringTool description (the basis on which the model understands the tool’s purpose).
parameters: ValueJSON Schema for the arguments, preferably generated from a serde
struct with schemars::schema_for!.
Trait Implementations§
Source§impl Clone for ToolSchema
impl Clone for ToolSchema
Source§fn clone(&self) -> ToolSchema
fn clone(&self) -> ToolSchema
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ToolSchema
impl Debug for ToolSchema
Source§impl<'de> Deserialize<'de> for ToolSchema
impl<'de> Deserialize<'de> for ToolSchema
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 ToolSchema
impl PartialEq for ToolSchema
Source§impl Serialize for ToolSchema
impl Serialize for ToolSchema
impl StructuralPartialEq for ToolSchema
Auto Trait Implementations§
impl Freeze for ToolSchema
impl RefUnwindSafe for ToolSchema
impl Send for ToolSchema
impl Sync for ToolSchema
impl Unpin for ToolSchema
impl UnsafeUnpin for ToolSchema
impl UnwindSafe for ToolSchema
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