langchain_community.embeddings.edenai.EdenAiEmbeddings¶

class langchain_community.embeddings.edenai.EdenAiEmbeddings[source]¶

Bases: BaseModel, Embeddings

EdenAI embedding. environment variable EDENAI_API_KEY set with your API key, or pass it as a named parameter.

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 edenai_api_key: Optional[SecretStr] = None¶

EdenAI API Token

Constraints
  • type = string

  • writeOnly = True

  • format = password

param model: Optional[str] = None¶

model name for above provider (eg: ‘gpt-3.5-turbo-instruct’ for openai) available models are shown on https://docs.edenai.co/ under ‘available providers’

param provider: str = 'openai'¶

embedding provider to use (eg: openai,google etc.)

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 a list of documents using EdenAI.

Parameters

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

Returns

List of embeddings, one for each text.

Return type

List[List[float]]

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

Embed a query using EdenAI.

Parameters

text (str) – The text to embed.

Returns

Embeddings for the text.

Return type

List[float]

static get_user_agent() str[source]¶
Return type

str

Examples using EdenAiEmbeddings¶