Auto-Draft 开源项目使用教程
auto-draft基于GPT4的文献总结工具. 项目地址:https://gitcode.com/gh_mirrors/au/auto-draft
1. 项目的目录结构及介绍
Auto-Draft 项目的目录结构如下:
auto-draft/
├── auto_backgrounds.py
├── prompts/
│ └── instructions.json
├── outputs/
│ └── Playing_Atari_with_Deep_Reinforcement_Learning.pdf
├── requirements.txt
├── LICENSE
└── README.md
目录结构介绍
auto_backgrounds.py
: 项目的启动文件,用于生成学术论文。prompts/
: 包含生成论文的指导文件instructions.json
。outputs/
: 包含生成的论文示例,如Playing_Atari_with_Deep_Reinforcement_Learning.pdf
。requirements.txt
: 项目依赖文件,列出了运行项目所需的 Python 包。LICENSE
: 项目的开源许可证文件。README.md
: 项目的说明文档。
2. 项目的启动文件介绍
auto_backgrounds.py
是项目的启动文件,主要功能是生成学术论文。以下是该文件的主要内容和功能介绍:
# auto_backgrounds.py
import os
import json
from auto_draft import generate_paper
# 设置 OpenAI API 密钥
os.environ["OPENAI_API_KEY"] = "your_openai_api_key"
# 读取指导文件
with open("prompts/instructions.json", "r") as f:
instructions = json.load(f)
# 生成论文
generate_paper(instructions)
功能介绍
- 设置 OpenAI API 密钥:确保项目能够调用 OpenAI 的 API。
- 读取指导文件:加载
prompts/instructions.json
中的生成指导。 - 生成论文:根据指导文件生成学术论文。
3. 项目的配置文件介绍
项目的配置文件主要是 prompts/instructions.json
,该文件定义了生成论文的指导信息。以下是该文件的示例内容:
{
"title": "论文标题",
"sections": [
{
"section_title": "引言",
"content": "引言内容"
},
{
"section_title": "方法",
"content": "方法内容"
},
{
"section_title": "实验",
"content": "实验内容"
},
{
"section_title": "结论",
"content": "结论内容"
}
]
}
配置文件介绍
title
: 论文的标题。sections
: 论文的各个章节,每个章节包含section_title
和content
。
通过修改 instructions.json
文件,可以自定义生成的论文内容和结构。
auto-draft基于GPT4的文献总结工具. 项目地址:https://gitcode.com/gh_mirrors/au/auto-draft