DeepLiterature
DeepLiterature: A fully open-source intelligent research assistant that integrates search, code execution, link resolution, and information expansion, with multiple tools working together to facilitate scientific research.(DeepLiterature:全流程开源的智能科研助手,集成搜索、代码执行、链接解析和信息拓展,多工具协同助力科学研究。)
Install / Use
/learn @ScienceOne-AI/DeepLiteratureREADME
<a name="readme-top"></a>
<div align="center"> <img src="./assets/deep_literature_logo.svg" alt="Logo" width="600"> </br></br>English | 简体中文
</div> <span id='repo-introduction'/>📖 Introduction
DeepLiterature is an open-source science deep research framework, jointly launched by the Institute of Automation, Chinese Academy of Sciences; the National Science Library, Chinese Academy of Sciences; the Computer Network Information Center, Chinese Academy of Sciences; Beijing Wenge Technology Co., Ltd.; and Zidong Taichu (Beijing) Technology Co., Ltd. It aims to provide various tool support for intelligent agent systems. Currently, DeepLiterature supports four types of tools: Search Engine, Code Runner, Link Parser, and Information expander.
<span id='news'/>🔥 News
- [2025/03] DeepLiterature officially released, supporting tools such as Search Engine, Code Runner, Link Parser, and Information expander.
📑 Table of Contents
- <a href='#repo-introduction'>📖 Introduction</a>
- <a href='#news'>🔥 News</a>
- <a href='#table-of-contents'>📑 Table of Contents</a>
- <a href='#agent-framework'>🤖 Agent Framework</a>
- <a href='#flowchart'>Flowchart</a>
- <a href='#module-description'>Module Description</a>
- <a href='#tools-info'>Tool Library</a>
- <a href='#evaluation'>🏆 Evaluation</a>
- <a href='#case-study'>🎬 Case Study</a>
- <a href='#quickstart'>⚡ Quickstart</a>
- <a href='#code-base'>🗂️ Code Structure</a>
- <a href='#select-api'>⚙️ Configure API</a>
- <a href='#select-prompt'>📝 Select Prompt Template</a>
- <a href='#select-search-engine'>🔍 Configure Search Engine</a>
- <a href='#select-url-parser'>🖥️ Configure URL Parser</a>
- <a href='#select-llm'>✈️ Configure LLM</a>
- <a href='#select-code-runner'>💻 Configure Code Runner</a>
- <a href='#lanuch'>🚀 Launch Platform</a>
- <a href='#begin-chat'>💬 Start Chat</a>
- <a href='#todo-list'>📝 TODO</a>
- <a href='#acknowledgement'>🙏 Acknowledgement</a>
- <a href='#license'>📄 License</a>
🤖 Agent Framework
The core of DeepLiterature lies in building a multi-agent interactive collaboration framework, which integrates various tools and achieves flexible expansion and efficient collaboration through modular design.
<span id='flowchart'/>📊 Flowchart
Below is a schematic diagram of the main internal processes of the system, showing the information transfer and call flow between modules:
flowchart TD
A[Task📃] --> B[🤖 Planner]
B --> C[🧠 Optimizer]
C --> B
B --> D[🔍 Searcher]
D --> G[🧠 Discriminator]
G --> H[URL Parser 🔗]
H --> B
B --> E[🤖 Code Generator]
E --> F[🖥️ Code Runner]
F --> B
G --> B
F --> I[✒️ Writer]
B --> I
D --> I
H --> I
I --> J[📰 Publisher]
<span id='module-description'/>
Module Description
- Planner: Responsible for receiving user input, parsing requests, and coordinating module calls.
- Optimizer: Uses external search interfaces to retrieve and return relevant information summaries.
- Code Generator: Generates code based on the code description distributed by the planner, supporting multi-language environments.
- Code Runner: Executes the code generated by the code generator in a secure sandbox, supporting multi-language environments.
- Searcher: Uses search engines to retrieve relevant web content.
- Discriminator: Analyzes search result summaries and determines whether to obtain the full text to improve answer accuracy.
- URL Parser: Parses link content and retrieves the full text of web pages.
- Writer: Writes output raw data based on user instructions and obtained materials.
- Publisher: Processes the raw data from the writer to form output that meets user instructions.
🛠️ Tool Library
This framework integrates the following tool libraries to achieve the above agents:
- 🔍 Search Engine: Efficiently retrieves network information.
- 🖥️ Code Runner: Supports online code running and debugging.
- 🔗 Link Parser: Parses, verifies, and extracts data from links.
- 🧠 Information Expansion: Based on search results, determines whether the summary information is relevant; when the summary information is insufficient to answer the question, automatically obtains the full text.
🏆 Evaluation
We tested on the smolagents-benchmark, which aggregates subsets from multiple datasets: GAIA (32 items), MATH (50 items), SimpleQA (50 items). Below are the results of our DeepLiterature and smolagent(HF).
<div align="center"> <img src="./assets/benchmark.png" alt="Benchmark" width="500"> </div> <span id='case-study'/>🎬 Case Study
The following examples demonstrate the application effect of DeepLiterature in actual conversations, providing both Chinese and English versions (the following GIF files are for illustration only, please replace them with corresponding examples in actual use).
Chinese Example
<div align="center"> <img src="./assets/demo_zh_1.gif" alt="Logo" width="700"> </div>Query 1 (GPT-4o):分析2024年中国的电商公司,截至到Q3季度的盈利情况,可以按照季度对比,可以横向对比不同的公司。分析各个公司的市场份额情况。
<div align="center"> <img src="./assets/demo_zh_2.gif" alt="Logo" width="700"> </div>Query 2 (GPT-4o):帮我找到2024年中国生产总值top10的城市,以柱状图呈现top10的城市及生产总值。对比这些城市在过去三年的人口变化情况,以折线图的方式展示人口变化。
English Example
<div align="center"> <img src="./assets/demo_en_1.gif" alt="Logo" width="700"> </div>Query 1 (DeepSeek-R1):Statistics on the number of Nobel Prize winners by country in recent years, and analyze the age groups of Nobel Prize recipients.
<div align="center"> <img src="./assets/demo_en_2.gif" alt="Logo" width="700"> </div> <span id='quickstart'/>Query 2 (DeepSeek-R1):Identify the top 3 most profitable cloud providers globally. Use a bar chart to illustrate the profitability of these three companies. Locate the top 1 cloud provider and analyze its profit changes over the past three years.
⚡ Quickstart
<!-- [⚡Online Experience](https://xxxxxxxx) -->The following content will help you quickly deploy and experience DeepLiterature.
<span id='code-base'/>🗂️ Code Structure
DeepLiterature adopts a modular design, with the main directory structure as follows:
./src/
├── agents # Agent modules, defining different role agents and corresponding prompt templates
├── config # Configuration files, configurable for search engine API, web parsing, and code execution modules
├── llms # LLM invocation modules
├── logo # Front-end display library
├── service # Platform and REST-ful API services
├── tools # Executor module, which implements code runner and search engine
├── utils # General utility library
└── workflow # Task workflow modules
<span id='select-api'/>
⚙️ Configure API
- Configuration files are located in the
src/configs/directory, you can modify the default parameters as needed. - Each module provides a unified interface for configuration, see the documentation for each module.
📝 Select Prompt Template
-
Default prompt templates are provided in both Chinese and English.
-
Template files are stored in
src/agents/prompts/, users can customize them according to actual applications. The prompt file names correspond to the agent file names: for example,src/agents/orchestrator_agent.pycorresponds tosrc/agents/prompts/orchestrator_agent_prompts.py. -
Switch between Chinese and English prompt templates: through the
languageconfiguration inconfigs/config.yml.deepliterature: language: <LANG> # ["zh", "en"]
🔍 Configure Search Engine
-
Modify
src/configs/config.ymlto configure the search API key, request parameters, etc. -
Supports parallel calls to multiple search engines to improve retrieval efficiency and accuracy, with SerpAPI used by default.
search-engine: search_engine: "serp" serp: api_url: "https://serpapi.com/search" api_key: <YOUR_API_KEY> gl: <GOOGLE_LOCATION> # such as "cn" hl: <GOOGLE_LANGUAGE> # such as "zh-cn" -
SerpAPI is an API service that provides search engine results, allowing developers to integrate search engine functionalities like Google and Bing into their applications. It supports various parameter settings and can perform customized searches based on region and language. With SerpAPI, users can easily obtain Google search results without directly interacting with Google Search or dealing with complex crawlers and CAPTCHA issues. Specifically:
- gl: This parameter defines the country for using Google Search. It is a two-letter country code (e.g., us for the United States, uk for the United Kingdom, fr for France). See Google country page for more details.
- hl: This parameter defines the language for usin
