BookendEmbeddings#

class langchain_community.embeddings.bookend.BookendEmbeddings[source]#

Bases: BaseModel, Embeddings

Bookend AI sentence_transformers embedding models.

Example

from langchain_community.embeddings import BookendEmbeddings

bookend = BookendEmbeddings(
    domain={domain}
    api_token={api_token}
    model_id={model_id}
)
bookend.embed_documents([
    "Please put on these earmuffs because I can't you hear.",
    "Baby wipes are made of chocolate stardust.",
])
bookend.embed_query(
    "She only paints with bold colors; she does not like pastels."
)

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 api_token: str [Required]#

Request for an API token at https://bookend.ai/ to use this embeddings module.

param auth_header: dict [Optional]#
param domain: str [Required]#

Request for a domain at https://bookend.ai/ to use this embeddings module.

param model_id: str [Required]#

Embeddings model ID to use.

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 documents using a Bookend deployed embeddings 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]#

Embed a query using a Bookend deployed embeddings model.

Parameters:

text (str) – The text to embed.

Returns:

Embeddings for the text.

Return type:

List[float]

Examples using BookendEmbeddings