Skip to content

Commit 0838109

Browse files
committed
test more cases without vendor id
1 parent 28578bf commit 0838109

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

pydantic_ai_slim/pydantic_ai/_parts_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ def _handle_text_delta_with_thinking_tags( # noqa: C901
377377
if segments and segments[0][0] == 'text':
378378
text_content = segments[0][1]
379379

380-
if text_content: # praga: no cover - line was always true
380+
if text_content: # pragma: no cover - line was always true
381381
combined_content = buffered + content
382382
self._thinking_tag_buffer.pop(vendor_part_id, None)
383383
yield from self._emit_text_part(

tests/test_parts_manager_split_tags.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ class Case:
6969
expected_parts=[TextPart('<think>')],
7070
vendor_part_id=None,
7171
),
72+
Case(
73+
name='unclosed_opening_tag_with_content_no_vendor_id',
74+
chunks=['<think>', 'content'],
75+
expected_parts=[ThinkingPart('content')],
76+
vendor_part_id=None,
77+
),
78+
Case(
79+
name='partial_closing_tag_no_vendor_id',
80+
chunks=['<think>', 'content', '</thi'],
81+
expected_parts=[ThinkingPart('content</thi')],
82+
vendor_part_id=None,
83+
),
7284
# --- Split thinking tags -> ThinkingPart ---
7385
Case(
7486
name='open_with_content_then_close',
@@ -80,6 +92,12 @@ class Case:
8092
chunks=['<think>', 'content</think>'],
8193
expected_parts=[ThinkingPart('content')],
8294
),
95+
Case(
96+
name='open_then_content_and_close_no_vendor_id',
97+
chunks=['<think>', 'content</think>'],
98+
expected_parts=[ThinkingPart('content')],
99+
vendor_part_id=None,
100+
),
83101
Case(
84102
name='fully_split_open_and_close',
85103
chunks=['<th', 'ink>content</th', 'ink>'],

0 commit comments

Comments
 (0)