fix(evaluation): isolate EvalCases per trace in tracing JSON import (#1021) - #1072
Open
klioen wants to merge 1 commit into
Open
fix(evaluation): isolate EvalCases per trace in tracing JSON import (#1021)#1072klioen wants to merge 1 commit into
klioen wants to merge 1 commit into
Conversation
When building an EvalSet from a tracing JSON file containing multiple traces, the previous code accumulated all spans into a single conversation and a single EvalCase, mixing tool uses, session metadata (app_name/user_id) and user/model turns across independent sessions. Fix _build_eval_set_from_tracing_json to: - group spans by trace_id and sort each trace's spans by start_time so the first/last call_llm spans map to that trace's input/output - emit one isolated EvalCase per trace - derive the EvalSet creation timestamp from the earliest case Adds a regression test with two traces (one with out-of-order spans) verifying cases, metadata, tools and conversations stay isolated. Fixes volcengine#1021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1021: when
BaseEvaluator.build_eval_set()imports a tracing JSON file containing multiple traces, the previous code accumulated all spans into a single conversation and a single EvalCase — mixing tool uses, session metadata (app_name/user_id) and user/model turns across independent sessions.Changes
In
veadk/evaluation/base_evaluator.py(_build_eval_set_from_tracing_json):eval_cases,conversation,app_name/user_idandcreation_timestampare now reset for eachtrace_idgroup instead of being shared across the whole file.start_timewithin a trace — the first/lastcall_llmspans now reliably map to that trace's user input and final output, even when spans are not ordered in the JSON file.Test
Added
test_tracing_file_multiple_traces_to_evalsetcovering:Fixes #1021