Skip to content

fix: raise descriptive ValueError on malformed turns instead of bare KeyError - #26

Merged
royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
sharadvc:fix/from-dict-malformed
Sep 17, 2026
Merged

royalpinto007 merged 1 commit into
AgentPostmortem:mainfrom
sharadvc:fix/from-dict-malformed

Conversation

@sharadvc

Copy link
Copy Markdown
Contributor

What

Closes #14. One bad turn killed the whole suite load with a bare ValueError (e.g. start_s: "soon") or bare KeyError (missing field). Now from_dict raises a single descriptive ValueError naming the turn index and field, and validates speaker/text types.

Changes

  • voiceeval/turns.py: from_dict validates the top-level turns list, then each turn field via a shared turn_field helper — missing keys, non-numeric start_s/end_s, and invalid speaker/text all raise a descriptive ValueError.
  • tests/test_from_dict_malformed.py: test-first (RED → GREEN), 10 cases covering missing/malformed fields and turn indexing.

Checklist

Authored with AI assistance; verified locally.

@royalpinto007
royalpinto007 merged commit 465e491 into AgentPostmortem:main Sep 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

from_dict throws raw KeyError/ValueError on malformed turns

2 participants