Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

Resolve Pydantic deprecation warnings #1403

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/codegate/types/anthropic/_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def stream_generator(stream: AsyncIterator[Any]) -> AsyncIterator[str]:
try:
async for chunk in stream:
try:
body = chunk.json(exclude_unset=True)
body = chunk.model_dump_json(exclude_unset=True)
except Exception as e:
logger.error("failed serializing payload", exc_info=e)
err = MessageError(
Expand All @@ -38,7 +38,7 @@ async def stream_generator(stream: AsyncIterator[Any]) -> AsyncIterator[str]:
message=str(e),
),
)
body = err.json(exclude_unset=True)
body = err.model_dump_json(exclude_unset=True)
yield f"event: error\ndata: {body}\n\n"

data = f"event: {chunk.type}\ndata: {body}\n\n"
Expand All @@ -56,7 +56,7 @@ async def stream_generator(stream: AsyncIterator[Any]) -> AsyncIterator[str]:
message=str(e),
),
)
body = err.json(exclude_unset=True)
body = err.model_dump_json(exclude_unset=True)
yield f"event: error\ndata: {body}\n\n"


Expand Down
Loading