langchain-python-quickstart

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

LangChain Python quickstart

LangChain Python 快速入门

Follow the live docs — do not invent an alternate API from memory:
Fetch that page (Docs MCP or HTTP) and implement what it shows (weather agent +
create_agent
).
请遵循在线文档——不要凭记忆自行编写替代API:
获取该页面内容(通过Docs MCP或HTTP)并实现其中展示的功能(天气Agent +
create_agent
)。

Local setup constraints

本地设置约束

Apply these on top of the quickstart (they keep setup minimal and model-agnostic):
  1. Ask which provider/model to use. Showcase that LangChain is model-agnostic. Suggested prompt:
    Which model should this agent use? Pass a
    provider:model
    string — e.g.
    openai:gpt-5.5
    ,
    anthropic:claude-sonnet-5
    ,
    google_genai:gemini-2.5-flash-lite
    . Default if you're unsure:
    anthropic:claude-sonnet-5
    .
    Swap the quickstart's model string for their choice (or the default).
  2. Create a new directory (e.g.
    langchain-agent/
    ) and do all work there — do not pollute the open project.
  3. Only secret: the provider API key in
    .env
    (gitignored). No LangSmith / Tavily unless they ask. Prefer they edit
    .env
    themselves — don't paste keys into chat.
  4. Install the provider package needed for their model if the quickstart's base install isn't enough.
  5. Run the example, show output, then stop. Point to
    langchain-fundamentals
    for next steps.
在快速入门基础上应用以下规则(这些规则能让设置保持最简且与模型无关):
  1. 询问要使用的提供商/模型。展示LangChain的模型无关性。建议提示语:
    该Agent应使用哪个模型?请传入
    provider:model
    格式的字符串——例如
    openai:gpt-5.5
    anthropic:claude-sonnet-5
    google_genai:gemini-2.5-flash-lite
    。若不确定,默认值为:
    anthropic:claude-sonnet-5
    将快速入门中的模型字符串替换为用户选择的(或默认的)模型。
  2. 创建一个目录(例如
    langchain-agent/
    )并在其中完成所有操作——不要污染现有项目。
  3. 仅需保密的内容:
    .env
    文件中的提供商API密钥(已加入git忽略)。除非用户要求,否则不使用LangSmith / Tavily。建议用户自行编辑
    .env
    文件——不要在聊天中粘贴密钥。
  4. 如果快速入门的基础安装不足以支持所选模型,请安装该模型所需的提供商包。
  5. 运行示例,展示输出,然后停止。如需下一步操作,请参考
    langchain-fundamentals