> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-docs-zh.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Fireworks 集成

> 使用 LangChain JavaScript 与 Fireworks LLM 集成。

> [!WARNING]
>
> **您当前所在的页面正在记录 Fireworks 模型作为文本完成模型的使用方法。Fireworks 上许多流行的模型都是 [对话完成模型](https://langchain-docs-zh.mintlify.site/langchain/oss/langchain/models.md)。**
>
> 您可能需要查找 [这个页面](https://langchain-docs-zh.mintlify.site/langchain/oss/python/integrations/chat/fireworks.md)。

[Fireworks AI](https://fireworks.ai/) 是一个用于运行和定制模型的 AI 推理平台。Fireworks 提供的所有模型列表请参阅 [Fireworks 文档](https://fireworks.ai/models)。

这将帮助您使用 LangChain 开始使用 Fireworks 完成模型（LLMs）。有关 `Fireworks` 功能和配置选项的详细文档，请参阅 [API 参考](https://reference.langchain.com/javascript/langchain-fireworks/Fireworks)。

## 概述

### 集成细节

| 类 | 包 | 本地 | 可序列化 | Python 支持 | 下载 | 版本 |
| :- | :- | :-: | :-: | :-: | :-: | :-: |
| [`Fireworks`](https://reference.langchain.com/javascript/langchain-fireworks/Fireworks) | [`@langchain/fireworks`](https://www.npmjs.com/package/@langchain/fireworks) | ❌ | ✅ | ✅ | ![NPM - 下载](https://img.shields.io/npm/dm/@langchain/fireworks?style=flat-square\&label=%20&) | ![NPM - 版本](https://img.shields.io/npm/v/@langchain/fireworks?style=flat-square\&label=%20&) |

## 设置

要访问 Fireworks 模型，您需要创建一个 Fireworks 账户，获取一个 API 密钥，并安装 `@langchain/fireworks` 集成包。

### 凭证

前往 [fireworks.ai](https://fireworks.ai/) 注册 Fireworks 并生成 API 密钥。完成后，设置 `FIREWORKS_API_KEY` 环境变量：

```bash theme={null}
export FIREWORKS_API_KEY="your-api-key"
```

如果您希望自动跟踪您的模型调用，您也可以通过取消注释以下内容来设置您的 [LangSmith](https://docs.langchain.com/langsmith/observability) API 密钥：

```bash theme={null}
# export LANGSMITH_TRACING="true"
# export LANGSMITH_API_KEY="your-api-key"
```

### 安装

LangChain Fireworks 集成位于 `@langchain/fireworks` 包中：

```bash npm theme={null}
npm install @langchain/fireworks @langchain/core
```

```bash yarn theme={null}
yarn add @langchain/fireworks @langchain/core
```

```bash pnpm theme={null}
pnpm add @langchain/fireworks @langchain/core
```

## 实例化

现在我们可以实例化我们的模型对象并生成文本完成：

```typescript theme={null}
import { Fireworks } from "@langchain/fireworks"

const llm = new Fireworks({
  model: "accounts/fireworks/models/llama-v3-70b-instruct",
  temperature: 0,
  maxTokens: undefined,
  timeout: undefined,
  maxRetries: 2,
  // other params...
})
```

## 调用

```typescript theme={null}
const inputText = "Fireworks is an AI company that "

const completion = await llm.invoke(inputText)
completion
```

```text theme={null}
 helps businesses automate their customer support using AI-powered chatbots. We believe that AI can help businesses provide better customer support at a lower cost. Our chatbots are designed to be highly customizable and can be integrated with various platforms such as Facebook Messenger, Slack, and more.

We are looking for a talented and motivated **Machine Learning Engineer** to join our team. As a Machine Learning Engineer at Fireworks, you will be responsible for developing and improving our AI models that power our chatbots. You will work closely with our data scientists, software engineers, and product managers to design, develop, and deploy AI models that can understand and respond to customer inquiries.

**Responsibilities:**

* Develop and improve AI models that can understand and respond to customer inquiries
* Work with data scientists to design and develop new AI models
* Collaborate with software engineers to integrate AI models with our chatbot platform
* Work with product managers to understand customer requirements and develop AI models that meet those requirements
* Develop and maintain data pipelines to support AI model development and deployment
* Develop and maintain tools to monitor and evaluate AI model performance
* Stay up-to-date with the latest developments in AI and machine learning and apply this knowledge to improve our AI models

**Requirements:**

* Bachelor's
```

***

## API 参考

有关 Fireworks 所有功能和配置的详细文档，请前往 [API 参考](https://reference.langchain.com/javascript/langchain-fireworks/Fireworks)。

***

> 官方原文：[src/oss/javascript/integrations/llms/fireworks.mdx](https://github.com/langchain-ai/docs/blob/main/src/oss/javascript/integrations/llms/fireworks.mdx) · 非官方翻译，译文由 AI 生成，以英文原文为准。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.