Skip to content

GPT based autonomous agent that does online comprehensive research on any given topic

License

Notifications You must be signed in to change notification settings

llmlocal/gpt-researcher

Β 
Β 

Repository files navigation

πŸ”Ž GPT Researcher

Official Website Discord Follow

GitHub Repo stars Twitter Follow PyPI version

GPT Researcher is an autonomous agent designed for comprehensive online research on a variety of tasks.

The agent can produce detailed, factual and unbiased research reports, with customization options for focusing on relevant resources, outlines, and lessons. Inspired by the recent Plan-and-Solve and RAG papers, GPT Researcher addresses issues of speed, determinism and reliability, offering a more stable performance and increased speed through parallelized agent work, as opposed to synchronous operations.

Our mission is to empower individuals and organizations with accurate, unbiased, and factual information by leveraging the power of AI.

Why GPT Researcher?

  • To form objective conclusions for manual research tasks can take time, sometimes weeks to find the right resources and information.
  • Current LLMs are trained on past and outdated information, with heavy risks of hallucinations, making them almost irrelevant for research tasks.
  • Solutions that enable web search (such as ChatGPT + Web Plugin), only consider limited resources and content that in some cases result in superficial conclusions or biased answers.
  • Using only a selection of resources can create bias in determining the right conclusions for research questions or tasks.

Architecture

The main idea is to run "planner" and "execution" agents, whereas the planner generates questions to research, and the execution agents seek the most related information based on each generated research question. Finally, the planner filters and aggregates all related information and creates a research report.

The agents leverage both gpt3.5-turbo and gpt-4-turbo (128K context) to complete a research task. We optimize for costs using each only when necessary. The average research task takes around 3 minutes to complete, and costs ~$0.1.

More specifically:

  • Create a domain specific agent based on research query or task.
  • Generate a set of research questions that together form an objective opinion on any given task.
  • For each research question, trigger a crawler agent that scrapes online resources for information relevant to the given task.
  • For each scraped resources, summarize based on relevant information and keep track of its sources.
  • Finally, filter and aggregate all summarized sources and generate a final research report.

Demo

gpt-researcher-demo.mp4

Tutorials

Features

  • πŸ“ Generate research, outlines, resources and lessons reports
  • 🌐 Aggregates over 20 web sources per research to form objective and factual conclusions
  • πŸ–₯️ Includes an easy-to-use web interface (HTML/CSS/JS)
  • πŸ” Scrapes web sources with javascript support
  • πŸ“‚ Keeps track and context of visited and used web sources
  • πŸ“„ Export research reports to PDF and more...

πŸ“– Documentation

Please see here for full documentation on:

  • Getting started (installation, setting up the environment, simple examples)
  • How-To examples (demos, integrations, docker support)
  • Reference (full API docs)
  • Tavily API integration (high-level explanation of core concepts)

Quickstart

Step 0 - Install Python 3.11 or later. See here for a step-by-step guide.


Step 1 - Download the project and navigate to its directory. You'll encounter two options: Virtual Environment and Poetry. Select either Step-2 or Step-3 based on your familiarity with each.:

git clone https://github.com/assafelovic/gpt-researcher.git
cd gpt-researcher

Step 2 - πŸŒπŸŒ€ Virtual Environment πŸ›‘οΈ.

Establishing the Virtual Environment with Activate/Deactivate configuration

Create a virtual environment using the venv package with the environment name <your_name>, for example, env. Execute the following command in the PowerShell/CMD terminal:

python -m venv env

To activate the virtual environment, use the following activation script in PowerShell/CMD terminal:

.\env\Scripts\activate

To deactivate the virtual environment, run the following deactivation script in PowerShell/CMD terminal:

deactivate

Install the dependencies for a Virtual environment

After activating the env environment, install dependencies using the requirements.txt file with the following command:

python -m pip install -r requirements.txt

Step 3 - πŸ“œπŸŽ­ Poetry πŸ“

Establishing the Poetry dependencies and virtual environment with Poetry version ~1.7.1

Install project dependencies and simultaneously create a virtual environment for the specified project. By executing this command, Poetry reads the project's "pyproject.toml" file to determine the required dependencies and their versions, ensuring a consistent and isolated development environment. The virtual environment allows for a clean separation of project-specific dependencies, preventing conflicts with system-wide packages and enabling more straightforward dependency management throughout the project's lifecycle.

poetry install

Activate the virtual environment associated with a Poetry project

By running this command, the user enters a shell session within the isolated environment associated with the project, providing a dedicated space for development and execution. This virtual environment ensures that the project dependencies are encapsulated, avoiding conflicts with system-wide packages. Activating the Poetry shell is essential for seamlessly working on a project, as it ensures that the correct versions of dependencies are used and provides a controlled environment conducive to efficient development and testing.

poetry shell

Step 4 - Set up API keys using two methods: exporting them directly and storing them in a .env file.

For Linux/Temporary Windows Setup, use the export method:

export OPENAI_API_KEY={Your OpenAI API Key here}
export TAVILY_API_KEY={Your Tavily API Key here}

For a more permanent setup, create a .env file in the current gpt-researcher folder and input the keys as follows:

OPENAI_API_KEY={Your OpenAI API Key here}
TAVILY_API_KEY={Your Tavily API Key here}
  • For LLM, we recommend OpenAI GPT, but you can use any other LLM model (including open sources) supported by Langchain Adapter, simply change the llm model and provider in config/config.py. Follow this guide to learn how to integrate LLMs with Langchain.
  • For search engine, we recommend Tavily Search API (optimized for LLMs), but you can also refer to other search engines of your choice by changing the search provider in config/config.py to "duckduckgo", "googleAPI", "googleSerp", or "searx". Then add the corresponding env API key as seen in the config.py file.
  • We highly recommend using OpenAI GPT models and Tavily Search API for optimal performance.

Step 5 - Launch the FastAPI application agent on a Virtual Environment or Poetry setup by executing the following command:

python -m uvicorn main:app --reload

Step 6 - Visit http://localhost:8000 in any web browser and explore your research!

To learn how to get started with Docker or to learn more about the features and services check out the documentation page.

πŸš€ Contributing

We highly welcome contributions! Please check out contributing if you're interested.

Please check out our roadmap page and reach out to us via our Discord community if you're interested in joining our mission.

πŸ›‘ Disclaimer

This project, GPT Researcher, is an experimental application and is provided "as-is" without any warranty, express or implied. We are sharing codes for academic purposes under the MIT license. Nothing herein is academic advice, and NOT a recommendation to use in academic or research papers.

Our view on unbiased research claims:

  1. The whole point of our scraping system is to reduce incorrect fact. How? The more sites we scrape the less chances of incorrect data. We are scraping 20 per research, the chances that they are all wrong is extremely low.
  2. We do not aim to eliminate biases; we aim to reduce it as much as possible. We are here as a community to figure out the most effective human/llm interactions.
  3. In research, people also tend towards biases as most have already opinions on the topics they research about. This tool scrapes many opinions and will evenly explain diverse views that a biased person would never have read.

Please note that the use of the GPT-4 language model can be expensive due to its token usage. By utilizing this project, you acknowledge that you are responsible for monitoring and managing your own token usage and the associated costs. It is highly recommended to check your OpenAI API usage regularly and set up any necessary limits or alerts to prevent unexpected charges.

βœ‰οΈ Support / Contact us

About

GPT based autonomous agent that does online comprehensive research on any given topic

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 82.5%
  • JavaScript 7.0%
  • HTML 6.3%
  • CSS 3.1%
  • Dockerfile 1.1%