PaperAgent 2024年09月06日
kotaemon核心GraphRAG、Agent、多模态代码解读!
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

kotaemon是一个开源、强大且可定制化的RAGUI,它整合了混合索引(Vector、Keyword、GraphRAG)和复杂推理Agent(ReAct、ReWOO、MemoryGIST和GraphReader)等技术,并支持多模态功能。kotaemon的亮点在于其可定制化的RAGUI架构,允许用户根据需求调整索引方式、推理策略以及多模态数据处理方式。

😊 **混合索引:** kotaemon采用混合索引策略,将全文索引、矢量索引和GraphRAG结合起来,提高检索效率和准确性。GraphRAG是一种新的RAG范式,它利用图结构来表示文档之间的关系,从而增强检索结果的相关性。

🤔 **复杂推理Agent:** kotaemon实现了ReAct和ReWOO两种复杂的推理Agent,它们能够进行多步推理,并利用外部工具(如Google搜索、LLM、维基百科)获取信息。ReAct使用Thought、Action、ActionInput和Observation模式进行推理,而ReWOO则将推理过程与外部观察分离,提高了推理效率。

🎨 **多模态功能:** kotaemon支持多种模态数据的加载,包括HTML、Excel、非结构化数据等。它还提供了多模态测试功能,例如AdobeReader。

🚀 **可定制化:** kotaemon的RAGUI架构高度可定制化,用户可以根据自己的需求调整索引方式、推理策略、工具集以及多模态数据处理方式,使其适应不同的应用场景。

📚 **丰富的工具集:** kotaemon提供了丰富的工具集,包括Google搜索工具、LLM工具、维基百科工具等,用户可以根据需要自定义扩展工具集。

原创 PaperAgent 2024-09-06 10:19 湖北

可定制化RAG UI,混合索引(GraphRAG)、复杂推理Agent(ReAct、ReWOO、MemoryGIST 和 GraphReader)、多模态

要说最近RAG方面火热的项目当属kotaemon,短时间暴涨8k star

一个开源、清晰、强大且可定制的RAG UI

kotaemon的亮点是可定制化RAG UI,核心技术点是混合索引(Vector、Keyword、GraphRAG)、复杂推理Agent(ReAct、ReWOO、MemoryGIST 和 GraphReader)、多模态

混合索引(GraphRAG

混合索引主要是指:全文和矢量融合,这里还有一个选型就是集成了RAG的新范式:GraphRAG

看代码直接用的微软GraphRAG

检索后重排采用LLMReranker

RERANK_PROMPT_TEMPLATE = """Given the following question and context,return YES if the context is relevant to the question and NO if it isn't.
> Question: {question}> Context:>>>{context}>>>> Relevant (YES / NO):"""

复杂推理Agent

推理目前主要实现了reactrewoo,tools包括google搜索工具、llm工具、wikipedia工具,可以自定义扩展。

react还是经典的Thought、Action、Action Input、Observation模式

zero_shot_react_prompt = PromptTemplate(    template="""Answer the following questions as best you can. Give answer in {lang}. You have access to the following tools:{tool_description}Use the following format:
Question: the input question you must answerThought: you should always think about what to do
Action: the action to take, should be one of [{tool_names}]
Action Input: the input to the action, should be different from the action input of the same action in previous steps.
Observation: the result of the action
... (this Thought/Action/Action Input/Observation can repeat N times)#Thought: I now know the final answerFinal Answer: the final answer to the original input question
Begin! After each Action Input.
Question: {instruction}Thought:{agent_scratchpad} """)

rewoo(Reasoning WithOut Observation),该范式将推理过程与外部观察分离

planner的prompt模版

from kotaemon.llms import PromptTemplate
zero_shot_planner_prompt = PromptTemplate( template="""You are an AI agent who makes step-by-step plans to solve a problem under the help of external tools.For each step, make one plan followed by one tool-call, which will be executed later to retrieve evidence for that step.You should store each evidence into a distinct variable #E1, #E2, #E3 ... that can be referred to in later tool-call inputs.
##Available Tools##{tool_description}
##Output Format (Replace '<...>')###Plan1: <describe your plan here>#E1: <toolname>[<input here>] (eg. Search[What is Python])#Plan2: <describe next plan>#E2: <toolname>[<input here, you can use #E1 to represent its expected output>]And so on...
##Your Task##{task}
##Now Begin##""")

solver的prompt模版

zero_shot_solver_prompt = PromptTemplate(    template="""You are an AI agent who solves a problem with my assistance. I will provide step-by-step plans(#Plan) and evidences(#E) that could be helpful.Your task is to briefly summarize each step, then make a short final conclusion for your task. Give answer in {lang}.
##My Plans and Evidences##{plan_evidence}
##Example Output##First, I <did something> , and I think <...>; Second, I <...>, and I think <...>; ....So, <your conclusion>.
##Your Task##{task}
##Now Begin##""")

多模态

多模态体现在丰富的loader上面,多达十几种比如:html_loader.py、excel_loader.py、unstructured_loader.py等,可以借鉴用于其它场景哦

多模态测试,AdobeReader

https://github.com/Cinnamon/kotaemon

推荐阅读


欢迎关注我的公众号“PaperAgent”,每天一篇大模型(LLM)文章来锻炼我们的思维,简单的例子,不简单的方法,提升自己。

跳转微信打开

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

RAG RAGUI kotaemon 混合索引 复杂推理 多模态
相关文章