langchain-chat-models
使用 LangChain 中的聊天模型集成指南,包括 OpenAI、Anthropic、Google、Azure 和 Bedrock
npx skills add majiayu000/claude-skill-registry --skill langchain-integrations-chat-models --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# langchain-chat-models (JavaScript/TypeScript) ## 概述 LangChain 中的聊天模型为与各种 LLM 提供商交互提供了统一接口。它们接受消息序列作为输入,并返回 AI 生成的消息作为输出。聊天模型支持工具调用、结构化输出和流式传输等功能。 ### 核心概念 - **聊天模型**:接受消息(具有角色:system、user、assistant)并返回生成的响应 - **提供商**:提供 LLM API 的不同 AI 公司(OpenAI、Anthropic、Google、Azure、Bedrock 等) - **工具调用**:模型可以根据用户查询调用函数/工具 - **流式传输**:实时逐令牌响应生成 - **结构化输出**:模型可以返回特定格式的响应(JSON、TypeScript 类型) ## 提供商选择决策表 | 提供商 | 最适合 | 模型示例 | 包 | 主要特性 | |----------|----------|----------------|---------|--------------| | **OpenAI** | 通用、函数调用 | gpt-4、gpt-4-turbo、gpt-3.5-turbo | `@langchain/openai` | 强大的函数调用、视觉、快速 | | **Anthropic** | 长上下文、安全性、分析 | claude-3-opus、claude-3-sonnet、claude-3-haiku | `@langchain/anthropic` | 200k 上下文、工具使用、提示缓存 | | **Google GenAI** | 多模态、免费层 | gemini-pro、gemini-pro-vision | `@langchain/google-genai` | 视觉、提供免费层 | | **Azure OpenAI** | 企业、合规性 | gpt-4、gpt-35-turbo(Azure 部署) | `@langchain/openai` | 企业 SLA、数据驻留 | | **AWS Bedrock** | AWS 生态系统、多样性 | claude、llama、titan 模型 | `@langchain/aws` | 多个模型、AWS 集成 | | **Google Vertex AI** | GCP 生态系统、企业 | gemini-pro、palm 模型 | `@langchain/google-vertexai` | 企业功能、GCP 集成 | ### 何时选择每个提供商 **选择 OpenAI 如果:** - 您需要强大的函数/工具调用能力 - 您希望快速的响应时间 - 您正在构建通用应用程序 **选择 Anthropic 如果:*
- 概述
- 核心概念
- 提供商选择决策表
- 何时选择每个提供商
- 代码示例
- OpenAI 聊天模型
- Anthropic 聊天模型
- Azure OpenAI 聊天模型
- AWS Bedrock 聊天模型
- Google Generative AI
- 使用 initChatModel(推荐)
- 工具调用示例
- 边界
- 代理可以做什么
OpenAI npm install @langchain/openai Anthropic npm install @langchain/anthropic AWS (Bedrock) npm install @langchain/aws Google npm install @langchain/google-genai npm install @langchain/google-vertexai
What does the langchain-chat-models skill do?
使用 LangChain 中的聊天模型集成指南,包括 OpenAI、Anthropic、Google、Azure 和 Bedrock
How do I install it?
Run `npx skills add majiayu000/claude-skill-registry --skill langchain-integrations-chat-models --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From majiayu000/claude-skill-registry, a repository with 534 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
