autorag.chroma_store¶
Persistent Chroma collection of per-clip topic embeddings.
Backs the /viz page’s search box and acts as a cache so the page
load doesn’t have to re-embed every topic on every request.
- class autorag.chroma_store.EmbedderEmbeddingFunction(embedder=None)[source]¶
Bases:
DocumentsAdapt
Embedderto Chroma’sEmbeddingFunctionprotocol.
- autorag.chroma_store.default_chroma_dir(db_path)[source]¶
Return the Chroma persistence directory derived from a SQLite db path.
- class autorag.chroma_store.ChromaStore(persist_dir, embedding_function=None)[source]¶
Bases:
objectPersistent Chroma collection of per-clip topic embeddings.
- Parameters:
persist_dir (Path)
embedding_function (EmbeddingFunction[Documents] | None)
- COLLECTION = 'audio_clip_topics'¶
- add_topic_embeddings(clip_id, clip_title, topics, embeddings)[source]¶
Upsert one document + embedding per topic for
clip_id.Ids use the
"{clip_id}:{topic_index}"shape so the position within a clip’s filtered (title-bearing) topic list is the stable key — matches whatautorag.viz._collect_rows_embeddings()reads back.
- query(query_embedding, top_k)[source]¶
Return the
top_ktopics nearestquery_embeddingin cosine space.Each returned dict carries the topic’s clip/title/summary metadata and a
similarityfield computed as1 - distance.