Commit e574c12f

Robert Craigie <robert@craigie.dev>
2025-08-08 03:22:50
fix(responses): add output_text back
1 parent e3c0612
Changed files (1)
src
openai
types
responses
src/openai/types/responses/response.py
@@ -259,3 +259,17 @@ class Response(BaseModel):
     [Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
     """
 
+    @property
+    def output_text(self) -> str:
+        """Convenience property that aggregates all `output_text` items from the `output` list.
+
+        If no `output_text` content blocks exist, then an empty string is returned.
+        """
+        texts: List[str] = []
+        for output in self.output:
+            if output.type == "message":
+                for content in output.content:
+                    if content.type == "output_text":
+                        texts.append(content.text)
+
+        return "".join(texts)