-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
39 lines (30 loc) · 866 Bytes
/
example.py
File metadata and controls
39 lines (30 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
"""
简单示例:快速体验学术文献调研 Agent
"""
from research_agent import create_workflow
def main():
# 创建工作流
app = create_workflow()
# 示例主题
topic = "large language models in healthcare"
print(f"主题: {topic}")
print("-" * 50)
# 执行调研
result = app.invoke({
"topic": topic,
"queries": [],
"documents": [],
"final_report": ""
})
# 打印报告
print(result["final_report"])
# 保存报告
output_file = "example_report.md"
with open(output_file, "w", encoding="utf-8") as f:
f.write(f"# 学术文献调研报告\n\n")
f.write(f"**研究主题**: {topic}\n\n")
f.write("---\n\n")
f.write(result["final_report"])
print(f"\n报告已保存到: {output_file}")
if __name__ == "__main__":
main()