EmbeddingsVectorizer#

class langchain_redis.cache.EmbeddingsVectorizer[source]#

Bases: BaseVectorizer

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 dims: int | None = None#
param dtype: str = 'float32'#
param embeddings: Embeddings [Required]#
param model: str = 'custom_embeddings'#
async aembed(text: str, dtype: str | VectorDataType = 'float32', **kwargs: Any) List[float][source]#
Parameters:
  • text (str)

  • dtype (str | VectorDataType)

  • kwargs (Any)

Return type:

List[float]

async aembed_many(texts: List[str], dtype: str | VectorDataType = 'float32', **kwargs: Any) List[List[float]][source]#
Parameters:
  • texts (List[str])

  • dtype (str | VectorDataType)

  • kwargs (Any)

Return type:

List[List[float]]

batchify(seq: list, size: int, preprocess: Callable | None = None)#
Parameters:
  • seq (list)

  • size (int)

  • preprocess (Callable | None)

embed(text: str, dtype: str | VectorDataType = 'float32', **kwargs: Any) List[float][source]#
Parameters:
  • text (str)

  • dtype (str | VectorDataType)

  • kwargs (Any)

Return type:

List[float]

embed_many(texts: List[str], dtype: str | VectorDataType = 'float32', **kwargs: Any) List[List[float]][source]#
Parameters:
  • texts (List[str])

  • dtype (str | VectorDataType)

  • kwargs (Any)

Return type:

List[List[float]]

encode(texts: str | List[str], dtype: str | VectorDataType, **kwargs: Any) ndarray[source]#
Parameters:
  • texts (str | List[str])

  • dtype (str | VectorDataType)

  • kwargs (Any)

Return type:

ndarray

property type: str#