技术分享
🗒️Flowise实现自定义知识库并创建对话Agent
00 分钟
2025-5-19
2025-5-19
type
status
date
slug
summary
tags
category
icon
password
Language

简介

在构建 AI 客服时,常见需求是让机器人基于企业自己的知识文档提供准确回答。本文将手把手教你如何使用 Flowise + 向量数据库(如 Pinecone),构建一个结合 RAG 检索增强能力的智能客服 Agent。在 FlowiseAI 中,结合文档存储与向量数据库,构建一个由 RAG(检索增强生成)驱动的客户支持Agent。利用您的业务数据,创建一个能够准确回答客户问题的智能聊天机器人。

知识库管理

创建Document Store

比如这里创建一个"电商运营知识库"
notion image

添加文件

根据文件类型,加载文件并切块,比如我这里使用PDF
notion image
notion image

设置文本分割器

notion image

预览切块后的数据

notion image

完成加载

notion image

进行向量

  • 点击 Upsert Chunks
notion image
  • 开始逐一配置
notion image

设置向量模型

  • 这里我选择OpenAI
notion image

设置Vector Store

  • 这里我使用的是Pinecone
    • 可以去https://www.pinecone.io/注册一个账号,获取免费额度使用Vector Store
        1. 创建一个index
        1. 取一个名字
        1. 选择向量模型
            1. notion image
            notion image
        notion image
        1. 生成API Key
  • 回到Flowise,创建验证
      • notion image
  • Pinecone Index 填你在Pinecone创建的index 名称,可以填一个Namespece名称,之后也可以根据这个名称共用知识库的数据
notion image

文档记录管理器

Record Manager的作用是当你更新了你的知识库中的文件时,Record Manager可以根据你的变更自动增量的重新向量数据 ,这里我使用SQLite,建议生产环境使用MySQL或者Postgres
notion image

保存配置并更新

notion image
  • 可以看到有28块数据
notion image
  • Pinecone中可以页可以看到向量后的数据
notion image

测试检索

点击Test Retrieveval
下面是PDF的内容
notion image
测试结果
notion image

创建Agent实现调用知识库

创建一个Chatflows

notion image

Tool Agent

  • 选择一个Tool Agent
notion image

设置System Message

notion image

ChatOpenAI

  • 选择一个Chat Model类型的节点并连接到Tool Agent
notion image

Buffer Windows Memory

  • 为保证LLM在当前对话中有上下文,需要选择一个Memory类型的节点进行关联
notion image

Retrievever Tool

  • 选择检索工具关联到ToolAgent
notion image

Document Store(Vector)

  • 这个节点可以选择到之前创建的知识库,这里和Retrievever Tool关联
notion image

使用

保存之后点击对话图标开始使用
notion image

评论