Skip to content

Commit

Permalink
pydantic upgrade bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jstzwj committed Jul 11, 2024
1 parent cb5ea24 commit 98fdc46
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions langport/routers/gateway/openai_compatible.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,10 +295,10 @@ async def chat_completion_stream_generator(
if content.finish_reason is not None:
finish_stream_events.append(chunk)
continue
yield f"data: {chunk.json(exclude_unset=True, ensure_ascii=False)}\n\n"
yield f"data: {json.dumps(chunk.model_dump(exclude_unset=True), ensure_ascii=False)}\n\n"
# There is not "content" field in the last delta message, so exclude_none to exclude field "content".
for finish_chunk in finish_stream_events:
yield f"data: {finish_chunk.json(exclude_none=True, ensure_ascii=False)}\n\n"
yield f"data: {json.dumps(finish_chunk.model_dump(exclude_none=True), ensure_ascii=False)}\n\n"
yield "data: [DONE]\n\n"


Expand Down

0 comments on commit 98fdc46

Please sign in to comment.