Skip to main content
This will help you get started with Cloudflare Workers AI embedding models using LangChain. For detailed documentation on CloudflareWorkersAIEmbeddings features and configuration options, please refer to the API reference.

Overview

Integration details

Setup

To access Cloudflare embedding models you’ll need to create a Cloudflare account and install the @langchain/cloudflare integration package. This integration is made to run in a Cloudflare worker and accept a binding. Follow the official docs to set up your worker. Your wrangler.toml file should look similar to this:

Credentials

If you want to get automated tracing of your model calls you can also set your LangSmith API key by uncommenting below:

Installation

The LangChain CloudflareWorkersAIEmbeddings integration lives in the @langchain/cloudflare package:

Usage

Below is an example worker that uses Workers AI embeddings with a Cloudflare Vectorize vectorstore.

API reference

For detailed documentation of all CloudflareWorkersAIEmbeddings features and configurations head to the API reference.