Skip to content

Commit

Permalink
Make fields of Tool public. Rename a field.
Browse files Browse the repository at this point in the history
  • Loading branch information
OnlyFerris committed Jan 4, 2024
1 parent baae003 commit b666bc0
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 b666bc0

Please sign in to comment.