专栏名称: GitHubStore
分享有意思的开源项目
目录
相关文章推荐
三联生活周刊  ·  70后的我,学会做一个“退场”的父母 ·  21 小时前  
三联生活周刊  ·  越来越多的年轻人,开始“同居不领证”了? ·  21 小时前  
三联生活周刊  ·  孩子不想上学,大人不想上班,还有救吗? ·  2 天前  
王开东  ·  少年情怀总是诗 ·  2 天前  
王开东  ·  少年情怀总是诗 ·  2 天前  
为你读诗  ·  龙凤美玉,同心佑平安 ·  2 天前  
51好读  ›  专栏  ›  GitHubStore

从构思到成文帮你组织和撰写文档的多智能体系统Kiroku

GitHubStore  · 公众号  ·  · 2024-11-15 07:57

正文

项目简介

Kiroku 是一个多代理系统,可以帮助您组织和编写文档。


我开始写它是因为在斯坦福大学攻读博士学位期间,我必须经历一个正式的过程来撰写论文并最终完成论文,我尝试遵循这些步骤。不同的是,当时我是学生,我的导师正在审阅我的文档,我想到了:如果作者成为导师,而多智能体系统成为学生怎么办?


该流程有几个优点:

  • 它可以帮助您以更好的方式组织想法,因为您可以非常快速地生成一系列段落。

  • 它可以帮助您通过对消息的迭代评估来改变您的沟通方式

  • 最近,[ 1 ]建议LLMs可以通过与LLM讨论来帮助您解决复杂的主题。


(c) 导师和学生的PhDCommics ( www.phdcommics.com )


原始代码是从 Harrison Chase 和 Rotem Weiss [ 2 ] 的短期课程中获得的,但我相信甚至提示都与原始提示中的任何提示都不相似。不过,我确实认可并归功于他们我用作参考的原始代码。

运行之前

要运行 Kiroku,您需要 OPENAI_API_KEY 和 TAVILY_API_KEY。


要获取 OPENAI_API_KEY,您可以查看https://platform.openai.com/docs/quickstart 。


要获取 TAVILY_API_KEY,您可以查看网站https://app.tavily.com/sign-in ,然后单击“登录”。


您可能需要使用 direnv 等工具来按目录管理环境变量 OPENAI_API_KEY TAVILI_API_KEY 。当您在 Kiroku 项目目录中工作时,这将帮助您自动加载这些变量。 direnv 通过 WSL 支持 Linux、macOS 和 Windows。


安装

Kiroku 支持 Python 3.7 和 3.11 版本。

1.搭建虚拟环境

您可以使用Python的 venv 模块为依赖项创建隔离环境。这确保了干净的环境并避免与系统包发生冲突。

cd kirokupython3 -m venv venvsource venv/bin/activatepip install -r requirements.txt

2. PANDOC的安装

您需要安装 PANDOC。正如 Charles Ferreira Gonçalves 所指出的,在 macos 中,您可以通过执行以下命令来完成此操作。

brew instal pandoc

初始配置

初始配置在具有以下字段的 YAML 文件中指定:

  • title 是对标题或要使用的最终标题的建议(如果 suggest_title 为 false)。

  • suggest_title 打开基于您的原始标题的标题推荐。

  • generate_citations :如果为 true,它将生成引文和参考文献。

  • type_of_document :帮助 Kiroku 定义是否应该使用更多技术术语,或者我们是否正在尝试编写儿童故事。

  • area_of_paper :与 hypothesis 一起,它可以帮助 Kiroku 理解要写什么。

  • section_names :部分列表,如下例所示:

section_names:- Introduction- Related Work- Architecture of Kiroku- Results- Conclusions- References
  • number_of_paragraphs :指示 Kiroku 每个部分写那么多段落。

number_of_paragraphs:  "Introduction": 4  "Related Work": 7  "Architecture of Kiroku": 4  "Results": 4  "Conclusions": 3  -"References": 0
  • hypothesis 告诉 Kiroku 你想要建立的东西是好是坏,它会定义信息。

  • instructions :当您与给出诸如“简介的第一段应该讨论 ChaGPT 的发布所带来的革命”之类的说明的文档进行交互时,您可能需要将其中一些内容添加到说明中,以便在下一次迭代中,Kiroku 将遵守您的建议。在 Kiroku 中,此时 instructions 会附加到 hypothesis 中,因此您不会看到它们。我通常在每条指令后面加上 \n\n 以协助底层LLM 。

  • results :我通常把它放在这里,因为我稍后会填写它。

  • references 是您希望 Kiroku 在信息搜索阶段使用的参考。

  • number_of_queries 告诉 Kiroku 将向 Tavily 生成多少问题来搜索信息。

  • max_revisions 告诉 Kiroku 在分析反射结果时执行反射和文档写入的次数(请注意,将此文档设置为 1 表示不进行修订)。

  • temperature 是LLM的温度(通常我将其设置为一个较小的数字)。


最终的 YAML 如下:

title: "Writing Masterpieces when You Become the Adivisor"suggest_title: Truegenerate_citations: Truetype_of_document: "research seminal paper"area_of_paper: "AI and Computer Science"section_names:- Introduction- Related Work- Architecture- Results- Conclusions- Referencesnumber_of_paragraphs:  "Introduction": 4  "Related Work": 7  "Architecture": 4  "Results": 4  "Conclusions": 3  "References": 0hypothesis: "We want to show in this paper that we turn paper writers into 'advisors'and a multi-agent system into a 'advisee' who will observe the instructions by,interactively turning a course draft of a paper into a publication readydocument."instructions: "For the following instructions, you should use your own words.\n\nThe section 'Introduction', you should focus on:\n- In the first paragraph, you should discuss that the world has changesince the release of ChatGPT.\nIn the section 'Architecture', you should show the picture'/file=images/multi-agent.jpeg' to discuss we write a paper by defining atitle and hypothesis, writing topic sentences, expanding topic sentences intoparagraphs, writing the paragraphs, and finally reviewing what you have written."results: "This is an example on how you can put a results table.<table>                Normal Text Rate       Kiroku Rate         Experiment 1     3      9          Experiment 2     5      10   table>"references:- "Harrison Chase, Rotem Weiss. AI Agents in LangGraph. https://www.deeplearning.ai/short-courses/ai-agents-in-langgraph"number_of_queries: 8max_revisions: 1






请到「今天看啥」查看全文


推荐文章
三联生活周刊  ·  70后的我,学会做一个“退场”的父母
21 小时前
三联生活周刊  ·  越来越多的年轻人,开始“同居不领证”了?
21 小时前
王开东  ·  少年情怀总是诗
2 天前
王开东  ·  少年情怀总是诗
2 天前
为你读诗  ·  龙凤美玉,同心佑平安
2 天前
点点星光  ·  人,需要一个真心的异性朋友
7 年前
禅语心苑  ·  千金难买,知己一人
7 年前
牛熊交易室  ·  投资,就像骑在大象背上奔跑
7 年前