langchain.embeddings.nlpcloud.NLPCloudEmbeddings¶

class langchain.embeddings.nlpcloud.NLPCloudEmbeddings(model_name: str = 'paraphrase-multilingual-mpnet-base-v2', gpu: bool = False, *, client: Any = None)[source]¶

Bases: BaseModel, Embeddings

NLP Cloud embedding models.

To use, you should have the nlpcloud python package installed

Example

from langchain.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]¶
embed_documents(texts: List[str]) List[List[float]][source]¶

Embed a list of documents using NLP Cloud.

Parameters

texts – The list of texts to embed.

Returns

List of embeddings, one for each text.

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

Embed a query using NLP Cloud.

Parameters

text – The text to embed.

Returns

Embeddings for the text.

validator validate_environment  »  all fields[source]¶

Validate that api key and python package exists in environment.

Examples using NLPCloudEmbeddings¶