news 2026/8/28 7:26:58

(LangGraph教程)0. Welcome to the course!

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
(LangGraph教程)0. Welcome to the course!

https://academy.langchain.com/courses/intro-to-langgraph

https://github.com/shangxiang0907/langchain-academy

https://github.com/shangxiang0907/langchain-academy/blob/main/module-0/basics.ipynb

文章目录

  • Getting Set Up
    • Introduction
    • Setup
      • Python version
      • Clone repo
      • Create an environment and install dependencies
      • Running notebooks
      • Sign up for LangSmith
      • Set up OpenAI API key
      • Tavily for web search
      • Set up LangSmith Studio
      • Note: LangSmith Studio was formerly LangGraph Studio
    • Slack Community
  • Module 0 Resources
      • Getting Set Up (Video Guide)

Getting Set Up

中文:环境设置

Introduction

中文:简介

Welcome to LangChain Academy’s Introduction to LangGraph course!

欢迎来到 LangChain Academy 的 LangGraph 入门课程!

This course is divided into six modules, starting with the basics and gradually progressing to more advanced topics.

本课程分为六个模块,从基础知识开始,逐步深入到更高级的主题。

Each module includes video lessons to walk you through key concepts, along with corresponding notebooks.

每个模块都包含讲解关键概念的视频课程,以及与之对应的笔记本。

You’ll also find astudiosubdirectory in each module, featuring a set of relevant graphs that we’ll explore using the LangGraph API and Studio.

每个模块中还包含一个studio子目录,其中提供了一组相关的图;我们将使用 LangGraph API 和 Studio 对它们进行探索。


Setup

中文:设置

Here’s our recommended setup to get started with the course.

下面是我们建议的课程入门设置。

We’ll be using the set of notebooks located here.

我们将使用位于此处的一组笔记本。

If you prefer to download the notebooks manually, you can access a ZIP file here.

如果你希望手动下载这些笔记本,可以在此处获取 ZIP 文件。

Each module will also include links to the corresponding notebooks, with additional options to access them in Google Colab for a quick start.

每个模块还会提供相应笔记本的链接,并额外提供在 Google Colab 中打开的选项,方便你快速开始。

Python version

中文:Python 版本

Please make sure you’re using a Python version higher than 3.11 but lower than 3.14, specifically 3.11, 3.12, or 3.13.

请确保你使用的 Python 版本高于 3.11 且低于 3.14,具体可使用 3.11、3.12 或 3.13。

python3 --version

Clone repo

中文:克隆代码仓库

git clone https://github.com/langchain-ai/langchain-academy.git $ cd langchain-academy

Create an environment and install dependencies

中文:创建环境并安装依赖项

$ python3 -m venv lc-academy-env $ source lc-academy-env/bin/activate $ pip install -r requirements.txt

我ubuntu里装的是python3.14,用uv先装python3.13,不会影响默认的

uv pythoninstall3.13


然后把上面命令改成用:

python3.13-mvenv lc-academy-env


第一次报错了,不知道为啥

为了方便,可以:

  1. 按 Ctrl+Shift+P
  2. 选择 Python: Select Interpreter
  3. 选择或手动输入:/home/user/projects/langchain-academy/lc-academy-env/bin/python

Running notebooks

中文:运行笔记本

If you don’t have Jupyter set up, follow installation instructions here.

如果你尚未设置 Jupyter,请按照此处的安装说明操作。

$ jupyter notebook


Sign up for LangSmith

中文:注册 LangSmith

Create a LangSmith account and API key.

创建一个 LangSmith 账户和 API 密钥。

You can reference LangSmith docs here.

你可以在此处查看 LangSmith 文档。

Then, set

然后设置:

LANGSMITH_API_KEY="your-key" LANGSMITH_TRACING_V2=true LANGSMITH_PROJECT="langchain-academy" # If you are on the EU instance: LANGSMITH_ENDPOINT=https://eu.api.smith.langchain.com

