Skip to content

feat: Phase 12 — Synthetic Test Data Generator#29

Merged
himanshu231204 merged 1 commit into
mainfrom
feature/synthetic-test-data
Jul 11, 2026
Merged

feat: Phase 12 — Synthetic Test Data Generator#29
himanshu231204 merged 1 commit into
mainfrom
feature/synthetic-test-data

Conversation

@himanshu231204

Copy link
Copy Markdown
Contributor

Summary

Add openagent_eval/synthesis/ module for generating synthetic Q&A test cases from documents. This enables developers to bootstrap evaluation datasets from their knowledge base without manual test case creation.

What's Included

New Module: openagent_eval/synthesis/

  • models.py — TestCaseType enum (6 types), TestCase (frozen dataclass), SyntheticDataset
  • question_gen.py — QuestionGenerator class generating Q&A pairs from document chunks via LLM
  • �dversarial.py — AdversarialTestCaseGenerator for 5 adversarial types (unanswerable, ambiguous, misleading, multi-hop, counterfactual)
  • generator.py — SyntheticDataGenerator orchestrator with concurrent LLM calls via asyncio semaphore
  • init.py — Public API exports

CLI Command

  • oaeval synth — Generate synthetic test data from a document corpus or text file
    • Rich terminal output with progress tracking
    • File save in JSON, JSONL, or HuggingFace formats

Exceptions

  • SynthesisError, SynthesisExecutionError added to openagent_eval/exceptions/synthesis.py

Tests

  • 56 tests across 5 files (49 unit + 7 integration)
  • All existing tests continue to pass (80+ total)

Usage

`�ash

Generate from a text file

oaeval synth --input corpus.txt --num-questions 20 --output dataset.json

Generate with adversarial cases

oaeval synth --input corpus.txt --adversarial --adversarial-types unanswerable,misleading

Generate from a directory of documents

oaeval synth --input ./docs/ --num-questions 50 --format jsonl
`

Architecture

Follows existing patterns from diagnosis/ module:

  • Dependency injection via LLMProvider interface
  • No new external dependencies
  • Python 3.11+ with type hints
  • Functions under 50 lines, pure functions where possible

Checklist

  • All synthesis module files created
  • oaeval synth CLI command registered
  • Unit tests pass (49 tests)
  • Integration test passes (7 tests)
  • All existing tests still pass
  • Code follows project coding standards
  • .ai/ project files updated

Combined list of all adversarial test case types.
"""
all_cases: list[TestCase] = []
for test_type in TestCaseType:
async def test_generate_all_types(self) -> None:
"""Test generating all adversarial types."""
responses = {}
for test_type in TestCaseType:

from openagent_eval.exceptions.synthesis import SynthesisExecutionError
from openagent_eval.synthesis.generator import SyntheticDataGenerator, _chunk_text, _read_corpus
from openagent_eval.synthesis.models import TestCase, TestCaseType
TestCase,
TestCaseType,
)
from openagent_eval.synthesis.generator import _chunk_text
Add synthesis module for generating synthetic Q&A test cases from documents:

- QuestionGenerator: LLM-based question generation from text chunks
- AdversarialTestCaseGenerator: 5 adversarial types (unanswerable, ambiguous, misleading, multi-hop, counterfactual)
- SyntheticDataGenerator: orchestrator with concurrent LLM calls
- oaeval synth CLI command with Rich output and file save (json/jsonl/huggingface)
- 56 unit and integration tests
@himanshu231204 himanshu231204 force-pushed the feature/synthetic-test-data branch from e87e2ec to 1f54200 Compare July 11, 2026 11:52
@himanshu231204 himanshu231204 merged commit 2c627f9 into main Jul 11, 2026
10 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.

1 participant