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
- Yarn
- pnpm
npm install @langchain/community
yarn add @langchain/community
pnpm add @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:
- FireworksEmbeddings from
@langchain/community/embeddings/fireworks