mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-23 15:48:07 +00:00
Impl Default trait for JSONSchemaDefine
In most cases, only a few properties of JSONSchemaDefine are used, and it seems cumbersome to explicitly declare other properties.
This commit is contained in:
@ -23,10 +23,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
Box::new(chat_completion::JSONSchemaDefine {
|
Box::new(chat_completion::JSONSchemaDefine {
|
||||||
schema_type: Some(chat_completion::JSONSchemaType::String),
|
schema_type: Some(chat_completion::JSONSchemaType::String),
|
||||||
description: Some("The cryptocurrency to get the price of".to_string()),
|
description: Some("The cryptocurrency to get the price of".to_string()),
|
||||||
enum_values: None,
|
..Default::default()
|
||||||
properties: None,
|
|
||||||
required: None,
|
|
||||||
items: None,
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -23,10 +23,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
Box::new(chat_completion::JSONSchemaDefine {
|
Box::new(chat_completion::JSONSchemaDefine {
|
||||||
schema_type: Some(chat_completion::JSONSchemaType::String),
|
schema_type: Some(chat_completion::JSONSchemaType::String),
|
||||||
description: Some("The cryptocurrency to get the price of".to_string()),
|
description: Some("The cryptocurrency to get the price of".to_string()),
|
||||||
enum_values: None,
|
..Default::default()
|
||||||
properties: None,
|
|
||||||
required: None,
|
|
||||||
items: None,
|
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -197,6 +197,19 @@ pub struct JSONSchemaDefine {
|
|||||||
pub items: Option<Box<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)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct FunctionParameters {
|
pub struct FunctionParameters {
|
||||||
#[serde(rename = "type")]
|
#[serde(rename = "type")]
|
||||||
|
Reference in New Issue
Block a user