@langchain/fireworks
v0.1.5
Published
Fireworks integration for LangChain.js
Maintainers
Keywords
Readme
@langchain/fireworks
This package contains the LangChain.js integrations for Fireworks AI.
Installation
npm install @langchain/fireworks @langchain/coreThis package depends on @langchain/core.
If you use it together with other LangChain packages, make sure they all resolve
to the same @langchain/core version.
Chat models
Use ChatFireworks for chat-completions style models exposed by Fireworks'
OpenAI-compatible API.
export FIREWORKS_API_KEY="your-api-key"import { ChatFireworks } from "@langchain/fireworks";
const model = new ChatFireworks({
model: "accounts/fireworks/models/firefunction-v2",
temperature: 0,
});
const response = await model.invoke("Tell me a joke about rockets.");
console.log(response.content);LLMs
Use Fireworks for text-completion style models.
import { Fireworks } from "@langchain/fireworks";
const model = new Fireworks({
model: "accounts/fireworks/models/llama-v2-13b",
temperature: 0,
});
const response = await model.invoke("1 + 1 =");
console.log(response);Embeddings
Use FireworksEmbeddings for embedding models exposed by Fireworks.
import { FireworksEmbeddings } from "@langchain/fireworks";
const embeddings = new FireworksEmbeddings({
model: "nomic-ai/nomic-embed-text-v1.5",
});
const vector = await embeddings.embedQuery("hello world");
console.log(vector);Development
Install dependencies from the monorepo root:
pnpm installBuild this package:
pnpm --filter @langchain/fireworks buildRun unit tests:
pnpm --filter @langchain/fireworks testRun integration tests:
pnpm --filter @langchain/fireworks test:intRun standard tests:
pnpm --filter @langchain/fireworks test:standard