Skip to content

Commit 359936f

Browse files
committed
remove unneeded validation after streaming
the validators are called with partial=False as part of validate_response_output in _marked_completed
1 parent 4c5718c commit 359936f

File tree

1 file changed

+0
-9
lines changed

1 file changed

+0
-9
lines changed

pydantic_ai_slim/pydantic_ai/result.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,20 +114,11 @@ async def stream_text(self, *, delta: bool = False, debounce_by: float | None =
114114
async for text in self._stream_response_text(delta=True, debounce_by=debounce_by):
115115
yield text
116116
else:
117-
last_text: str | None = None
118117
async for text in self._stream_response_text(delta=False, debounce_by=debounce_by):
119118
for validator in self._output_validators:
120119
text = await validator.validate(text, self._run_ctx, partial=True) # pragma: no cover
121-
last_text = text
122120
yield text
123121

124-
if last_text is not None:
125-
validated_text = last_text
126-
for validator in self._output_validators:
127-
validated_text = await validator.validate(validated_text, self._run_ctx)
128-
if validated_text != last_text:
129-
yield validated_text
130-
131122
# TODO (v2): Drop in favor of `response` property
132123
def get(self) -> _messages.ModelResponse:
133124
"""Get the current state of the response."""

0 commit comments

Comments
 (0)