聊天模型
聊天模型是使用一系列消息作为输入并返回消息作为输出(而不是使用纯文本)的语言模型。这些通常是较新的型号。
选择您的聊天模型:
- 格罗克
- 开放人工智能
- 人
- 谷歌双子座
- 烟花AI
- MistralAI
- 顶点人工智能
安装依赖项
提示
- npm
- 纱
- PNPM
npm i @langchain/groq
yarn add @langchain/groq
pnpm add @langchain/groq
Add environment variables
Add environment variablesGROQ_API_KEY=your-api-key
Instantiate the model
Instantiate the modelimport { ChatGroq } from "@langchain/groq";
const model = new ChatGroq({
model: "llama-3.3-70b-versatile",
temperature: 0
});
Install dependencies
Install dependenciesnpmyarnpnpm
npm i @langchain/openai
yarn add @langchain/openai
pnpm add @langchain/openai
Add environment variables
Add environment variablesOPENAI_API_KEY=your-api-key
Instantiate the model
Instantiate the modelimport { ChatOpenAI } from "@langchain/openai";
const model = new ChatOpenAI({ model: "gpt-4o-mini" });
Install dependencies
Install dependenciesnpmyarnpnpm
npm i @langchain/anthropic
yarn add @langchain/anthropic
pnpm add @langchain/anthropic
Add environment variables
Add environment variablesANTHROPIC_API_KEY=your-api-key
Instantiate the model
Instantiate the modelimport { ChatAnthropic } from "@langchain/anthropic";
const model = new ChatAnthropic({
model: "claude-3-5-sonnet-20240620",
temperature: 0
});
Install dependencies
Install dependenciesnpmyarnpnpm
npm i @langchain/google-genai
yarn add @langchain/google-genai
pnpm add @langchain/google-genai
Add environment variables
Add environment variablesGOOGLE_API_KEY=your-api-key
Instantiate the model
Instantiate the modelimport { ChatGoogleGenerativeAI } from "@langchain/google-genai";
const model = new ChatGoogleGenerativeAI({
model: "gemini-2.0-flash",
temperature: 0
});
Install dependencies
Install dependenciesnpmyarnpnpm
npm i @langchain/community
yarn add @langchain/community
pnpm add @langchain/community
Add environment variables
Add environment variablesFIREWORKS_API_KEY=your-api-key
Instantiate the model
Instantiate the modelimport { ChatFireworks } from "@langchain/community/chat_models/fireworks";
const model = new ChatFireworks({
model: "accounts/fireworks/models/llama-v3p1-70b-instruct",
temperature: 0
});
Install dependencies
Install dependenciesnpmyarnpnpm
npm i @langchain/mistralai
yarn add @langchain/mistralai
pnpm add @langchain/mistralai
Add environment variables
Add environment variablesMISTRAL_API_KEY=your-api-key
Instantiate the model
Instantiate the modelimport { ChatMistralAI } from "@langchain/mistralai";
const model = new ChatMistralAI({
model: "mistral-large-latest",
temperature: 0
});
Install dependencies
Install dependenciesnpmyarnpnpm
npm i @langchain/google-vertexai
yarn add @langchain/google-vertexai
pnpm add @langchain/google-vertexai
Add environment variables
Add environment variablesGOOGLE_APPLICATION_CREDENTIALS=credentials.json
Instantiate the model
Instantiate the modelimport { ChatVertexAI } from "@langchain/google-vertexai";
const model = new ChatVertexAI({
model: "gemini-1.5-flash",
temperature: 0
});
await model.invoke("Hello, world!")
Featured providers
Featured providers| 型 | 流 | JSON 模式 | 工具调用 | withStructuredOutput() | 模 态 |
|---|---|---|---|---|---|
| BedrockChat | ✅ | ❌ | 🟡 (仅限 Bedrock Anthropic) | 🟡 (仅限 Bedrock Anthropic) | 🟡 (仅限 Bedrock Anthropic) |
| ChatBedrock匡威 | ✅ | ❌ | ✅ | ✅ | ✅ |
| 聊天人类 | ✅ | ❌ | ✅ | ✅ | ✅ |
| 聊天CloudflareWorkersAI | ✅ | ❌ | ❌ | ❌ | ❌ |
| 聊天 | ✅ | ❌ | ✅ | ✅ | ✅ |
| 聊天烟花 | ✅ | ✅ | ✅ | ✅ | ✅ |
| ChatGoogleGenerativeAI | ✅ | ❌ | ✅ | ✅ | ✅ |
| ChatVertexAI | ✅ | ❌ | ✅ | ✅ | ✅ |
| 查格罗克 | ✅ | ✅ | ✅ | ✅ | ✅ |
| 聊天MistralAI | ✅ | ✅ | ✅ | ✅ | ✅ |
| 查特奥拉玛 | ✅ | ✅ | ✅ | ✅ | ✅ |
| 聊天OpenAI | ✅ | ✅ | ✅ | ✅ | ✅ |
| 一起聊天AI | ✅ | ✅ | ✅ | ✅ | ✅ |
| ChatXAI | ✅ | ✅ | ✅ | ✅ | ❌ |
All chat models
All chat models| 名字 | 描述 |
|---|---|
| 阿里巴巴同义 | LangChain.js 支持阿里巴巴 qwen 系列模型。 |
| 人 | Anthropic 是一项 AI 安全和研究 |
| Arcjet 修订 | Arcjet 修订集成允许您进行修订 |
| Azure OpenAI | Azure OpenAI 是一项 Microsoft Azure 服务,可提供强大的 |
| 百度千帆 | 设置 |
| 亚马逊基岩版 | Amazon Bedrock 是一个完全托管的 |
| 亚马逊 Bedrock 匡威 | [亚马逊基岩版 |
| Cerebras 公司 | Cerebras 是一家提供开放 |
| Cloudflare Workers 人工智能 | Workers AI 允许您 |
| 凝聚 | Cohere 是一家加拿大初创公司,提供 |
| 深度基础设施 | LangChain 支持 Deep Infra 通过 ChatD 托管的聊天模型... |
| 深度seek | 这将帮助您开始使用 DeepSeek [聊天 |
| 深度seek | 这将帮助您开始使用 DeepSeek [聊天 |
| 假 LLM | LangChain 提供了一个虚假的 LLM 聊天模型用于测试目的。这个... |
| 烟火 | Fireworks AI 是一个可运行的 AI 推理平台 |
| 友德利 | Friendli 增强 AI 应用程序性能并优化成本节约... |
| 谷歌 GenAI | Google AI 提供了许多不同的聊天方式 |
| 谷歌顶点人工智能 | Google Vertex 是一项服务 |
| 格罗克 | Groq 是一家提供快速 AI 推理的公司, |
| IBM watsonx.ai | 这将帮助您开始使用 IBM watsonx.ai [聊天 |
| 骆驼 CPP | 仅在 Node.js 上可用。 |
| 极大 极小 | Minimax 是一家中国初创公司,提供自然语言处理... |
| MistralAI | Mistral AI 是一个提供托管的平台 |
| 大胆创新计划 | LangChain.js 支持 Moonshot AI 系列模型。 |
| 诺维塔人工智能 | 提供经济实惠、可靠且简单的推理平台 |
| 奥拉马 | Ollama 允许您运行开源大型 |
| 开放人工智能 | OpenAI 是人工的 |
| 困惑 | 本指南将帮助您开始使用 Perplexity [聊天 |
| 困惑 | 本指南将帮助您开始使用 Perplexity [聊天 |
| PremAI 公司 | 设置 |
| 腾讯浑源 | LangChain.js 支持腾讯浑源系列模型。 |
| 一起 | Together AI 提供了一个 API 来查询 [50+ |
| WebLLM 网络 | 仅在 Web 环境中可用。 |
| xAI | xAI 是一家开发 |
| YandexGPT | LangChain.js 支持调用 YandexGPT 聊天模型。 |
| 智普AI | LangChain.js 支持 Zhipu AI 系列模型。 |