IndexItem(text: str, meta: Dict = )
__init__(text: str, meta: Dict = <factory>) → None
The embeddings index is responsible for computing and searching a set of embeddings.
add_item(item: nemoguardrails.embeddings.index.IndexItem)
Adds a new item to the index.
add_items(items: List[nemoguardrails.embeddings.index.IndexItem])
Adds multiple items to the index.
build()
Build the index, after the items are added.
This is optional, might not be needed for all implementations.
search(
text: str,
max_results: int
) → List[nemoguardrails.embeddings.index.IndexItem]
Searches the index for the closes matches to the provided text.
The embedding model is responsible for creating the embeddings.
encode(documents: List[str]) → List[List[float]]
Encode the provided documents into embeddings.