diff --git a/crates/goose/src/providers/formats/openai.rs b/crates/goose/src/providers/formats/openai.rs index db733fc4dfc3..c696cb8e34d2 100644 --- a/crates/goose/src/providers/formats/openai.rs +++ b/crates/goose/src/providers/formats/openai.rs @@ -58,7 +58,8 @@ enum DeltaContent { #[derive(Serialize, Deserialize, Debug)] struct ContentPart { r#type: String, - text: String, + #[serde(default)] + text: Option, #[serde(rename = "thoughtSignature")] thought_signature: Option, } @@ -100,7 +101,7 @@ fn extract_content_and_signature( let text = text_parts .iter() - .map(|p| p.text.as_str()) + .filter_map(|p| p.text.as_deref()) .collect::(); let signature = text_parts