Skip to content

Commit

Permalink
refactor: Make use of already calculated traces from lineages in benc…
Browse files Browse the repository at this point in the history
…hmark execution function
  • Loading branch information
MerlinKallenbornAA committed Dec 18, 2024
1 parent 3433f44 commit 29bbcfe
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/intelligence_layer/evaluation/benchmark/studio_benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def average_or_zero(list: list) -> float:

benchmark_lineages = self._create_benchmark_lineages(
eval_lineages=evaluation_lineages,
trace_ids=trace_ids,
traces=run_traces,
)

self.client.submit_benchmark_lineages(
Expand Down Expand Up @@ -229,21 +229,20 @@ def _create_benchmark_lineages(
eval_lineages: list[
EvaluationLineage[Input, ExpectedOutput, Output, Evaluation]
],
trace_ids: list[str],
traces: list[Sequence[ExportedSpan]],
) -> Sequence[BenchmarkLineage[Input, Output, ExpectedOutput, Evaluation]]:
return [
self._create_benchmark_lineage(eval_lineage, trace_id)
for eval_lineage, trace_id in zip(eval_lineages, trace_ids, strict=True)
self._create_benchmark_lineage(eval_lineage, trace)
for eval_lineage, trace in zip(eval_lineages, traces, strict=True)
]

def _create_benchmark_lineage(
self,
eval_lineage: EvaluationLineage[Input, ExpectedOutput, Output, Evaluation],
trace_id: str,
trace: Sequence[ExportedSpan],
) -> BenchmarkLineage:
trace = self._trace_from_lineage(eval_lineage)
return BenchmarkLineage(
trace_id=trace_id,
trace_id=str(trace[0].context.trace_id),
input=eval_lineage.example.input,
expected_output=eval_lineage.example.expected_output,
example_metadata=eval_lineage.example.metadata,
Expand Down

0 comments on commit 29bbcfe

Please sign in to comment.