JohnSnowLabsEmbeddings#

class langchain_community.embeddings.johnsnowlabs.JohnSnowLabsEmbeddings[source]#

Bases: BaseModel, Embeddings

JohnSnowLabs embedding models

To use, you should have the johnsnowlabs python package installed. .. rubric:: Example

from langchain_community.embeddings.johnsnowlabs import JohnSnowLabsEmbeddings

embedding = JohnSnowLabsEmbeddings(model='embed_sentence.bert')
output = embedding.embed_query("foo bar")

Initialize the johnsnowlabs model.

param model: Any = 'embed_sentence.bert'#
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]#

Compute doc embeddings using a JohnSnowLabs transformer model.

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]#

Compute query embeddings using a JohnSnowLabs transformer model.

Parameters:

text (str) – The text to embed.

Returns:

Embeddings for the text.

Return type:

List[float]

Examples using JohnSnowLabsEmbeddings