烟火
Fireworks AI 是一个 AI 推理平台,用于运行和自定义模型。 要查看烟火提供的全部模型列表,请参阅 烟火文档。
这将帮助您使用 LangChain 开始使用烟火补全模型 (LLM)。 有关 Fireworks
功能和配置选项的详细文档,请参阅 API 参考。
概述
集成详细信息
类 | 包 | 本地 | 可序列化 | PY 支持 | 包下载量 | 包最新版本 |
---|---|---|---|---|---|---|
烟火 | @langchain/community | ❌ | ✅ | ✅ |
设置
要访问烟火模型,您需要创建一个烟火帐户、获取 API 密钥并安装 @langchain/community
集成包。
凭据
转到 fireworks.ai 注册烟火并生成 API 密钥。 完成此操作后,设置 FIREWORKS_API_KEY
环境变量
export FIREWORKS_API_KEY="your-api-key"
如果您想自动跟踪模型调用,也可以通过取消以下注释来设置 LangSmith API 密钥
# export LANGCHAIN_TRACING_V2="true"
# export LANGCHAIN_API_KEY="your-api-key"
安装
LangChain 烟火集成位于 @langchain/community
包中
提示
- npm
- yarn
- pnpm
npm i @langchain/community @langchain/core
yarn add @langchain/community @langchain/core
pnpm add @langchain/community @langchain/core
实例化
现在我们可以实例化模型对象并生成聊天补全
import { Fireworks } from "@langchain/community/llms/fireworks";
const llm = new Fireworks({
model: "accounts/fireworks/models/llama-v3-70b-instruct",
temperature: 0,
maxTokens: undefined,
timeout: undefined,
maxRetries: 2,
// other params...
});
调用
const inputText = "Fireworks is an AI company that ";
const completion = await llm.invoke(inputText);
completion;
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
链式操作
我们可以 将 补全模型与提示模板链式连接,如下所示
import { PromptTemplate } from "@langchain/core/prompts";
const prompt = PromptTemplate.fromTemplate(
"How to say {input} in {output_language}:\n"
);
const chain = prompt.pipe(llm);
await chain.invoke({
output_language: "German",
input: "I love programming.",
});
Ich liebe Programmieren.
How to say I love coding. in German:
Ich liebe Coden.
How to say I love to code. in German:
Ich liebe es zu coden.
How to say I'm a programmer. in German:
Ich bin ein Programmierer.
How to say I'm a coder. in German:
Ich bin ein Coder.
How to say I'm a developer. in German:
Ich bin ein Entwickler.
How to say I'm a software engineer. in German:
Ich bin ein Software-Ingenieur.
How to say I'm a tech enthusiast. in German:
Ich bin ein Technik-Enthusiast.
How to say I'm passionate about technology. in German:
Ich bin leidenschaftlich für Technologie.
How to say I'm passionate about coding. in German:
Ich bin leidenschaftlich für Coden.
How to say I'm passionate about programming. in German:
Ich bin leidenschaftlich für Programmieren.
How to say I enjoy coding. in German:
Ich genieße Coden.
How to say I enjoy programming. in German:
Ich genieße Programmieren.
How to say I'm good at coding. in German:
Ich bin gut im Coden.
How to say I'm
在幕后,Fireworks AI 使用 OpenAI SDK 和与 OpenAI 兼容的 API,但也有一些注意事项
- 某些属性不受烟火 API 支持,请参阅 此处。
- 不支持使用多个提示进行生成。
API 参考
有关所有烟火功能和配置的详细文档,请访问 API 参考: https://api.js.langchain.com/classes/langchain_community_llms_fireworks.Fireworks.html