QA Agent
The QA agent validates the output of the Processing agent, checking coverage thresholds and chunk quality.
Tools
| Tool | API | Description |
|---|---|---|
check_coverage | compute_coverage() | Compute end-to-end word coverage |
check_chunks | (pure inspection) | Inspect chunk quality metrics |
Output: QADecision
class QADecision(BaseModel):
verified: bool
structuring_coverage: float
chunking_coverage: float
end_to_end_coverage: float
empty_chunk_count: int
chunks_missing_topics: int
recommendations: list[QARecommendation]
reasoning: str
class QARecommendation(BaseModel):
issue: str
action: str
parameter: str
suggested_value: strHow It Works
- Calls
check_coverageto compute word-level coverage between the source text and chunks - Calls
check_chunksto inspect chunk quality:- Empty chunks (less than 10 characters)
- Chunks missing topic labels
- Chunks missing key_concepts
- If quality is acceptable, sets
verified=True - If issues found, returns
QARecommendationobjects suggesting parameter adjustments
Example Recommendation
{
"issue": "3 empty chunks detected",
"action": "set",
"parameter": "min_tokens",
"suggested_value": "50"
}Or for larger quality issues:
{
"issue": "Low structuring coverage (0.82)",
"action": "change",
"parameter": "preset",
"suggested_value": "legal"
}Note: check_chunks does not call any distillcore API — it performs pure Python inspection of the chunk data.