pub struct ToolSpec {
pub name: String,
pub description: String,
pub parameters: JsonValue,
}Expand description
A tool a model may be offered: a name, a description, and a JSON-Schema parameter object.
Fields§
§name: String§description: String§parameters: JsonValueImplementations§
Source§impl ToolSpec
impl ToolSpec
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
parameters: JsonValue,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, parameters: JsonValue, ) -> Self
A tool spec.
Sourcepub fn payload_value(&self) -> JsonValue
pub fn payload_value(&self) -> JsonValue
The {name, description, parameters} payload form.
Sourcepub fn from_payload(value: &JsonValue) -> Option<Self>
pub fn from_payload(value: &JsonValue) -> Option<Self>
Parse a spec from its payload form, or None if it has no name.
Sourcepub fn from_payload_array(value: Option<&JsonValue>) -> Vec<Self>
pub fn from_payload_array(value: Option<&JsonValue>) -> Vec<Self>
Parse an array of specs, dropping any that don’t parse.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ToolSpec
impl<'de> Deserialize<'de> for ToolSpec
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 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