pub struct Function {
pub name: String,
pub description: String,
pub parameters: Option<Value>,
}Expand description
Definition of a caller-provided function that the model may invoke.
§Validation
name- Must be 1 to 64 ASCII letters, digits, underscores, or hyphensparameters- Must be a valid JSON schema
Fields§
§name: StringThe name of the function. Must match [A-Za-z0-9_-]{1,64}.
description: StringA description of what the function does.
parameters: Option<Value>JSON Schema object describing the function parameters.
Implementations§
Source§impl Function
impl Function
Sourcepub fn new(
name: impl Into<String>,
description: impl Into<String>,
parameters: Value,
) -> Self
pub fn new( name: impl Into<String>, description: impl Into<String>, parameters: Value, ) -> Self
Create a function definition with a JSON Schema parameter object.
§Examples
use zai_rs::model::tools::Function;
let func = Function::new(
"get_weather",
"Get current weather for a location",
serde_json::json!({
"type": "object",
"properties": { "location": { "type": "string" } }
})
);Trait Implementations§
Source§impl<'v_a> ValidateArgs<'v_a> for Function
impl<'v_a> ValidateArgs<'v_a> for Function
Auto Trait Implementations§
impl Freeze for Function
impl RefUnwindSafe for Function
impl Send for Function
impl Sync for Function
impl Unpin for Function
impl UnsafeUnpin for Function
impl UnwindSafe for Function
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