emily.index_classes.VectorIndex
Created on Thu May 7 10:28:31 2026
@author: Dr Peter J Bleackley
Classes
Uses an embedding model and a vector database to find semantically similar |
Module Contents
- class emily.index_classes.VectorIndex.VectorIndex(model_url: str, path: str, collection_name: str)[source]
Uses an embedding model and a vector database to find semantically similar candidates
- async init_db()[source]
Creates collection for vectors if it does not already exists
- Return type:
None.
- async add_documents(corpus: collections.abc.AsyncIterable[tuple[str, str]])[source]
Adds documents to database
- Parameters:
corpus (AsyncIterable[tuple[str,str]]) – Iterable containing (filename,text) for documents to be added.
- Return type:
None.
- async __call__(query: str, limit: int = 10) polars.LazyFrame[source]
Searches the vector database for documents relevant to query
- Parameters:
query (str) – Search query
limit (int, optional) – Maximimum number of results to return. The default is 10.
- Returns:
LazyFrame containing filenames of matching documents
- Return type:
pl.LazyFrame