openai_struct/models/function_object.rs
1/*
2 * OpenAI API
3 *
4 * The OpenAI REST API. Please see pub https://platform.openai.com/docs/api-reference for more details.
5 *
6 * OpenAPI spec pub version: 2.3.0
7 *
8 * Generated pub by: https://github.com/swagger-api/swagger-codegen.git
9 */
10
11#[allow(unused_imports)]
12use serde_json::Value;
13
14/// # on openapi.yaml
15///
16/// ```yaml
17/// FunctionObject:
18/// type: object
19/// properties:
20/// description:
21/// type: string
22/// description:
23/// A description of what the function does, used by the model to
24/// choose when and how to call the function.
25/// name:
26/// type: string
27/// description:
28/// The name of the function to be called. Must be a-z, A-Z, 0-9, or
29/// contain underscores and dashes, with a maximum length of 64.
30/// parameters:
31/// $ref: "#/components/schemas/FunctionParameters"
32/// strict:
33/// type: boolean
34/// nullable: true
35/// default: false
36/// description:
37/// Whether to enable strict schema adherence when generating the
38/// function call. If set to true, the model will follow the exact
39/// schema defined in the `parameters` field. Only a subset of JSON
40/// Schema is supported when `strict` is `true`. Learn more about
41/// Structured Outputs in the [function calling
42/// guide](docs/guides/function-calling).
43/// required:
44/// - name
45/// ```
46#[derive(Debug, Serialize, Deserialize)]
47pub struct FunctionObject {
48 #[serde(rename = "parameters")]
49 pub parameters: Option<crate::models::FunctionParameters>,
50 /// A description of what the function does, used by the model to choose when and how to call the function.
51 #[serde(rename = "description")]
52 pub description: Option<String>,
53 /// 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.
54 #[serde(rename = "name")]
55 pub name: String,
56 /// 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 [function calling guide](docs/guides/function-calling).
57 #[serde(rename = "strict")]
58 #[serde(default = "default_strict")]
59 pub strict: Option<bool>,
60}
61
62fn default_strict() -> Option<bool> {
63 Some(false)
64}