|
|
1 месяц назад | |
|---|---|---|
| .. | ||
| backend | 1 месяц назад | |
| frontend | 1 месяц назад | |
| staged-skills | 1 месяц назад | |
| .env.example | 1 месяц назад | |
| .gitignore | 1 месяц назад | |
| README.md | 1 месяц назад | |
| benchmark_index.py | 1 месяц назад | |
| main.ipynb | 1 месяц назад | |
| pipeline_walkthrough.html | 1 месяц назад | |
| plan.docx | 1 месяц назад | |
| requirements.txt | 1 месяц назад | |
| run_backend.py | 1 месяц назад | |
| smoke_test_hello_agents.py | 1 месяц назад | |
一个面向研究生的多 Agent 协作系统:批量阅读本地 PDF 论文 → 漏斗式信息收敛 → 识别研究空白 → 生成 2-3 个可落地的创新点与完整实验方案。
tool_choice="auto",模型自主选工具(10+ 工具)HelloAgentsLLM,工具经桥接注册为框架 ToolRegistry,Reflexion 自校验由框架 SimpleAgent 执行,复杂步骤可切换框架 ReActAgent 调度plan.docx 信息收敛架构 ┌─────────────────────────────────────┐
│ Controller (Plan-and-Execute) │
└──────────────┬──────────────────────┘
│ 动态调度
┌──────────────┬───────┼────────┬─────────────┐
▼ ▼ ▼ ▼ ▼
┌──────────┐ ┌──────────┐ ... ┌──────────┐ ┌──────────────┐
│ Parser │ │ Extractor│ │ Gap │ │ Evaluator │
└──────────┘ └──────────┘ │ Analyzer│ └──────────────┘
└──────────┘
▲ ▲ ▲
│ │ Reflexion 自校验 │
└──────────────┴───────────────────────┘
七步漏斗主链路:
① PDF 解析 → ② 结构化抽取 → ③ 向量索引
→ ④ 跨论文 Gap 识别 → ⑤ 创新点生成
→ ⑥ 实验方案设计 → ⑦ 整合研究报告
paper-agent-trae/
├── backend/ # FastAPI 后端
│ ├── agents/ # Controller + 6 专职 Agent + HelloAgents 框架 Agent 封装
│ ├── llm/ # HelloAgentsLLM 客户端 + Function Calling 循环
│ ├── tools/ # Function Calling 工具集(10+ 工具)+ HelloAgents 工具桥接
│ ├── rag/ # Embedding + Chroma + BM25 混合搜索
│ ├── memory/ # 对话记忆 + 长期知识记忆
│ ├── orchestrator/ # 工作流编排 + Reflexion
│ ├── evaluator/ # 评估体系(质量评分 + 调用追踪)
│ ├── api/ # FastAPI 异步接口
│ ├── models/ # Pydantic Schema
│ └── config.py # 全局配置
├── frontend/ # React + Vite 前端
│ ├── src/
│ │ ├── components/ # 报告视图 / 进度条 / 评估面板
│ │ ├── App.tsx
│ │ └── api.ts
│ └── package.json
├── data/ # 向量库 / 缓存 / 报告(运行时生成)
├── .env.example # 环境变量样例
├── .gitignore
├── run_backend.py # 启动入口
└── plan.docx # 漏斗式架构原始设计文档
git clone https://github.com/jphJack/PaperMind-Agent.git
cd PaperMind-Agent
# 复制环境变量样例
cp .env.example .env
# 编辑 .env,填入 DEEPSEEK_API_KEY
# 推荐 Python 3.12
pip install -r backend/requirements.txt # 含 hello-agents 框架
python run_backend.py
# 服务监听 http://0.0.0.0:8000
cd frontend
npm install
npm run dev
# 浏览器访问 http://localhost:5173
| 工具 | 功能 |
|---|---|
scan_folder |
扫描目标文件夹收集 PDF |
parse_pdf |
PyMuPDF 解析 + 章节结构保留 |
extract_paper_structure |
强制 JSON 输出固定 schema |
build_vector_index |
章节分块 → BGE-m3 → Chroma 入库 |
hybrid_search |
向量相似度 + BM25 关键词混合检索 |
analyze_gaps |
跨论文综合分析,识别四类 Gap 信号 |
generate_innovations |
创新点生成与三维评分筛选 |
design_experiments |
生成可执行实验方案 |
web_search |
近 1-2 年新颖性去重 |
save_memory / load_memory |
Memory 读写 |
每篇论文抽取为如下 JSON(节选):
{
"title": "...",
"task": "...",
"method": "...",
"key_contributions": ["..."],
"datasets": ["..."],
"metrics": ["..."],
"results": "...",
"limitations": ["..."],
"future_work": ["..."],
"source_sections": {
"method": ["3.1", "3.2"],
"limitations": ["6.2"]
}
}
source_sections 字段保证所有结论可回溯到原文具体章节,避免 LLM 编造。
最终报告附带三类评估指标:
完整配置见 .env.example,核心项:
| 变量 | 说明 | 默认值 |
|---|---|---|
DEEPSEEK_API_KEY |
DeepSeek API Key(必填) | - |
DEEPSEEK_MODEL |
模型名 | deepseek-chat |
LLM_TEMPERATURE |
HelloAgentsLLM 采样温度 | 1.0 |
EMBEDDING_MODEL |
本地 Embedding 模型 | BAAI/bge-m3 |
CHROMA_PATH |
向量库路径 | ./data/chroma |
CONFIDENCE_THRESHOLD |
Reflexion 置信度阈值 | 0.7 |
MAX_CONCURRENT_PAPERS |
并发抽取数 | 5 |
TOOL_MAX_RETRIES |
工具调用最大重试次数 | 3 |
严格遵循 plan.docx 定义的漏斗式信息收敛架构:
后端:Python 3.12 · FastAPI · HelloAgents 框架(HelloAgentsLLM / SimpleAgent / ReActAgent / ToolRegistry) · OpenAI SDK(兼容 DeepSeek)· ChromaDB · sentence-transformers · PyMuPDF · rank-bm25 · Pydantic · SSE
前端:React 18 · Vite 5 · TypeScript · react-markdown
AI:DeepSeek-chat · BAAI/bge-m3 Embedding
PaperMind 构建在 HelloAgents 框架之上,框架能力在三个层面落地:
| 层次 | 框架组件 | 集成方式 |
|---|---|---|
| LLM 层 | HelloAgentsLLM |
backend/llm/client.py 中 DeepSeekClient 底层由框架 LLM 驱动,OpenAI 兼容适配器自动识别 DeepSeek,全部模型调用经框架发出 |
| 工具层 | Tool / ToolRegistry / ToolResponse |
backend/tools/hello_agents_bridge.py 将 10+ 项目工具桥接为框架原生 Tool(ToolResponse 协议、熔断器保护),供框架 Agent 直接调度 |
| Agent 层 | SimpleAgent / ReActAgent |
backend/agents/hello_agents_runner.py 封装框架 Agent:Reflexion 质量审核由 SimpleAgent 执行;ReActAgent 携带桥接工具集可对任意步骤做框架原生推理调度 |
from hello_agents import HelloAgentsLLM, ReActAgent
from backend.tools.registry import build_default_registry
from backend.tools.hello_agents_bridge import build_hello_agents_registry
llm = HelloAgentsLLM() # 经 DeepSeekClient 配置模型/密钥/地址
agent = ReActAgent(
"GapAnalyzer",
llm,
tool_registry=build_hello_agents_registry(build_default_registry()),
system_prompt="你是研究空白识别专家……",
)
result = await agent.arun("分析这些论文并识别研究空白")
MIT
本项目为人工智能专业研究生的「Agent 开发深度理解」项目作品,旨在展示主流 Agent 工程能力(推理框架、多智能体协作、Function Calling、RAG、Memory、动态编排、评估体系)的完整落地。