diff --git a/crates/goose/src/providers/formats/openai_responses.rs b/crates/goose/src/providers/formats/openai_responses.rs index 4ecee17801..c86916b09b 100644 --- a/crates/goose/src/providers/formats/openai_responses.rs +++ b/crates/goose/src/providers/formats/openai_responses.rs @@ -67,7 +67,7 @@ pub enum ResponseContentBlock { #[derive(Debug, Serialize, Deserialize)] pub struct ResponseReasoningInfo { - pub effort: String, + pub effort: Option, #[serde(skip_serializing_if = "Option::is_none")] pub summary: Option, } @@ -871,4 +871,20 @@ mod tests { vec!["assistant", "function_call", "assistant", "function_call"] ); } + + #[test] + fn test_deserialize_reasoning_info_with_null_effort() { + let json = r#"{"effort": null}"#; + let info: ResponseReasoningInfo = serde_json::from_str(json).unwrap(); + assert_eq!(info.effort, None); + assert_eq!(info.summary, None); + } + + #[test] + fn test_deserialize_reasoning_info_with_effort() { + let json = r#"{"effort": "high", "summary": "Thought deeply"}"#; + let info: ResponseReasoningInfo = serde_json::from_str(json).unwrap(); + assert_eq!(info.effort.as_deref(), Some("high")); + assert_eq!(info.summary.as_deref(), Some("Thought deeply")); + } }