mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
fix(openai): handle null reasoning effort in Responses API (#7469)
Signed-off-by: rabi <ramishra@redhat.com>
This commit is contained in:
@@ -67,7 +67,7 @@ pub enum ResponseContentBlock {
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct ResponseReasoningInfo {
|
||||
pub effort: String,
|
||||
pub effort: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub summary: Option<String>,
|
||||
}
|
||||
@@ -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"));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user