feat(conversation): add conversation package, per-turn metrics, and runner#2
Open
sunilgattupalle wants to merge 11 commits intomainfrom
Open
feat(conversation): add conversation package, per-turn metrics, and runner#2sunilgattupalle wants to merge 11 commits intomainfrom
sunilgattupalle wants to merge 11 commits intomainfrom
Conversation
Add latency_ms, token_count, and cost_usd optional fields to the Message dataclass with None-omitting to_dict serialization and backward-compatible from_dict deserialization. Five new tests verify default values, setting, serialization, roundtrip, and backward compatibility. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> AI-Session-Id: 4fda9174-9877-429d-9b01-af7a3dad6d46 AI-Tool: claude-code AI-Model: unknown
…turn operational scoring Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> AI-Session-Id: 4fda9174-9877-429d-9b01-af7a3dad6d46 AI-Tool: claude-code AI-Model: unknown
…test coverage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> AI-Session-Id: 4fda9174-9877-429d-9b01-af7a3dad6d46 AI-Tool: claude-code AI-Model: unknown
…onSynthesizer Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> AI-Session-Id: 4fda9174-9877-429d-9b01-af7a3dad6d46 AI-Tool: claude-code AI-Model: unknown
AI-Session-Id: 4fda9174-9877-429d-9b01-af7a3dad6d46 AI-Tool: claude-code AI-Model: unknown
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> AI-Session-Id: 4fda9174-9877-429d-9b01-af7a3dad6d46 AI-Tool: claude-code AI-Model: unknown
…ith simulator_llm Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> AI-Session-Id: 4fda9174-9877-429d-9b01-af7a3dad6d46 AI-Tool: claude-code AI-Model: unknown
AI-Session-Id: 4fda9174-9877-429d-9b01-af7a3dad6d46 AI-Tool: claude-code AI-Model: unknown
|
|
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
Closes the remaining multi-turn evaluation gaps identified against DeepEval's feature set.
Changes
Messageoperational fields (src/harness_evals/core/types.py)latency_ms: float,token_count: int,cost_usd: floatfields to carry per-turn observability data through the message historyNone,to_dict()/from_dict()handle missing keysTurnLatencyMetric/TurnTokenCostMetric(src/harness_evals/metrics/operational/)Message.latency_ms/Message.token_counton assistant turnsmax(0, 1 - value / budget)per turn, mean-aggregated; negative values skippedturn_latencies/turn_token_counts,mean_latency_ms/mean_token_count,n_turns_scoredConversationSynthesizer/ScriptedConversationSynthesizer(src/harness_evals/synthesizer/conversation.py)ConversationGoldendatasets from source documentsConversationSynthesizer(task_type="conversation") — produces scenario + expected_outcome + user_persona (no turns), intended for use withConversationSimulatorScriptedConversationSynthesizer(task_type="conversation_scripted") — produces fully scriptedturns: list[Message]for direct replaySynthesizerfacade; deduplication by scenario nameUnified
evaluate_dataset()(src/harness_evals/core/runner.py)list[Golden] | list[ConversationGolden]with a newsimulator_llmkwargConversationGoldeninputs route throughConversationSimulator.simulate_batch(); pre-scripted turns bypass simulation (replay mode)TypeError; missingsimulator_llmfor conversation inputs raisesValueErrorConversationalGEvalMetric(src/harness_evals/metrics/conversation/conversational_geval.py)MultiTurnView.FULL_CONVERSATION(all messages) andMultiTurnView.SLIDING_WINDOW(last N turns)metadata["turn_scores"]Per-turn scoring backfill (
coherence.py,turn_relevancy.py,knowledge_retention.py)_per_turn=TrueonLLMConversationMetric— these metrics now also storemetadata["turn_scores"]alongside the aggregate scoreTest plan
ruff check+ruff format --checkclean across all 220 filesConversationSynthesizer,ScriptedConversationSynthesizer,TurnLatencyMetric,TurnTokenCostMetric,ConversationalGEvalMetric,evaluate_dataset(simulator_llm=...)🤖 Generated with Claude Code