Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit78f08f8

Browse files
authored
Handle DeepSeek reasoning_content in streamed responses (#2174)
1 parent6d0e850 commit78f08f8

File tree

3 files changed

+307
-1
lines changed

3 files changed

+307
-1
lines changed

‎pydantic_ai_slim/pydantic_ai/models/openai.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,12 @@ async def _get_event_iterator(self) -> AsyncIterator[ModelResponseStreamEvent]:
994994
ifcontentisnotNone:
995995
yieldself._parts_manager.handle_text_delta(vendor_part_id='content',content=content)
996996

997+
# Handle reasoning part of the response, present in DeepSeek models
998+
ifreasoning_content:=getattr(choice.delta,'reasoning_content',None):
999+
yieldself._parts_manager.handle_thinking_delta(
1000+
vendor_part_id='reasoning_content',content=reasoning_content
1001+
)
1002+
9971003
fordtcinchoice.delta.tool_callsor []:
9981004
maybe_event=self._parts_manager.handle_tool_call_delta(
9991005
vendor_part_id=dtc.index,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp