nemoguardrails.embeddings.providers.fastembed

View as Markdown

Module Contents

Classes

NameDescription
FastEmbedEmbeddingModelEmbedding model using FastEmbed.

Functions

NameDescription
get_executor-

API

class nemoguardrails.embeddings.providers.fastembed.FastEmbedEmbeddingModel(
embedding_model: str,
kwargs = {}
)

Bases: EmbeddingModel

Embedding model using FastEmbed.

This class represents an embedding model that utilizes the FastEmbed library for generating sentence embeddings.

Parameters:

embedding_model
str

The name or path of the pre-trained model.

embedding_size
= len(list(self.model.embed('test'))[0].tolist())
engine_name
= 'FastEmbed'
model
= Embedding(embedding_model, **kwargs)
nemoguardrails.embeddings.providers.fastembed.FastEmbedEmbeddingModel.encode(
documents: typing.List[str]
) -> typing.List[typing.List[float]]

Encode a list of documents into their corresponding sentence embeddings.

Parameters:

documents
List[str]

The list of documents to be encoded.

Returns: List[List[float]]

List[List[float]]: The list of sentence embeddings, where each embedding is a list of floats.

nemoguardrails.embeddings.providers.fastembed.FastEmbedEmbeddingModel.encode_async(
documents: typing.List[str]
) -> typing.List[typing.List[float]]
async

Encode a list of documents into their corresponding sentence embeddings.

Parameters:

documents
List[str]

The list of documents to be encoded.

Returns: List[List[float]]

List[List[float]]: The list of sentence embeddings, where each embedding is a list of floats.

nemoguardrails.embeddings.providers.fastembed.get_executor()