代码注释翻译:# If you are on the EU instance:表示“如果你使用的是欧盟实例”。

in your environment.

在你的环境中完成上述设置。

https://docs.langchain.com/langsmith/observability-quickstart#prerequisites

参考文章:VSCode Python扩展自动加载.env环境变量机制(Python插件)python.terminal.useEnvFile

Set up OpenAI API key

中文:设置 OpenAI API 密钥

If you don’t have an OpenAI API key, you can sign up here.

如果你没有 OpenAI API 密钥,可以在此处注册。

Note that OpenAI no longer has a free tier.

请注意,OpenAI 已不再提供免费层级。

You will need to add funds to your OpenAI account.

你需要为 OpenAI 账户充值。

You can use other models.

你也可以使用其他模型。

Your results may differ from those in the course video, but that is not unusual in LLM development.

你的结果可能与课程视频中的结果不同,但这在 LLM 开发中并不罕见。

Be sure to set up keys and alter invocations for any alternate models.

如果使用其他模型,请务必设置相应密钥并修改调用方式。

Then, set

然后设置:

OPENAI_API_KEY

in your environment.

在你的环境中完成上述设置。

Tavily for web search

中文:使用 Tavily 进行网络搜索

Tavily Search API is a search engine optimized for LLMs and RAG, aimed at efficient, quick, and persistent search results.

Tavily Search API 是一款针对 LLM 和 RAG 优化的搜索引擎,旨在高效、快速且持续地提供搜索结果。

You can sign up for an API key here.

你可以在此处注册 API 密钥。

It’s easy to sign up and offers a generous free tier.

注册过程很简单,并且提供额度充足的免费层级。

Some lessons in Module 4 will use Tavily.

模块4中的部分课程会使用 Tavily。

Then, set

然后设置:

TAVILY_API_KEY

in your environment.

在你的环境中完成上述设置。

Set up LangSmith Studio

中文:设置 LangSmith Studio

Note: LangSmith Studio was formerly LangGraph Studio

中文:注意:LangSmith Studio 原名为 LangGraph Studio。

  • LangSmith Studio is a custom IDE for viewing and testing agents.
    • 中文:LangSmith Studio 是一个用于查看和测试智能体的定制 IDE。
  • Studio can be run locally and opened in your browser on Mac, Windows, and Linux.
    • 中文:在 Mac、Windows 和 Linux 上,Studio 都可以在本地运行并通过浏览器打开。
  • See documentation here.
    • 中文:请在此处查看文档。
  • Graphs for LangSmith Studio are in the module-x/studio/ folders.
    • 中文:LangSmith Studio 使用的图位于module-x/studio/文件夹中。
  • To start the local development server, run the following command in your terminal in the /studio directory each module:
    • 中文:若要启动本地开发服务器,请在每个模块的/studio目录中,通过终端运行以下命令:
langgraph dev

You should see the following output:

你应该会看到以下输出:

- 🚀 API: http://127.0.0.1:2024 - 🎨 Studio UI: https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024 - 📚 API Docs: http://127.0.0.1:2024/docs


https://aws.smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024

Open your browser and navigate to the Studio UI:https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024

打开浏览器并前往 Studio UI:https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024

  • To use Studio, you will need to create a .env file with the relevant API keys
    • 中文:若要使用 Studio,需要创建一个包含相关 API 密钥的.env文件。
  • Run this from the command line to create these files for module 1 to 6, as an example:
    • 中文:以下命令演示了如何通过命令行为模块1至模块6创建这些文件:
for i in {1..5}; do cp module-$i/studio/.env.example module-$i/studio/.env echo "OPENAI_API_KEY=\"$OPENAI_API_KEY\"" > module-$i/studio/.env done echo "TAVILY_API_KEY=\"$TAVILY_API_KEY\"" >> module-4/studio/.env

现在不需要执行截图中的循环命令。Studio 已经打开,而且页面显示绿色 Connected,说明本地开发服务运行正常。截图中的命令只负责给每个module-*/studio创建 .env,并不负责启动 Studio。但当前仓库已经改成让所有 Studio 统一读取根目录的 .env:"env": "../../.env"


