#[non_exhaustive]pub struct ToolSpec {
pub name: String,
pub description: String,
pub parameters: Value,
}Expand description
A tool the model is offered: a name, the instruction a model reads when deciding whether to call it, and the JSON Schema of the arguments object the call must carry (issue #665).
#[non_exhaustive]: build one with ToolSpec::new rather than a
struct literal, the same rule Prompt and Completion follow —
what a tool declares grows, and it should not break every caller.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: String§description: String§parameters: ValueA JSON Schema (draft 2020-12) of the arguments object a call must
provide. run_tool_loop validates it up
front and then validates every call’s arguments against it, and
refuses a schema using a keyword it cannot honour rather than
silently skipping the check.
Implementations§
Trait Implementations§
impl StructuralPartialEq for ToolSpec
Auto Trait Implementations§
impl Freeze for ToolSpec
impl RefUnwindSafe for ToolSpec
impl Send for ToolSpec
impl Sync for ToolSpec
impl Unpin for ToolSpec
impl UnsafeUnpin for ToolSpec
impl UnwindSafe for ToolSpec
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