From 6be9cee22a7e5fd23bad09fbcdcea7ce4dbdb30a Mon Sep 17 00:00:00 2001 From: Himanshu Neema Date: Wed, 6 May 2026 18:10:18 -0700 Subject: [PATCH] have type field in content field of ReasoningItem --- async-openai/src/types/responses/response.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/async-openai/src/types/responses/response.rs b/async-openai/src/types/responses/response.rs index d347cc2f..473df005 100644 --- a/async-openai/src/types/responses/response.rs +++ b/async-openai/src/types/responses/response.rs @@ -1887,6 +1887,14 @@ pub struct ReasoningTextContent { pub text: String, } +/// [ReasoningTextContent] used elsewhere which adds type, +/// but here in [ReasoningItem] content field we need type too hence an enum: +#[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] +#[serde(tag = "type", rename_all = "snake_case")] +pub enum ReasoningItemContent { + ReasoningText(ReasoningTextContent), +} + /// A reasoning item representing the model's chain of thought, including summary paragraphs. #[derive(Debug, Serialize, Deserialize, Clone, PartialEq)] pub struct ReasoningItem { @@ -1896,7 +1904,7 @@ pub struct ReasoningItem { pub summary: Vec, /// Reasoning text content. #[serde(skip_serializing_if = "Option::is_none")] - pub content: Option>, + pub content: Option>, /// The encrypted content of the reasoning item - populated when a response is generated with /// `reasoning.encrypted_content` in the `include` parameter. #[serde(skip_serializing_if = "Option::is_none")]