Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
chore(streaming): silence pydantic model_dump warnings (#1722)
  • Loading branch information
kristapratico authored Sep 18, 2024
commit 30f84b96081ac37f60e40a75d765dbbf563b61b3
10 changes: 5 additions & 5 deletions src/openai/lib/streaming/_assistants.py
Original file line number Diff line number Diff line change
Expand Up @@ -906,11 +906,11 @@ def accumulate_run_step(
merged = accumulate_delta(
cast(
"dict[object, object]",
snapshot.model_dump(exclude_unset=True),
snapshot.model_dump(exclude_unset=True, warnings=False),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if PYDANTIC_V2 then only send warnings as False

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did this break on pydantic v1 for you?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah yeah it did, not sure how our tests didn't catch that, will push a fix

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will be fixed in the next release #1735

),
cast(
"dict[object, object]",
data.delta.model_dump(exclude_unset=True),
data.delta.model_dump(exclude_unset=True, warnings=False),
),
)
run_step_snapshots[snapshot.id] = cast(RunStep, construct_type(type_=RunStep, value=merged))
Expand Down Expand Up @@ -948,7 +948,7 @@ def accumulate_event(
construct_type(
# mypy doesn't allow Content for some reason
type_=cast(Any, MessageContent),
value=content_delta.model_dump(exclude_unset=True),
value=content_delta.model_dump(exclude_unset=True, warnings=False),
),
),
)
Expand All @@ -957,11 +957,11 @@ def accumulate_event(
merged = accumulate_delta(
cast(
"dict[object, object]",
block.model_dump(exclude_unset=True),
block.model_dump(exclude_unset=True, warnings=False),
),
cast(
"dict[object, object]",
content_delta.model_dump(exclude_unset=True),
content_delta.model_dump(exclude_unset=True, warnings=False),
),
)
current_message_snapshot.content[content_delta.index] = cast(
Expand Down