module nemoguardrails.embeddings.index#


class IndexItem#

IndexItem(text: str, meta: Dict = )

method IndexItem.__init__#

__init__(text: str, meta: Dict = <factory>)  None

class EmbeddingsIndex#

The embeddings index is responsible for computing and searching a set of embeddings.


property EmbeddingsIndex.embedding_size#


method EmbeddingsIndex.add_item#

add_item(item: nemoguardrails.embeddings.index.IndexItem)

Adds a new item to the index.


method EmbeddingsIndex.add_items#

add_items(items: List[nemoguardrails.embeddings.index.IndexItem])

Adds multiple items to the index.


method EmbeddingsIndex.build#

build()

Build the index, after the items are added.

This is optional, might not be needed for all implementations.


class EmbeddingModel#

The embedding model is responsible for creating the embeddings.


method EmbeddingModel.encode#

encode(documents: List[str])  List[List[float]]

Encode the provided documents into embeddings.