Skip to content

Commit 27bb66a

Browse files
author
Andrei Bratu
committed
silence warnings for demo
1 parent 0fe1c91 commit 27bb66a

File tree

4 files changed

+16
-6
lines changed

4 files changed

+16
-6
lines changed

src/humanloop/eval_utils/run.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
from functools import partial
2424
from logging import INFO
2525
from typing import Callable, Dict, List, Literal, Optional, Sequence, Tuple, TypeVar, Union
26+
import warnings
2627

2728
from humanloop import EvaluatorResponse, FlowResponse, PromptResponse, ToolResponse
2829
from humanloop.core.api_error import ApiError
@@ -121,13 +122,23 @@ def _overload_call(self, **kwargs) -> PromptCallResponse:
121122
# TODO: Bug found in backend: not specifying a model 400s but creates a File
122123
raise HumanloopUtilityError(message=str(e)) from e
123124

125+
response_copy = response.dict()
124126
prompt_utility_context = get_prompt_utility_context()
127+
for idx, _ in enumerate(response_copy.get("logs", [])):
128+
del response_copy["logs"][idx]["created_at"]
129+
for idx, _ in enumerate(response_copy["prompt"].get("environment", [])):
130+
del response_copy["prompt"]["environment"][idx]["created_at"]
131+
del response_copy["prompt"]["last_used_at"]
132+
del response_copy["prompt"]["updated_at"]
133+
del response_copy["prompt"]["created_at"]
134+
del response_copy["start_time"]
135+
del response_copy["end_time"]
125136

126137
with prompt_utility_context.tracer.start_as_current_span(HUMANLOOP_INTERCEPTED_HL_CALL_SPAN_NAME) as span:
127138
write_to_opentelemetry_span(
128139
span=span,
129140
key=HUMANLOOP_INTERCEPTED_HL_CALL_RESPONSE,
130-
value=response.dict(),
141+
value=response_copy,
131142
)
132143
return response
133144
else:

src/humanloop/otel/exporter.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ def _mark_trace_complete_if_needed(self, trace_head_span_id: int):
375375

376376
def _keep_track_of_trace(self, log_id: str, parent_log_id: str):
377377
for trace in self._traces:
378+
found = False
378379
if parent_log_id in trace:
379380
trace.add(log_id)
380381
found = True

tests/integration/evaluate_medqa/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def ask_question(**inputs) -> str:
173173
return call_model(**inputs)
174174

175175
with open(medqa_dataset_path, "r") as file:
176-
datapoints = [json.loads(line) for line in file.readlines()][:20]
176+
datapoints = [json.loads(line) for line in file.readlines()]
177177

178178
for path, code, return_type in [
179179
(get_test_path("Levenshtein Distance"), levenshtein, "number"),

tests/integration/evaluate_medqa/test_evaluate_medqa.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from humanloop import Humanloop
99

1010

11-
@pytest.mark.skip("skip for demo")
12-
@pytest.mark.parametrize("use_call", [False])
11+
# @pytest.mark.skip("skip for demo")
12+
@pytest.mark.parametrize("use_call", [True])
1313
def test_scenario(
1414
evaluate_medqa_scenario_factory: Callable[[bool], MedQAScenario],
1515
humanloop_client: Humanloop,
@@ -22,8 +22,6 @@ def test_scenario(
2222
levenshtein_path = evaluate_medqa_scenario.levenshtein_path
2323
exact_match_path = evaluate_medqa_scenario.exact_match_path
2424

25-
assert len(medqa_dataset) == 20
26-
2725
humanloop_client.evaluations.run( # type: ignore [attr-defined]
2826
name="Test",
2927
file={

0 commit comments

Comments
 (0)