File tree Expand file tree Collapse file tree 3 files changed +178
-111
lines changed
pydantic_ai_slim/pydantic_ai Expand file tree Collapse file tree 3 files changed +178
-111
lines changed Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ def handle_text_delta( # noqa: C901
160160 - Partial Opening and Closing tags without adjacent content won't emit an event.
161161 - EC2: No event is emitted for opening tags until they are fully formed and there is content following them.
162162 - This is called 'delayed thinking'
163- - No event is emitted for closing tags that complete a ThinkingPart without any preceding content.
163+ - No event is emitted for closing tags that complete a ThinkingPart without any adjacent content.
164164
165165 Args:
166166 vendor_part_id: The ID the vendor uses to identify this piece
@@ -257,6 +257,7 @@ def handle_as_text_part() -> list[PartDeltaEvent | PartStartEvent]:
257257 if potential_part .found_by == 'vendor_part_id' :
258258 # if there's an existing thinking part found by vendor_part_id, handle it directly
259259 combined_buffer = potential_part .part .closing_tag_buffer + content
260+ potential_part .part .closing_tag_buffer = ''
260261
261262 closing_events = list (
262263 self ._handle_text_with_thinking_closing (
Original file line number Diff line number Diff line change @@ -619,9 +619,7 @@ async def chain_async_and_sync_iters(
619619 ) -> AsyncIterator [ModelResponseStreamEvent ]:
620620 async for event in iter1 :
621621 yield event
622- for (
623- event
624- ) in iter2 : # pragma: no cover - loop never started - final_flush() seems to be being called before
622+ for event in iter2 :
625623 yield event
626624
627625 async for event in chain_async_and_sync_iters (iterator , self ._parts_manager .final_flush ()):
You can’t perform that action at this time.
0 commit comments