We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64ea34f commit 585a4f1Copy full SHA for 585a4f1
src/openai/types/responses/response.py
@@ -259,3 +259,17 @@ class Response(BaseModel):
259
[Learn more](https://platform.openai.com/docs/guides/safety-best-practices#safety-identifiers).
260
"""
261
262
+ @property
263
+ def output_text(self) -> str:
264
+ """Convenience property that aggregates all `output_text` items from the `output` list.
265
+
266
+ If no `output_text` content blocks exist, then an empty string is returned.
267
+ """
268
+ texts: List[str] = []
269
+ for output in self.output:
270
+ if output.type == "message":
271
+ for content in output.content:
272
+ if content.type == "output_text":
273
+ texts.append(content.text)
274
275
+ return "".join(texts)
0 commit comments