Skip to content

Commit

Permalink
Merge pull request #60 from OnlyFerris/main
Browse files Browse the repository at this point in the history
Make fields of Tool public. Rename a field.
  • Loading branch information
Dongri Jin authored Jan 6, 2024
2 parents baae003 + b666bc0 commit f0973ea
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/v1/chat_completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ where
Some(ToolChoiceType::Auto) => serializer.serialize_str("auto"),
Some(ToolChoiceType::ToolChoice { tool }) => {
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.end()
}
Expand All @@ -273,7 +273,12 @@ where

#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct Tool {
#[serde(rename = "type")]
tool_type: String,
function: Function,
pub r#type: ToolType,
pub function: Function,
}

#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
#[serde(rename_all = "snake_case")]
pub enum ToolType {
Function,
}

0 comments on commit f0973ea

Please sign in to comment.