Skip to content

Commit 0c10ff6

Browse files
authored
1 parent bb62508 commit 0c10ff6

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

libs/partners/openai/langchain_openai/chat_models/base.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3540,14 +3540,12 @@ def _convert_responses_chunk_to_generation_chunk(
35403540
{"type": "text", "text": chunk.delta, "index": chunk.content_index}
35413541
)
35423542
elif chunk.type == "response.output_text.annotation.added":
3543-
content.append(
3544-
{
3545-
"annotations": [
3546-
chunk.annotation.model_dump(exclude_none=True, mode="json")
3547-
],
3548-
"index": chunk.content_index,
3549-
}
3550-
)
3543+
if isinstance(chunk.annotation, dict):
3544+
# Appears to be a breaking change in openai==1.82.0
3545+
annotation = chunk.annotation
3546+
else:
3547+
annotation = chunk.annotation.model_dump(exclude_none=True, mode="json")
3548+
content.append({"annotations": [annotation], "index": chunk.content_index})
35513549
elif chunk.type == "response.created":
35523550
response_metadata["id"] = chunk.response.id
35533551
elif chunk.type == "response.completed":

libs/partners/openai/uv.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)