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 8, 2025
1 parent 495bd69 commit 83df70d
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 {

Check warning on line 558 in rig-core/src/providers/openai.rs

View workflow job for this annotation

GitHub Actions / stable / fmt

Diff in /home/runner/work/rig/rig/rig-core/src/providers/openai.rs
ToolResultContent { text: s }
ToolResultContent {
r#type: ToolResultContentType::default(),
text: s
}
}
}

Expand Down

0 comments on commit 83df70d

Please sign in to comment.