ClarifaiEmbeddings#
- class langchain_community.embeddings.clarifai.ClarifaiEmbeddings[source]#
Bases:
BaseModel
,Embeddings
Clarifai embedding models.
To use, you should have the
clarifai
python package installed, and the environment variableCLARIFAI_PAT
set with your personal access token or pass it as a named parameter to the constructor.Example
from langchain_community.embeddings import ClarifaiEmbeddings clarifai = ClarifaiEmbeddings(user_id=USER_ID, app_id=APP_ID, model_id=MODEL_ID) (or) Example_URL = "https://clarifai.com/clarifai/main/models/BAAI-bge-base-en-v15" clarifai = ClarifaiEmbeddings(model_url=EXAMPLE_URL)
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 api_base: str = 'https://api.clarifai.com'#
- param app_id: str | None = None#
Clarifai application id to use.
- param model_id: str | None = None#
Model id to use.
- param model_url: str | None = None#
Model url to use.
- param model_version_id: str | None = None#
Model version id to use.
- param pat: str | None = None#
Clarifai personal access token to use.
- param token: str | None = None#
Clarifai session token to use.
- param user_id: str | None = None#
Clarifai user id 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]
Examples using ClarifaiEmbeddings