Skip to content

[Feature]: 请求支持 ragflow #1099

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
RockChinQ opened this issue Feb 18, 2025 · 4 comments
Open

[Feature]: 请求支持 ragflow #1099

RockChinQ opened this issue Feb 18, 2025 · 4 comments
Labels
good first issue 新贡献者可以先尝试解决这些 / Good for beginners to get started

Comments

@RockChinQ
Copy link
Owner

这是一个?

新功能

详细描述

https://github.com/infiniflow/ragflow 是一个 rag 平台,通过 runner 支持 ragflow 以便在 LangBot 对话中使用 ragflow 的应用。

@RockChinQ RockChinQ marked this as a duplicate of #1105 Feb 20, 2025
@RockChinQ RockChinQ added the good first issue 新贡献者可以先尝试解决这些 / Good for beginners to get started label Mar 26, 2025
@xnge
Copy link

xnge commented May 26, 2025

hi @RockChinQ 我对在LangBot里集成RAGFlow很感兴趣,RAGFlow里面有和知识库对话的功能,我想集成到LangBot中的对话机器人里面去,比如在飞书里可以直接调用RAGFlow里面的对话接口,询问知识库的内容。
请教一下,我在LangBot里应该如何支持这样的功能,你能给我一些实现这个功能的开发建议和指引吗?我该使用哪种方式开发?使用LangBot的插件?

@RockChinQ
Copy link
Owner Author

@xnge 欢迎贡献!

LangBot 对于此类外部agent有很好的抽象层设计,你可以查看架构图 先了解你应该实现的组件位置(Runner),然后参考pkg/provider/runners/ 下每个runner的写法来集成ragflow。

  • 你可以直接fork主仓库代码并把ragflow的runner加入到主程序中然后提pr,不必以插件形式接入
  • 更多详细信息可以加开发群询问:1032327138

@xnge
Copy link

xnge commented May 26, 2025

@RockChinQ 感谢你的回复,

我再明确一下,我需要做的是:

  1. 类似实现一个 https://github.com/RockChinQ/LangBot/blob/master/pkg/provider/runners/localagent.py, 比如我参考 LocalAgentRunner 或者 difysvapi 的代码实现,开发一个ragflowapi,接口也都是localagent.py这里的接口,是吗?
  2. 然后再在流水线的界面上,添加一个 RAGFlow Service API 的Runner,是吗?
  3. 另外请教一下Runner的定义,Runner的意思是说,使用了这个流水线的机器人,都是用这个Runner去处理对话?不管是QQ,还是企微等等?

Image

@RockChinQ
Copy link
Owner Author

@xnge

  1. 关于你写的实现需要写的方法,可以看一下 localagent 那个类的父类。
  2. 对,你需要在 templates/metadata/pipeline/ai.yaml 里加上你的 ragflow 配置项schema,参考其他的来写。有一个很好的例子是 Feature add n8 n #1468 可以稍微参考一下这个pr的yaml写法。当然,它的前端写得有点复杂,理论上你不需要改前端。
  3. llm 不止局限于简单的一来一回对话,人们希望llm可以调用工具访问世界信息,所以 Agent 诞生了。Agent 的运行过程比较复杂:

一来一回对话:

User: xxxxxx
Assistant: xxxxxxxxxx

Agent 运行机制

User: xxxxxxxx
Assistant: {"tool_name": "get_weather", "city": "LA"}   // 请求 LangBot 使用工具
Tool: {"temperature": 30, "weather": "cloudy"}    // LangBot 调用工具并拼接工具返回值到消息列表,再次调用 LLM
Assistant: The weather is xxxxxxx

可以看到 Agent 需要调用工具,而且可能需要调用多个回合。而 Agent 的实现模式有很多种,就需要在这里做一个抽象:Runner。
LangBot 内置的 local-agent 可以组织用户配置好的提示词、工具等信息进行多回合 Agent 执行。
而现在需要接入 RAGFLow 的话,你需要确定:RagFlow 是一个 Agent 吗?如果是的话,就实现一个 Runner 来接入。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue 新贡献者可以先尝试解决这些 / Good for beginners to get started
Projects
None yet
Development

No branches or pull requests

2 participants