Merge pull request #56 from hytracen/main

Impl Default trait for JSONSchemaDefine
This commit is contained in:
Dongri Jin
2023-12-30 08:01:07 +08:00
committed by GitHub
3 changed files with 15 additions and 8 deletions

View File

@ -23,10 +23,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Box::new(chat_completion::JSONSchemaDefine {
schema_type: Some(chat_completion::JSONSchemaType::String),
description: Some("The cryptocurrency to get the price of".to_string()),
enum_values: None,
properties: None,
required: None,
items: None,
..Default::default()
}),
);

View File

@ -23,10 +23,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Box::new(chat_completion::JSONSchemaDefine {
schema_type: Some(chat_completion::JSONSchemaType::String),
description: Some("The cryptocurrency to get the price of".to_string()),
enum_values: None,
properties: None,
required: None,
items: None,
..Default::default()
}),
);

View File

@ -197,6 +197,19 @@ pub struct JSONSchemaDefine {
pub items: Option<Box<JSONSchemaDefine>>,
}
impl Default for JSONSchemaDefine {
fn default() -> Self {
Self {
schema_type: None,
description: None,
enum_values: None,
properties: None,
required: None,
items: None,
}
}
}
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct FunctionParameters {
#[serde(rename = "type")]