langchainjs
БесплатноБез исполняемых скриптовНе проверенLangChain.js - TypeScript framework for building LLM-powered applications with agents, chains, RAG, tools, memory, and integrations for OpenAI, Anthropic…
Об этом скилле
LangChain.js
LangChain.js is a comprehensive TypeScript framework for building applications powered by large language models. It provides standardized interfaces for connecting LLMs with diverse data sources, tools, and external systems through a modular architecture.
When to Use
- Building AI agents with tool-calling capabilities
- Creating chatbots with conversation memory
- Implementing Retrieval Augmented Generation (RAG) systems
- Connecting LLMs to external data sources and APIs
- Building chains of LLM operations
- Switching between AI providers without code changes
- Streaming LLM responses in real-time
- Implementing structured output from LLMs
- Creating document Q&A systems
- Building semantic search applications
Core Concepts
Agents
Autonomous entities that use LLMs to decide which actions to take. Agents can call tools, access memory, and orchestrate complex workflows.
Chains
Sequences of operations that process inputs through multiple steps. Chains can combine prompts, LLM calls, and post-processing.
Tools
Functions that agents can call to interact with external systems (APIs, databases, web search, etc.).
Memory
Short-term and long-term context management for maintaining conversation state and persistent information.
Retrieval
Integration with vector stores and retrievers for finding relevant documents and context.
Messages
Structured communication format for chat-based interactions (system, human, AI, tool messages).
Structured Output
Constraining LLM responses to specific formats and schemas using Zod or JSON Schema.
Installation
Core Packages
# Install core packages
npm install langchain @langchain/core
# Or with other package managers
pnpm install langchain @langchain/core
yarn add langchain @langchain/core
bun add langchain @langchain/core
Requirement: Node.js 20+
Provider Packages
Install provider-specific packages as needed:
# OpenAI
npm install @langchain/openai
# Anthropic
npm install @langchain/anthropic
# Google
npm install @langchain/google-genai
# AWS Bedrock
npm install @langchain/aws
# Azure OpenAI
npm install @langchain/azure-openai
# Mistral
npm install @langchain/mistralai
# Cohere
npm install @langchain/cohere
# Ollama (local models)
npm install @langchain/ollama
Package Structure
LangChain.js is organized as a monorepo with specialized packages:
| Package | Purpose |
|---|---|
langchain |
Main entry point, high-level abstractions |
@langchain/core |
Base interfaces and foundational abstractions |
@langchain/community |
Community-contributed integrations |
@langchain/textsplitters |
Text chunking utilities |
@langchain/openai |
OpenAI integration |
@langchain/anthropic |
Anthropic Claude integration |
@langchain/google-genai |
Google AI integration |
@langchain/mcp-adapters |
Model Context Protocol adapters |
Supported Environments
- Node.js (ESM/CommonJS) - versions 20.x, 22.x, 24.x
- Cloudflare Workers
- Vercel/Next.js (all execution contexts)
- Supabase Edge Functions
- Modern browsers
- Deno
- Bun
Basic Usage
Chat Models
import { ChatOpenAI } from "@langchain/openai";
// Initialize chat model
const model = new ChatOpenAI({
modelName: "gpt-4",
temperature: 0.7,
});
// Simple invocation
const response = await model.invoke("What is the capital of France?");
console.log(response.content);
// With message array
import { HumanMessage, SystemMessage } from "@langchain/core/messages";
const messages = [
new SystemMessage("You are a helpful assistant."),
new HumanMessage("What is the capital of France?"),
];
const result = await model.invoke(messages);
Using Anthropic
import { ChatAnthropic } from "@langchain/anthropic";
const model = new ChatAnthropic({
modelName: "claude-sonnet-4-20250514",
temperature: 0,
});
const response = await model.invoke("Explain quantum computing in simple terms.");
Streaming Responses
import { ChatOpenAI } from "@langchain/openai";
const model = new ChatOpenAI({
modelName: "gpt-4",
streaming: true,
});
// Stream tokens
const stream = await model.stream("Write a poem about coding.");
for await (const chunk of stream) {
process.stdout.write(chunk.content);
}
Prompt Templates
import { ChatPromptTemplate } from "@langchain/core/prompts";
// Create template
const prompt = ChatPromptTemplate.fromMessages([
["system", "You are a {role} expert."],
["human", "{question}"],
]);
// Format with variables
const formattedPrompt = await prompt.format({
role: "Python",
question: "How do I read a file?",
});
// Or chain with model
const chain = prompt.pipe(model);
const response = await chain.invoke({
role: "Python",
question: "How do I read a file?",
});
Template Variables
import { PromptTemplate } from "@langchain/core/prompts";
Установить langchainjs в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл langchainjs?
LangChain.js - TypeScript framework for building LLM-powered applications with agents, chains, RAG, tools, memory, and integrations for OpenAI, Anthropic, Google, and hundreds of other providers
Как установить скилл langchainjs?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл langchainjs запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
Toolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
от Anthropicaccess
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropicconfigure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
от Anthropicaccess
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
от Anthropic