Knowledge Indexer¶
Cluster: Uncategorised | Type: component | MCP Tools: None
Overview¶
Public API¶
KnowledgeIndexer¶
Orchestrates ColBERT text indexing and FAISS multimedia indexing
Constructor:
| Parameter | Type | Default |
|---|---|---|
domain | str | required |
manifest | ManifestDB | required |
corpus_root | Optional[Path] | None |
Methods:
index_passages(passages: list[Passage]) -> int¶
Index a list of Passage objects.
index_clip_embedding(embedding: list[float], source_url: str, frame_ref: str, timestamp: float, passage_id: str = '') -> None¶
Add a CLIP image/frame embedding to the multimedia index.
index_audio_embedding(embedding: list[float], source_url: str, ts_start: float, ts_end: float, passage_id: str = '') -> None¶
Add a CLAP audio embedding to the multimedia index.
search_text(query: IndexQuery) -> list[IndexResult]¶
Search ColBERT text index, falling back to SQLite FTS5 when ColBERT unavailable.
search_text_with_status(query: IndexQuery) -> SearchResponse¶
Search text, returning results bundled with the disclosed text-backend status.
search_multimedia(query: IndexQuery, modality: str = 'image') -> list[IndexResult]¶
Search CLIP (modality='image') or CLAP (modality='audio') index.
search_multimedia_with_status(query: IndexQuery, modality: str = 'image') -> SearchResponse¶
Search multimedia, returning results bundled with the backend status.
IndexQuery¶
| Field | Type | Default |
|---|---|---|
text | str | required |
domain | str | required |
top_k | int | 10 |
query_embedding | Optional[list] | None |
IndexResult¶
| Field | Type | Default |
|---|---|---|
passage_id | str | required |
chunk_text | str | required |
domain | str | required |
source_url | str | required |
score | float | required |
modality | str | required |
frame_ref | Optional[str] | None |
timestamp_start | Optional[float] | None |
timestamp_end | Optional[float] | None |
SearchResponse¶
Search results bundled with disclosed per-backend status.
| Field | Type | Default |
|---|---|---|
results | list[IndexResult] | required |
text_backend | BackendStatus | 'ok' |
image_backend | BackendStatus | 'ok' |
audio_backend | BackendStatus | 'ok' |
StorageBudgetError(Exception)¶
Functions¶
corpus_size_report(corpus_root: Path) -> tuple[int, int]¶
Walk corpus_root and return (used_bytes, unreadable_count).
corpus_size_bytes(corpus_root: Path) -> int¶
Walk corpus_root and sum all readable file sizes.
check_budget(corpus_root: Path, projected_bytes: int = 0) -> None¶
Raise StorageBudgetError if current + projected exceeds 400 GB.