Skip to content

Commit bdbb82c

Browse files
committed
cleanup
1 parent 3c50ad7 commit bdbb82c

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

guardrails/llm_providers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,7 @@ def _invoke_llm(
498498
),
499499
)
500500

501+
# these are gr only and should not be getting passed to llms
501502
kwargs.pop("reask_prompt", None)
502503
kwargs.pop("reask_instructions", None)
503504

@@ -1091,6 +1092,7 @@ async def invoke_llm(
10911092
),
10921093
)
10931094

1095+
# these are gr only and should not be getting passed to llms
10941096
kwargs.pop("reask_prompt", None)
10951097
kwargs.pop("reask_instructions", None)
10961098

guardrails/telemetry/guard_tracing.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
)
1212

1313
from opentelemetry import context, trace
14-
from opentelemetry.trace import StatusCode, Tracer, Span, Link, get_tracer
14+
from opentelemetry.trace import StatusCode, Tracer, Span
1515

1616
from guardrails.settings import settings
1717
from guardrails.classes.generic.stack import Stack
@@ -188,11 +188,11 @@ def trace_guard_execution(
188188
if isinstance(result, Iterator) and not isinstance(
189189
result, ValidationOutcome
190190
):
191-
for res in trace_stream_guard(guard_span, result, history):
192-
yield res
193-
else:
194-
add_guard_attributes(guard_span, history, result)
195-
add_user_attributes(guard_span)
191+
return trace_stream_guard(guard_span, result, history)
192+
193+
# add_guard_attributes(guard_span, history, result)
194+
# add_user_attributes(guard_span)
195+
return result
196196
except Exception as e:
197197
guard_span.set_status(status=StatusCode.ERROR, description=str(e))
198198
raise e
@@ -210,17 +210,17 @@ async def trace_async_stream_guard(
210210
try:
211211
res = await anext(result) # type: ignore
212212
# if not guard_span.is_recording():
213-
# Assuming you have a tracer instance
214-
# tracer = get_tracer(__name__)
215-
# # Create a new span and link it to the previous span
216-
# with tracer.start_as_current_span(
217-
# "new_guard_span", # type: ignore
218-
# links=[Link(guard_span.get_span_context())],
219-
# ) as new_span:
220-
# guard_span = new_span
221-
222-
# add_guard_attributes(guard_span, history, res)
223-
# add_user_attributes(guard_span)
213+
# Assuming you have a tracer instance
214+
# tracer = get_tracer(__name__)
215+
# # Create a new span and link it to the previous span
216+
# with tracer.start_as_current_span(
217+
# "new_guard_span", # type: ignore
218+
# links=[Link(guard_span.get_span_context())],
219+
# ) as new_span:
220+
# guard_span = new_span
221+
222+
# add_guard_attributes(guard_span, history, res)
223+
# add_user_attributes(guard_span)
224224
yield res
225225
except StopIteration:
226226
next_exists = False

0 commit comments

Comments
 (0)