Skip to content

Commit 04e2b84

Browse files
committed
fix stream generation
1 parent 30eeb4c commit 04e2b84

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

guardrails/telemetry/guard_tracing.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,11 @@ def trace_guard_execution(
179179
if isinstance(result, Iterator) and not isinstance(
180180
result, ValidationOutcome
181181
):
182-
return trace_stream_guard(guard_span, result, history)
183-
add_guard_attributes(guard_span, history, result)
184-
add_user_attributes(guard_span)
185-
return result
182+
for res in trace_stream_guard(guard_span, result, history):
183+
yield res
184+
else:
185+
add_guard_attributes(guard_span, history, result)
186+
add_user_attributes(guard_span)
186187
except Exception as e:
187188
guard_span.set_status(status=StatusCode.ERROR, description=str(e))
188189
raise e

0 commit comments

Comments
 (0)