MlflowEmbeddings#

class langchain_community.embeddings.mlflow.MlflowEmbeddings[source]#

Bases: Embeddings, BaseModel

Embedding LLMs in MLflow.

To use, you should have the mlflow[genai] python package installed. For more information, see https://mlflow.org/docs/latest/llms/deployments.

Example

from langchain_community.embeddings import MlflowEmbeddings

embeddings = MlflowEmbeddings(
    target_uri="http://localhost:5000",
    endpoint="embeddings",
)
param documents_params: Dict[str, str] = {}#
param endpoint: str [Required]#

The endpoint to use.

param query_params: Dict[str, str] = {}#

The parameters to use for documents.

param target_uri: str [Required]#

The target URI to use.

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(texts: List[str], params: Dict[str, str]) List[List[float]][source]#
Parameters:
  • texts (List[str])

  • params (Dict[str, str])

Return type:

List[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 MlflowEmbeddings