EmbaasEmbeddings#
- class langchain_community.embeddings.embaas.EmbaasEmbeddings[source]#
Bases:
BaseModel
,Embeddings
Embaas’s embedding service.
To use, you should have the environment variable
EMBAAS_API_KEY
set with your API key, or pass it as a named parameter to the constructor.Example
# initialize with default model and instruction from langchain_community.embeddings import EmbaasEmbeddings emb = EmbaasEmbeddings() # initialize with custom model and instruction from langchain_community.embeddings import EmbaasEmbeddings emb_model = "instructor-large" emb_inst = "Represent the Wikipedia document for retrieval" emb = EmbaasEmbeddings( model=emb_model, instruction=emb_inst )
Create a new model by parsing and validating input data from keyword arguments.
Raises ValidationError if the input data cannot be parsed to form a valid model.
- param api_url: str = 'https://api.embaas.io/v1/embeddings/'#
The URL for the embaas embeddings API.
- param embaas_api_key: SecretStr | None = None#
max number of retries for requests
- Constraints:
type = string
writeOnly = True
format = password
- param instruction: str | None = None#
Instruction used for domain-specific embeddings.
- param max_retries: int | None = 3#
request timeout in seconds
- param model: str = 'e5-large-v2'#
The model used for embeddings.
- param timeout: int | None = 30#
- 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 EmbaasEmbeddings