Skip to main content

Fireworks

The FireworksEmbeddings class allows you to use the Fireworks AI API to generate embeddings.

Setup

First, sign up for a Fireworks API key and set it as an environment variable called FIREWORKS_API_KEY.

Next, install the @langchain/community package as shown below:

npm install @langchain/community

Usage

import { FireworksEmbeddings } from "@langchain/community/embeddings/fireworks";

/* Embed queries */
const fireworksEmbeddings = new FireworksEmbeddings();
const res = await fireworksEmbeddings.embedQuery("Hello world");

console.log(res);

/* Embed documents */
const documentRes = await fireworksEmbeddings.embedDocuments([
"Hello world",
"Bye bye",
]);

console.log(documentRes);

API Reference:


Help us out by providing feedback on this documentation page: