Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ class TurnResult(BaseModel):
def skill_success(self) -> bool:
return self.skill_routing and self.output_present and self.no_error

def detail(self) -> dict:
"""The subset of this result reported in detail["turns"] for one conversation turn."""
return {
"turn_id": self.turn_id,
"expected_skill": self.expected_skill,
"skill_routing": self.skill_routing,
"output_present": self.output_present,
"output_correct": self.output_correct,
"activated_skills": list(self.activated_skills),
}
Comment thread
coderabbitai[bot] marked this conversation as resolved.


def _resolve_refs(
expected_output: dict | None,
Expand Down Expand Up @@ -430,17 +441,7 @@ def _conversation_detail(result: ConversationResult) -> dict:
return {
"full_skill_coverage": result.full_skill_coverage,
"total_clarification_turns": result.total_clarification_turns,
"turns": [
{
"turn_id": tr.turn_id,
"expected_skill": tr.expected_skill,
"skill_routing": tr.skill_routing,
"output_present": tr.output_present,
"output_correct": tr.output_correct,
"activated_skills": tr.activated_skills,
}
for tr in result.turn_results
],
"turns": [tr.detail() for tr in result.turn_results],
"latency_breakdown": build_latency_breakdown(result.tool_call_events, result.reasoning_step_events),
}

Expand Down
19 changes: 19 additions & 0 deletions packages/gooddata-eval/tests/test_agentic_conversation.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,25 @@ def test_turn_result_skill_success():
assert r.skill_success is True


def test_turn_result_detail_returns_independent_activated_skills_list():
"""Regression: detail()'s activated_skills must be a copy -- a caller mutating the
returned dict must not be able to mutate the TurnResult it came from.
"""
r = TurnResult(
turn_id="t1",
expected_skill="visualization",
skill_routing=True,
output_present=True,
no_error=True,
activated_skills=["visualization"],
clarification_turns_used=0,
output_correct=None,
)
d = r.detail()
d["activated_skills"].append("mutated")
assert r.activated_skills == ["visualization"]


def test_resolve_refs_no_refs():
assert _resolve_refs({"key": "value"}, {}) == {"key": "value"}

Expand Down
Loading