Skip to main content

TogetherEmbeddings

This notebook covers how to get started with Together embedding models.

Installation

# install package
!pip install -U langchain-together

Environment Setup

Make sure to set the following environment variables:

  • TOGETHER_API_KEY

Usage

from langchain_together.embeddings import TogetherEmbeddings

embeddings = TogetherEmbeddings(model="togethercomputer/m2-bert-80M-8k-retrieval")
embeddings.embed_query("My query to look up")
embeddings.embed_documents(
["This is a content of the document", "This is another document"]
)
# async embed query
await embeddings.aembed_query("My query to look up")
# async embed documents
await embeddings.aembed_documents(
["This is a content of the document", "This is another document"]
)