mirror of
https://github.com/mii443/openai-api-rs.git
synced 2025-08-22 23:25:39 +00:00
Merge pull request #60 from OnlyFerris/main
Make fields of Tool public. Rename a field.
This commit is contained in:
@ -263,7 +263,7 @@ where
|
|||||||
Some(ToolChoiceType::Auto) => serializer.serialize_str("auto"),
|
Some(ToolChoiceType::Auto) => serializer.serialize_str("auto"),
|
||||||
Some(ToolChoiceType::ToolChoice { tool }) => {
|
Some(ToolChoiceType::ToolChoice { tool }) => {
|
||||||
let mut map = serializer.serialize_map(Some(2))?;
|
let mut map = serializer.serialize_map(Some(2))?;
|
||||||
map.serialize_entry("type", &tool.tool_type)?;
|
map.serialize_entry("type", &tool.r#type)?;
|
||||||
map.serialize_entry("function", &tool.function)?;
|
map.serialize_entry("function", &tool.function)?;
|
||||||
map.end()
|
map.end()
|
||||||
}
|
}
|
||||||
@ -273,7 +273,12 @@ where
|
|||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct Tool {
|
pub struct Tool {
|
||||||
#[serde(rename = "type")]
|
pub r#type: ToolType,
|
||||||
tool_type: String,
|
pub function: Function,
|
||||||
function: Function,
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||||
|
#[serde(rename_all = "snake_case")]
|
||||||
|
pub enum ToolType {
|
||||||
|
Function,
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user