Skip to content

Latest commit

 

History

History
127 lines (61 loc) · 3.13 KB

nemoguardrails.embeddings.index.md

File metadata and controls

127 lines (61 loc) · 3.13 KB

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.


method EmbeddingsIndex.search

search(
    text: str,
    max_results: int
) → List[nemoguardrails.embeddings.index.IndexItem]

Searches the index for the closes matches to the provided text.


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.