Skip to content

Commit

Permalink
fix(openai): missing type field in ToolResultContent
Browse files Browse the repository at this point in the history
  • Loading branch information
s6nqou committed Feb 23, 2025
1 parent 1eff23e commit 03b573e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion rig-core/src/providers/openai.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,18 @@ pub struct InputAudio {

#[derive(Debug, Serialize, Deserialize, PartialEq, Clone)]
pub struct ToolResultContent {
#[serde(default)]
r#type: ToolResultContentType,
text: String,
}

#[derive(Default, Debug, Serialize, Deserialize, PartialEq, Clone)]
#[serde(rename_all = "lowercase")]
pub enum ToolResultContentType {
#[default]
Text,
}

impl FromStr for ToolResultContent {
type Err = Infallible;

Expand All @@ -547,7 +556,10 @@ impl FromStr for ToolResultContent {

impl From<String> for ToolResultContent {
fn from(s: String) -> Self {
ToolResultContent { text: s }
ToolResultContent {
r#type: ToolResultContentType::default(),
text: s
}
}
}

Expand Down

0 comments on commit 03b573e

Please sign in to comment.