我的观点一直坚持,要真正掌握一项技术并能从更高的维度"审判"它,单纯了解如何使用是不够的,你需要理解其背后的逻辑。因此,我将在这篇文章中指导你逐步理解各类型query的工作原理——我们会探讨一个query的输入过程、所经历的步骤以及最终传输给LLM的输入与LLM的输出都是什么。话不多说,Let's get started!
local
poetry run poe query --method local --root ./ragtest "草帽海贼团有哪些成员"
-----Entities----- id|entity|description|number of relationships 4|草帽一伙|草帽一伙 is a pirate crew with various members, each having unique roles and dreams. They sail the seas in pursuit of their individual goals. The crew was founded by 蒙奇·D·路飞 and is led by him. After the 蛋糕岛 incident, 甚平 joined the crew. They have achieved significant victories, including defeating 月光·莫利亚. At one point, their ship was protected by 巴索罗米·熊.|19 58|咚塔塔海贼团|咚塔塔海贼团是草帽大船团旗下的一个海贼团|7 65|新巨兵海贼团|新巨兵海贼团是草帽大船团旗下的一个海贼团|6 52|艾迪欧海贼团|艾迪欧海贼团是草帽大船团旗下的一个海贼团|6 45|八宝水军|八宝水军是草帽大船团旗下的一个海贼团|7 72|约塔玛利亚大船团|约塔玛利亚大船团是草帽大船团旗下的一个海贼团|0 240|九蛇海贼团|波雅·汉库克领导的海贼团。|1 117|白胡子海贼团|The "\u767d\u80e1\u5b50\u6d77\u8d3c\u56e2" is a pirate crew known for its significant influence and power, led by the formidable \u767d\u80e1\u5b50. Notably, \u9a6c\u6b47\u5c14\u00b7D\u00b7\u8482\u5947 was a member of the second division of this crew, highlighting the crew's prominence and the caliber of its members.|1 259|心脏海贼团|心脏海贼团 is the pirate crew led by 特拉法尔加·罗|1 41|巴托俱乐部|巴托俱乐部是草帽大船团旗下的一个海贼团|4 38|草帽大船团|The Straw Hat Grand Fleet (\u8349\u5e3d\u5927\u8239\u56e2) is a fleet of pirate crews that have pledged their loyalty to the Straw Hat Pirates (\u8349\u5e3d\u4e00\u4f19). This grand fleet includes various pirate crews, such as the Beautiful Pirates led by Cavendish (\u5361\u6587\u8fea\u8bb8). Overall, the Straw Hat Grand Fleet is a formidable pirate alliance.|8 236|太阳海贼团|The entity "\u592a\u9633\u6d77\u8d3c\u56e2" is a pirate group led by Feisher Tag, who once escorted Clara back home.|2 93|多林格|多林格是罗杰海贼团的船员|0 243|巴基海贼团|The 巴基海贼团 is the pirate crew led by 巴基. This group is known for its activities under the leadership of 巴基, who is a prominent figure in their operations.|1 63|兰博|兰博是咚塔塔海贼团的船员|1 68|罗德|罗德是新巨兵海贼团的航海士|1 60|卡布|卡布是咚塔塔海贼团的船员|1 120|红发海贼团|红发海贼团是红发的势力|0 121|黑胡子海贼团|The 黑胡子海贼团 (Blackbeard Pirates) is the pirate crew led by 马歇尔·D·蒂奇 (Marshall D. Teach). The 黑胡子海贼团 is known for its formidable power and influence, often referred to as 黑胡子 (Blackbeard)'s force.|1 69|戈尔德巴古|戈尔德巴古是新巨兵海贼团的厨师|1
基于选中的Entity获取对应的relationships内容:
-----Relationships----- id|source|target|description|weight|rank|links 26|草帽一伙|草帽大船团|草帽大船团 is a fleet of pirate crews that have pledged their loyalty to the 草帽一伙|1.0|27|3 62|草帽大船团|咚塔塔海贼团|咚塔塔海贼团是草帽大船团旗下的一个海贼团|1.0|15|3 63|草帽大船团|新巨兵海贼团|新巨兵海贼团是草帽大船团旗下的一个海贼团|1.0|14|3 0|蒙奇·D·路飞|草帽一伙|蒙奇·D·路飞是草帽一伙的船长和创立者|1.0|30|1 20|草帽一伙|甚平|The entity "草帽一伙" (Straw Hat Crew) is a notable group that includes the character "甚平" (Jinbe). After the Cake Island incident, Jinbe joined the Straw Hat Crew as the ninth member. He serves as the helmsman of the crew, contributing his skills and experience to their adventures.|3.0|26|1 29|草帽一伙|特拉法尔加·罗|After allying with the 草帽一伙 in 庞克哈萨德, 特拉法尔加·罗 voluntarily gave up his 七武海 title|2.0|24|1 12|草帽一伙|罗罗诺亚·索隆|罗罗诺亚·索隆是草帽一伙的战斗员|1.0|23|1 15|草帽一伙|山治|山治是草帽一伙的厨师|1.0|23|1 23|草帽一伙|卡文迪许|卡文迪许 is a member of the Straw Hat Grand Fleet|1.0|23|1 18|草帽一伙|弗兰奇|弗兰奇 is the shipwright of the 草帽一伙 and joined as the seventh member|1.0|22|1 19|草帽一伙|布鲁克|布鲁克 is the musician of the 草帽一伙 and joined as the eighth member|1.0|22|1 21|草帽一伙|前进·梅利号|前进·梅利号 was the first official pirate ship of the 草帽一伙|1.0|22|1 22|草帽一伙|千里阳光号|千里阳光号 is the second pirate ship of the 草帽一伙|1.0|22|1 27|草帽一伙|巴索罗米·熊|巴索罗米·熊曾守护草帽一伙的船。|1.0|22|1 28|草帽一伙|月光·莫利亚|月光·莫利亚 was defeated by the 草帽一伙|2.0|22|1 13|草帽一伙|娜美|娜美是草帽一伙的航海士|1.0|21|1 14|草帽一伙|乌索普|乌索普是草帽一伙的狙击手|1.0|21|1 16|草帽一伙|托尼托尼·乔巴|托尼托尼·乔巴 is the doctor of the 草帽一伙 and joined as the fifth member|1.0|21|1 17|草帽一伙|妮可·罗宾|妮可·罗宾 is the archaeologist of the 草帽一伙 and joined as the sixth member|1.0|21|1 24|草帽一伙|ALL BLUE|ALL BLUE is the dream destination of Sanji, a member of the 草帽一伙|1.0|21|1 25|草帽一伙|七水之都|七水之都 is the city where the 草帽一伙's second ship, the 千里阳光号, was built|1.0|21|1 79|咚塔塔海贼团|雷欧|雷欧是咚塔塔海贼团的船长|1.0|8|1 80|咚塔塔海贼团|卡布|卡布是咚塔塔海贼团的船员|1.0|8|1 81|咚塔塔海贼团|比安|比安是咚塔塔海贼团的船员|1.0|8|1 82|咚塔塔海贼团|薇卡|薇卡是咚塔塔海贼团的船员|1.0|8|1 83|咚塔塔海贼团|兰博|兰博是咚塔塔海贼团的船员|1.0|8|1 84|咚塔塔海贼团|乌索兰度号|乌索兰度号是咚塔塔海贼团的船只|1.0|8|1 85|新巨兵海贼团|海尔丁|海尔丁是新巨兵海贼团的船长|1.0|7|1 86|新巨兵海贼团|斯坦森|斯坦森是新巨兵海贼团的船匠|1.0|7|1 87|新巨兵海贼团|罗德|罗德是新巨兵海贼团的航海士|1.0|7|1
{'answer': 'The defeat of 月光·莫利亚 by 草帽一伙 is a significant achievement that underscores their strength and capability. This victory boosted their reputation and demonstrated their ability to overcome formidable adversaries [Data: Reports (26)].', 'score': 85}
把第二步获取到的大模型返回的结果列表按照score从高到低排序作为report_data:
----Analyst 1---- Importance Score: 90 草帽一伙 is the central entity in their community, led by 蒙奇·D·路飞. The crew includes various members with unique roles and dreams, such as 罗罗诺亚·索隆 (战斗员), 山治 (厨师), and 娜美 (航海士). Their influence is significant, as they have achieved notable victories, including defeating 月光·莫利亚 [Data: Reports (26)].
----Analyst 1---- Importance Score: 85 草帽一伙 has significant relationships with other entities, including 巴索罗米·熊, who once protected their ship, and 甚平, who joined after the 蛋糕岛 incident. These relationships enhance their strength and influence [Data: Reports (26)].
----Analyst 1---- Importance Score: 85 The defeat of 月光·莫利亚 by 草帽一伙 is a significant achievement that underscores their strength and capability. This victory boosted their reputation and demonstrated their ability to overcome formidable adversaries [Data: Reports (26)].
----Analyst 1---- Importance Score: 80 草帽一伙's second ship, 千里阳光号, was built in 七水之都 with the help of the Galley-La Company. This ship replaced the 前进·梅利号 and continues to serve as the crew's vessel, highlighting its importance within the community [Data: Reports (26)].
----Analyst 1---- Importance Score: 80 草帽大船团 is a fleet of pirate crews loyal to 草帽一伙. This alliance significantly boosts the crew's power and influence, as they can call upon a large number of allies in times of need [Data: Reports (26)].
一种是 Local Search ,用于处理具体的、相对关注细节的问题。这种 query 时使用的上下文内容主要是知识图谱中的内容和原始的 Text Units 。把这些信息合并后,一次构建上下文调用 LLM 进行推理,并且一次 Local Search 只会调用一次 LLM,但是因为要送给LLM的信息比较多,所以也比正常的RAG要花更多token。
另一种是 Global Search ,主要用于处理摘要总结类、相对抽象的问题。query 时使用 Community Report ,由于 Community Report 的 token 量大,无法一次放入上下文中,为了避免信息丢失,采用了 Map-Reduce 的方式。Global Search调用了多次LLM, 耗费了大量token.