vapi_client/models/
open_ai_function.rs

1/*
2 * Vapi API
3 *
4 * Voice AI for developers.
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct OpenAiFunction {
16    /// This is a boolean that controls whether to enable strict schema adherence when generating the function call. If set to true, the model will follow the exact schema defined in the parameters field. Only a subset of JSON Schema is supported when strict is true. Learn more about Structured Outputs in the [OpenAI guide](https://openai.com/index/introducing-structured-outputs-in-the-api/).  @default false
17    #[serde(rename = "strict", skip_serializing_if = "Option::is_none")]
18    pub strict: Option<bool>,
19    /// This is the the name of the function to be called.  Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
20    #[serde(rename = "name")]
21    pub name: String,
22    /// This is the description of what the function does, used by the AI to choose when and how to call the function.
23    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
24    pub description: Option<String>,
25    /// These are the parameters the functions accepts, described as a JSON Schema object.  See the [OpenAI guide](https://platform.openai.com/docs/guides/function-calling) for examples, and the [JSON Schema reference](https://json-schema.org/understanding-json-schema) for documentation about the format.  Omitting parameters defines a function with an empty parameter list.
26    #[serde(rename = "parameters", skip_serializing_if = "Option::is_none")]
27    pub parameters: Option<models::OpenAiFunctionParameters>,
28}
29
30impl OpenAiFunction {
31    pub fn new(name: String) -> OpenAiFunction {
32        OpenAiFunction {
33            strict: None,
34            name,
35            description: None,
36            parameters: None,
37        }
38    }
39}