fabricatio_rag.capabilities.enrich
LLM-driven text enrichment: generate question-answer pairs from source text.
Classes
Generate question-answer pairs from text chunks via LLM enrichment. |
Module Contents
- class fabricatio_rag.capabilities.enrich.EnrichChunkText(/, **data: Any)
Bases:
fabricatio_core.capabilities.propose.Propose,abc.ABCGenerate question-answer pairs from text chunks via LLM enrichment.
- async enrich(enrich_guideline: str, chunk: str) fabricatio_rag.models.qa.EnrichmentResult
- async enrich(enrich_guideline: str, chunk: List[str]) List[fabricatio_rag.models.qa.EnrichmentResult]
Generate QAPairs from text chunk(s) guided by enrichment instructions.
- Parameters:
enrich_guideline – Free-form NL describing what kinds of questions to generate (e.g. “factual recall”, “conceptual”, “multi-hop”).
chunk – Single string or list of strings to enrich.
- Returns:
an EnrichmentResult with qa_pairs for that chunk. For a list of str: a list of EnrichmentResults, one per input chunk, preserving input order.
- Return type:
For a single str