langchain-reference

📁 vercel/app 📅 13 days ago
1
总安装量
1
周安装量
#52182
全站排名
安装命令
npx skills add https://reference-docs.vercel.app

Agent 安装分布

cursor 1

Skill 文档

LangChain API Reference

Access comprehensive API documentation for LangChain – a framework for building applications with large language models (LLMs). Covers Python and JavaScript SDKs for LangChain, LangGraph, LangSmith, and integrations.

When to Use

Use this skill when:

  • Working with LangChain Python or JavaScript code
  • Looking up class signatures, method parameters, or return types
  • Finding the right LangChain component for a task
  • Understanding LangGraph agent workflows
  • Integrating LangSmith for tracing and observability

Accessing Documentation

MCP Server (Recommended for IDEs)

Use the MCP server for structured API access:

https://reference.langchain.com/mcp

Available tools:

  • search_api: Search for classes, functions, symbols by name or keyword
  • get_symbol: Get full documentation for a specific symbol

Markdown Endpoints

All documentation pages are available as markdown:

Method Example
Add .md suffix https://reference.langchain.com/python/langchain-core/RunnableSequence.md
Accept header Accept: text/markdown
Automatically detected Requests from curl, wget, known AI user agents

Index Files

Resource URL Purpose
llms.txt https://reference.langchain.com/llms.txt Package index with descriptions
llms-full.txt https://reference.langchain.com/llms-full.txt Complete symbol listing

URL Patterns

https://reference.langchain.com/{language}/{package}.md                    # Package overview
https://reference.langchain.com/{language}/{package}/{Symbol}.md           # Symbol documentation
https://reference.langchain.com/{language}/{package}/{Symbol}/{member}.md  # Nested member

Languages: python, javascript, java, go

Decision Guide

Need Use
Find a class/function by name search_api MCP tool or grep llms-full.txt
Get full symbol documentation get_symbol MCP tool or fetch URL with .md
Browse package contents Fetch package URL with .md suffix
Understand available packages Read llms.txt

Python vs JavaScript

Python Package JavaScript Package Purpose
langchain-core @langchain/core Core abstractions (Runnables, messages)
langchain langchain Chains, agents, retrieval
langgraph @langchain/langgraph Stateful multi-actor graphs
langsmith langsmith Tracing and observability

Note: APIs are similar but not identical. Always check language-specific documentation.

Gotchas

  1. Package name format differs by language

    • Python: langchain-core (hyphenated)
    • JavaScript: @langchain/core (scoped package)
  2. Deprecated patterns – Avoid these legacy approaches:

    • LLMChain → Use createAgent or createDeepAgent instead
    • ConversationChain → Use createAgent with message history
    • Direct AgentExecutor → Use createAgent or createDeepAgent
    • LCEL chains → Prefer createAgent for new projects
  3. Symbol paths use dots, not slashes

    • Correct: RunnableSequence.invoke
    • URL becomes: /python/langchain-core/RunnableSequence/invoke.md
  4. Version differences – The documentation reflects the latest stable versions. Check the version badge on package pages for exact versions.

Common Tasks

Using a Chat Model

from langchain_openai import ChatOpenAI
model = ChatOpenAI(model="gpt-4")
response = model.invoke("Hello!")

Search: ChatOpenAI, ChatAnthropic, ChatVertexAI

Building an Agent

from deepagent import createAgent

agent = createAgent(model="gpt-4", tools=[...])
response = agent.run("Your task here")

Search: createAgent, createDeepAgent, Agent

RAG (Retrieval-Augmented Generation)

Search: VectorStore, Retriever, create_retrieval_chain

Tools and Skills

Search: Tool, BaseTool, StructuredTool

Best Practices

  1. Use createAgent or createDeepAgent for building agent workflows
  2. Enable tracing with LangSmith for debugging
  3. Prefer specific integrations (e.g., langchain-openai) over generic interfaces
  4. Check inheritance – Many classes extend Runnable with shared methods

More Resources