DeterministicFakeEmbedding#

class langchain_community.embeddings.fake.DeterministicFakeEmbedding[source]#

Bases: Embeddings, BaseModel

Fake embedding model that always returns the same embedding vector for the same text.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

param size: int [Required]#

The size of the embedding vector.

async aembed_documents(texts: list[str]) list[list[float]]#

Asynchronous Embed search docs.

Parameters:

texts (list[str]) – List of text to embed.

Returns:

List of embeddings.

Return type:

list[list[float]]

async aembed_query(text: str) list[float]#

Asynchronous Embed query text.

Parameters:

text (str) – Text to embed.

Returns:

Embedding.

Return type:

list[float]

embed_documents(texts: List[str]) List[List[float]][source]#

Embed search docs.

Parameters:

texts (List[str]) – List of text to embed.

Returns:

List of embeddings.

Return type:

List[List[float]]

embed_query(text: str) List[float][source]#

Embed query text.

Parameters:

text (str) – Text to embed.

Returns:

Embedding.

Return type:

List[float]

Examples using DeterministicFakeEmbedding