TxtaiReader#

class llama_index.readers.TxtaiReader(index: Any)#

Bases: BaseReader

txtai reader.

Retrieves documents through an existing in-memory txtai index. These documents can then be used in a downstream LlamaIndex data structure. If you wish use txtai itself as an index to to organize documents, insert documents, and perform queries on them, please use VectorStoreIndex with TxtaiVectorStore.

Parameters

txtai_index (txtai.ann.ANN) – A txtai Index object (required)

Methods Summary

load_data(query, id_to_text_map[, k, ...])

Load data from txtai index.

Methods Documentation

load_data(query: ndarray, id_to_text_map: Dict[str, str], k: int = 4, separate_documents: bool = True) List[Document]#

Load data from txtai index.

Parameters
  • query (np.ndarray) – A 2D numpy array of query vectors.

  • id_to_text_map (Dict[str, str]) – A map from ID’s to text.

  • k (int) – Number of nearest neighbors to retrieve. Defaults to 4.

  • separate_documents (Optional[bool]) – Whether to return separate documents. Defaults to True.

Returns

A list of documents.

Return type

List[Document]