代理会记忆吗?

使用 LlamaIndex 构建 Agentic 工作流

Laurie Voss

VP Developer Relations, LlamaIndex

无状态 vs. 记忆

代理:

  • 默认无状态
  • 会话间不保留信息
  • 每次独立运行

无记忆代理.gif

使用 LlamaIndex 构建 Agentic 工作流

记忆很重要

$$

  • 人类记忆可延续对话

  • 代理需要上下文才有用

记忆.png

使用 LlamaIndex 构建 Agentic 工作流

引入上下文

$$

  • 例:记住姓名

  • LlamaIndex 使用 Context 对象

    • 在多次运行间存储信息

$$

Context:代理的记事本/记忆库,用于存储稍后可回忆的信息。

上下文记忆.png

使用 LlamaIndex 构建 Agentic 工作流

从无状态到启用上下文

  • 无状态代理:

    • 回复后不保留任何信息
  • 启用上下文的代理:

    • 在多轮对话中保留记忆
    • 需手动启用
  • 在流程中传递信息至关重要

空白与上下文.png

使用 LlamaIndex 构建 Agentic 工作流

Passons à la pratique !

使用 LlamaIndex 构建 Agentic 工作流

Preparing Video For Download...