11from typing import Any , Dict , Iterator , List , Optional , Tuple , Union , cast
22
3-
43from guardrails import validator_service
54from guardrails .classes .history import Call , Inputs , Iteration , Outputs
65from guardrails .classes .output_type import OT , OutputTypes
7- from guardrails .classes .validation .validation_summary import ValidationSummary
86from guardrails .classes .validation_outcome import ValidationOutcome
97from guardrails .llm_providers import (
108 LiteLLMCallable ,
@@ -181,7 +179,8 @@ def prepare_chunk_generator(stream) -> Iterator[Tuple[Any, bool]]:
181179 "$" ,
182180 validate_subschema = True ,
183181 )
184- for chunk_index , res in enumerate (gen ):
182+
183+ for res in gen :
185184 chunk = res .chunk
186185 original_text = res .original_text
187186 if isinstance (chunk , SkeletonReAsk ):
@@ -200,20 +199,12 @@ def prepare_chunk_generator(stream) -> Iterator[Tuple[Any, bool]]:
200199 # 5. Convert validated fragment to a pretty JSON string
201200 validation_response += cast (str , chunk )
202201 passed = call_log .status == pass_status
203-
204- validator_logs = call_log .iterations .last .validator_logs
205-
206- validation_summaries = ValidationSummary .from_validator_logs_only_fails (
207- validator_logs
208- )
209-
210202 yield ValidationOutcome (
211203 call_id = call_log .id , # type: ignore
212204 # The chunk or the whole output?
213205 raw_llm_output = original_text ,
214206 validated_output = chunk ,
215207 validation_passed = passed ,
216- validation_summaries = validation_summaries ,
217208 )
218209
219210 # handle non string schema
@@ -258,17 +249,11 @@ def prepare_chunk_generator(stream) -> Iterator[Tuple[Any, bool]]:
258249 else :
259250 validation_response = cast (dict , validated_fragment )
260251 # 5. Convert validated fragment to a pretty JSON string
261-
262- validator_logs = iteration .validator_logs
263- validation_summaries = ValidationSummary .from_validator_logs_only_fails (
264- validator_logs
265- )
266252 yield ValidationOutcome (
267253 call_id = call_log .id , # type: ignore
268254 raw_llm_output = fragment ,
269255 validated_output = validated_fragment ,
270256 validation_passed = validated_fragment is not None ,
271- validation_summaries = validation_summaries ,
272257 )
273258
274259 # # Finally, add to logs
0 commit comments