Slack Community

中文:Slack 社区

If you’re interested in connecting with other learners, you can join our Slack Community here.

如果你希望与其他学习者交流,可以在此处加入我们的 Slack 社区。

If you have any questions, we encourage you to ask and explore in our community-run Forum.

如果你有任何问题,我们鼓励你在社区运营的论坛中提问和探索。

We encourage you to pay it forward within the community and help other learners.

我们鼓励你在社区中将善意传递下去,帮助其他学习者。

Please note that our Slack Community is not an official support channel.

请注意,我们的 Slack 社区并非官方支持渠道。

If you are a customer and need product support, reach out to support@langchain.dev.

如果你是客户并需要产品支持,请联系 support@langchain.dev。

Module 0 Resources

中文:模块0资源

Getting Set Up (Video Guide)

中文:环境设置(视频指南)

  • Notebook Reference: basics.ipynb
    • 中文:笔记本参考文件:basics.ipynb
  • Download Notebook onGitHub
    • 中文:在GitHub上下载笔记本。
  • View Notebook onGoogle Colab
    • 中文:在Google Colab上查看笔记本。
版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/8/28 7:25:48

快速幂算法精讲:从原理到实战,掌握高效指数运算与取模技巧

1. 项目概述:从一道题看透快速幂的核心价值如果你正在准备蓝桥杯的算法提高VIP部分,或者对“快速幂”这个概念感到既熟悉又有点模糊,那么这道“题目 2088: 蓝桥杯算法提高VIP-快速幂”绝对是你绕不开的一个关键节点。我第一次接触这类题目时&…

作者头像 李华
网站建设 2026/8/28 7:25:46

从AI剧到互动影游:用Flask与状态机构建动态剧情应用

最近 AI 圈有个很有意思的现象:一位中专学历的创作者,用一套 AI 工具链“手搓”出了一部爆款 AI 剧,不仅在国内平台刷屏,甚至引发了海外影视行业的关注。紧接着,这个 IP 又要往“互动影游”方向走。很多人都在问&#…

作者头像 李华
网站建设 2026/8/28 7:21:52

线性规划实战:从生产优化到MATLAB/LINGO求解与灵敏度分析

1. 从一道经典例题说起:线性规划到底在解决什么问题?如果你在搜索引擎里搜“线性规划”,大概率会看到一堆关于“运筹学”、“数学建模”、“优化”的学术定义,然后就是一大堆抽象的数学公式。这很容易让人望而却步,觉得…

作者头像 李华
网站建设 2026/8/28 7:20:48

潜态推理与视频世界模型:从像素预测到状态演化的建模实践

潜态推理和视频世界模型并不是最近才突然出现的概念。在视频生成、决策智能和机器人控制这类任务里,"模型能不能预判环境下一步会变成什么样"一直是核心问题。早期做法是直接让神经网络拟合下一帧像素,但这种做法在复杂场景里很快暴露出两个问…

作者头像 李华
网站建设 2026/8/28 7:20:29

ComfyUI与Wan2.2实现可控视频生成:背景保留与动作迁移实战

简介:在AI视频生成领域,可控性一直是核心挑战。其原理在于对视频内容进行解耦控制,将背景、主体和动作作为独立变量进行处理。这项技术的核心价值在于极大提升了生成内容的精准度和实用性,使得用户能够像导演一样指定角色在特定场…

作者头像 李华
网站建设 2026/8/28 7:18:29

蓝桥杯平面切分问题解析:从数学归纳到增量算法实现

1. 项目概述:从一道真题看平面几何的思维跃迁最近在整理蓝桥杯的历年真题时,我又翻出了那道经典的“平面切分”问题。这道题乍一看,像是初中数学里的找规律,但真正动手去解,尤其是想用程序高效、准确地求解时&#xff…

作者头像 李华