ErnieEmbeddings#

class langchain_community.embeddings.ernie.ErnieEmbeddings[source]#

Bases: BaseModel, Embeddings

Deprecated since version 0.0.13: Use QianfanEmbeddingsEndpoint instead.

Ernie Embeddings V1 embedding models.

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 access_token: str | None = None#
param chunk_size: int = 16#
param ernie_api_base: str | None = None#
param ernie_client_id: str | None = None#
param ernie_client_secret: str | None = None#
param model_name: str = 'ErnieBot-Embedding-V1'#
async aembed_documents(texts: List[str]) List[List[float]][source]#

Asynchronous Embed search docs.

Parameters:

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

Returns:

List of embeddings, one for each text.

Return type:

List[List[float]]

async aembed_query(text: str) List[float][source]#

Asynchronous Embed query text.

Parameters:

text (str) – The text to embed.

Returns:

Embeddings for the text.

Return type:

List[float]

embed_documents(texts: List[str]) List[List[float]][source]#

Embed search docs.

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 query text.

Parameters:

text (str) – The text to embed.

Returns:

Embeddings for the text.

Return type:

List[float]

classmethod validate_environment(values: Dict) Dict[source]#
Parameters:

values (Dict)

Return type:

Dict

Examples using ErnieEmbeddings