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