Spaces:
Sleeping
Sleeping
File size: 1,153 Bytes
005e9fd | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | """Shapes of the files the ingestion writes."""
from typing import TypedDict
class Page(TypedDict):
"""One chapter, as listed in a book's SUMMARY.md."""
book: str
path: str # relative to the book's source directory, e.g. "ch10-01-syntax.md"
title: str
part: str | None # the mdBook part heading above it
url: str # published HTML, without a fragment
class ManifestBook(TypedDict):
title: str
repo: str
sha: str
base_url: str
license: str
excluded_parts: list[str]
page_count: int
pages: list[Page]
class ChunkMetadata(TypedDict):
book: str
book_title: str
part: str
chapter: str
heading_path: list[str]
path: str
url: str # published HTML, with the section fragment when there is one
has_code: bool
code_tags: list[str]
class Chunk(TypedDict):
id: str
text: str
metadata: ChunkMetadata
class EvalRow(TypedDict):
"""One question/chunk pair in `eval/dataset.json`.
`chunk_id` is the chunk the question was generated from, and what the retriever
is scored against.
"""
question: str
chunk_id: str
book: str
|