Integrations: Embeddings
LangChain offers a number of Embeddings implementations that integrate with various model providers. These are:
OpenAIEmbeddings
The OpenAIEmbeddings
class uses the OpenAI API to generate embeddings for a given text. By default it strips new line characters from the text, as recommended by OpenAI, but you can disable this by passing stripNewLines: false
to the constructor.
import { OpenAIEmbeddings } from "langchain/embeddings";
const embeddings = new OpenAIEmbeddings();
CohereEmbeddings
- npm
- Yarn
npm install cohere-ai
yarn add cohere-ai
import { CohereEmbeddings } from "langchain/embeddings";
const embeddings = new CohereEmbeddings();