Kiroku:模拟学生与导师间互动、 组织和撰写文档的多智能体系统

247 阅读4分钟

❤️ 如果你也关注大模型与 AI 的发展现状,且对大模型应用开发非常感兴趣,我会快速跟你分享最新的感兴趣的 AI 应用和热点信息,也会不定期分享自己的想法和开源实例,欢迎关注我哦!

🥦 微信公众号|搜一搜:蚝油菜花 🥦


🚀 快速阅读

  1. Kiroku 是一个多智能体系统,用于帮助用户组织和撰写文档。
  2. 它通过模拟导师与学生之间的互动,加速文档的构思和成文过程。
  3. 用户可以通过 YAML 文件自定义文档的结构和内容,使其适用于多种应用场景。

正文(附运行示例)

Kiroku 是什么

kiroku.png

Kiroku 是一个多智能体系统,旨在帮助用户组织和撰写文档。它的灵感来源于创始人在斯坦福大学攻读博士期间的学术写作经历。Kiroku 模拟了导师与学生之间的互动,帮助用户快速生成段落、优化沟通方式,并在迭代评估中提升信息传递效果。用户可以通过 YAML 文件自定义文档结构和内容,使 Kiroku 成为一个灵活、高效的写作助手,特别适合需要遵循严格格式的学术写作。

Kiroku 的主要功能

  • 文档组织与撰写:Kiroku 帮助用户从构思到成文,组织思路并撰写文档。
  • 模拟导师-学生互动:基于模拟学术写作中的导师和学生关系,Kiroku 协助用户迭代改进文档。
  • 快速生成段落:用户可以迅速生成一系列段落,加速文档的初步构建。
  • 自定义文档结构:用户可以通过 YAML 文件自定义文档的结构和内容,适应不同的写作需求。

Kiroku 的技术原理

  • 多智能体系统:Kiroku 基于多智能体系统架构,每个智能体扮演不同的角色,协同工作完成写作任务。
  • 自然语言处理(NLP):Kiroku 利用 NLP 技术理解和生成自然语言文本,辅助写作。
  • 机器学习(ML):Kiroku 使用机器学习算法学习用户的写作习惯和偏好,提供个性化的写作建议。
  • YAML 配置:Kiroku 使用 YAML 文件作为配置语言,支持用户定义文档的结构和内容,增加系统的灵活性。

如何运行 Kiroku

1. 获取 API 密钥

要运行 Kiroku,你需要获得 OPENAI_API_KEY 和 TAVILY_API_KEY。

2. 设置环境变量

建议使用 direnv 管理环境变量 OPENAI_API_KEYTAVILY_API_KEY,以便在 Kiroku 项目目录中自动加载这些变量。

3. 安装依赖

Kiroku 支持 Python 3.7 至 3.11 版本。创建虚拟环境并安装依赖:

cd kiroku
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

4. 配置 YAML 文件

初始配置文件包含以下字段:

  • title:文档标题建议或最终标题(如果 suggest_title 为 false)。
  • suggest_title:开启基于原始标题的标题推荐。
  • generate_citations:是否生成引用和参考文献。
  • type_of_document:文档类型,帮助 Kiroku 决定术语和技术含量。
  • area_of_paper:论文领域,与 hypothesis 一起帮助 Kiroku 理解写作内容。
  • section_names:文档各部分名称列表。
  • number_of_paragraphs:每部分的段落数量。
  • hypothesis:论文的核心假设或观点。
  • instructions:用户与文档交互时的指令,用于迭代改进。
  • results:实验结果,后期填充。
  • references:Kiroku 在搜索阶段使用的参考文献。
  • number_of_queries:Kiroku 将生成的查询数量。
  • max_revisions:Kiroku 进行反思和文档写作的次数。
  • temperature:LLM 温度参数。

示例 YAML 文件:

title: "Writing Masterpieces when You Become the Advisor"
suggest_title: True
generate_citations: True
type_of_document: "research seminal paper"
area_of_paper: "AI and Computer Science"
section_names:
- Introduction
- Related Work
- Architecture
- Results
- Conclusions
- References
number_of_paragraphs:
  "Introduction": 4
  "Related Work": 7
  "Architecture": 4
  "Results": 4
  "Conclusions": 3
  "References": 0
hypothesis: "
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 ready
document.
"
instructions: "
For the following instructions, you should use your own words.
\n\n
The section 'Introduction', you should focus on:
\n
- In the first paragraph, you should discuss that the world has changed
since the release of ChatGPT.
\n
In the section 'Architecture', you should show the picture
'/file=images/multi-agent.jpeg' to discuss we write a paper by defining a
title and hypothesis, writing topic sentences, expanding topic sentences into
paragraphs, writing the paragraphs, and finally reviewing what you have written.
"
results: "
This is an example on how you can put a results table.
<table>
  <tr>
      <td> </td>
      <td> Normal Text Rate</td>
      <td> Kiroku Rate</td>
  </tr>
  <tr>
    <td> Experiment 1</td>
    <td> 3 </td>
    <td> 9 </td>
  </tr>
  <tr>
    <td> Experiment 2</td>
    <td> 5 </td>
    <td> 10 </td>
  </tr>
</table>
"
references:
- "Harrison Chase, Rotem Weiss. AI Agents in LangGraph. https://www.deeplearning.ai/short-courses/ai-agents-in-langgraph"
number_of_queries: 8
max_revisions: 1
temperature: 0.1

5. 运行 Kiroku

推荐在项目目录下运行 Kiroku:

cd {Kiroku 目录}
KIROKU_PROJECT_DIRECTORY=`pwd`/proj ./kiroku

打开浏览器,访问 localhost:7860 即可使用 Kiroku。

资源

  1. GitHub 仓库:github.com/cnunescoelh…

❤️ 如果你也关注大模型与 AI 的发展现状,且对大模型应用开发非常感兴趣,我会快速跟你分享最新的感兴趣的 AI 应用和热点信息,也会不定期分享自己的想法和开源实例,欢迎关注我哦!

🥦 微信公众号|搜一搜:蚝油菜花 🥦