langchain_community.embeddings.nlpcloud.NLPCloudEmbeddings¶

class langchain_community.embeddings.nlpcloud.NLPCloudEmbeddings[source]¶

Bases: BaseModel, Embeddings

NLP Cloud embedding models.

To use, you should have the nlpcloud python package installed

Example

from langchain_community.embeddings import NLPCloudEmbeddings

embeddings = NLPCloudEmbeddings()

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 gpu: bool [Required]¶
param model_name: str [Required]¶
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 NLP Cloud.

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 NLP Cloud.

Parameters

text (str) – The text to embed.

Returns

Embeddings for the text.

Return type

List[float]

Examples using NLPCloudEmbeddings¶