pub struct FunctionDefinition {
pub name: String,
pub description: Option<String>,
pub parameters: Option<Value>,
pub strict: Option<bool>,
}Expand description
Function definition inside a tool
Fields§
§name: StringFunction name
description: Option<String>Function description
parameters: Option<Value>Parameters JSON Schema
strict: Option<bool>Strict mode (OpenAI specific)
Implementations§
Source§impl FunctionDefinition
impl FunctionDefinition
Sourcepub fn new(name: impl Into<String>) -> Self
pub fn new(name: impl Into<String>) -> Self
Creates a new function definition with the given name.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Sets the function description (builder style).
Sourcepub fn with_parameters(self, parameters: Value) -> Self
pub fn with_parameters(self, parameters: Value) -> Self
Sets the parameters JSON schema (builder style).
Trait Implementations§
Source§impl Clone for FunctionDefinition
impl Clone for FunctionDefinition
Source§fn clone(&self) -> FunctionDefinition
fn clone(&self) -> FunctionDefinition
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 FunctionDefinition
impl Debug for FunctionDefinition
Source§impl<'de> Deserialize<'de> for FunctionDefinition
impl<'de> Deserialize<'de> for FunctionDefinition
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 FunctionDefinition
impl RefUnwindSafe for FunctionDefinition
impl Send for FunctionDefinition
impl Sync for FunctionDefinition
impl Unpin for FunctionDefinition
impl UnsafeUnpin for FunctionDefinition
impl UnwindSafe for FunctionDefinition
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