Skip to main content
Embedding models create a vector representation of a piece of text. This page documents integrations with various model providers that allow you to use embeddings in LangChain.
  • OpenAI
  • Azure
  • AWS
  • VertexAI
  • MistralAI
  • Cohere

Install dependencies

  • npm
  • yarn
  • pnpm
npm i @langchain/openai

Add environment variables

OPENAI_API_KEY=your-api-key

Instantiate the model

import { OpenAIEmbeddings } from "@langchain/openai";

const embeddings = new OpenAIEmbeddings({
  model: "text-embedding-3-large"
});
await embeddings.embedQuery("Hello, world!");

All embedding models

I