Synthetic Data¶
synthetic ¶
Provider-neutral synthetic QA dataset generation.
SourceDocument
dataclass
¶
SourceSpan
dataclass
¶
SyntheticQA
dataclass
¶
SyntheticQA(query: str, answer: str, source_spans: tuple[SourceSpan, ...] = (), confidence: float | None = None)
One provider-produced question, answer, and supporting provenance.
SyntheticGenerationRequest
dataclass
¶
SyntheticGenerationRequest(document: SourceDocument, count: int, seed: int)
Structured request sent to a synthetic QA provider.
SyntheticGenerationResponse
dataclass
¶
SyntheticGenerationResponse(items: tuple[SyntheticQA, ...], usage: tuple[UsageRecord, ...] = ())
Provider output with exact or estimated usage records.
SyntheticQAProvider ¶
Bases: Protocol
Generate typed QA pairs for one source document.
generate
async
¶
generate(request: SyntheticGenerationRequest) -> SyntheticGenerationResponse
SyntheticDatasetResult
dataclass
¶
SyntheticDatasetResult(dataset: EvaluationDataset, usage: tuple[UsageRecord, ...], failed_document_ids: tuple[str, ...] = ())
Generated evaluation dataset and provider usage.
SyntheticDatasetBuilder ¶
SyntheticDatasetBuilder(provider: SyntheticQAProvider, *, samples_per_document: int = 3, concurrency: int = 4, seed: int = 0, generator_version: str = 'unspecified', allow_partial: bool = False)
Generate a validated dataset with bounded document concurrency.
Source code in src/tunarag/synthetic.py
generate
async
¶
generate(documents: Sequence[SourceDocument]) -> SyntheticDatasetResult
Generate and validate examples in source-document order.
Source code in src/tunarag/synthetic.py
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |