mirror of
https://github.com/assafelovic/gpt-researcher.git
synced 2024-04-09 14:09:35 +03:00
Virtual Environ and Poetry Setup
This commit is contained in:
11
.gitignore
vendored
11
.gitignore
vendored
@@ -1,13 +1,24 @@
|
|||||||
#Ignore env containing secrets
|
#Ignore env containing secrets
|
||||||
.env
|
.env
|
||||||
|
.venv
|
||||||
.envrc
|
.envrc
|
||||||
|
|
||||||
#Ignore Virtual Env
|
#Ignore Virtual Env
|
||||||
env/
|
env/
|
||||||
|
venv/
|
||||||
.venv/
|
.venv/
|
||||||
|
|
||||||
|
# Other Environments
|
||||||
|
ENV/
|
||||||
|
env.bak/
|
||||||
|
venv.bak/
|
||||||
|
|
||||||
#Ignore generated outputs
|
#Ignore generated outputs
|
||||||
outputs/
|
outputs/
|
||||||
|
|
||||||
#Ignore pycache
|
#Ignore pycache
|
||||||
**/__pycache__/
|
**/__pycache__/
|
||||||
|
|
||||||
#Ignore mypy cache
|
#Ignore mypy cache
|
||||||
.mypy_cache/
|
.mypy_cache/
|
||||||
node_modules
|
node_modules
|
||||||
|
|||||||
74
README.md
74
README.md
@@ -72,7 +72,7 @@ Please see [here](https://docs.tavily.com/docs/gpt-researcher/getting-started) f
|
|||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
> **Step 1** - Download the project
|
> **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.:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/assafelovic/gpt-researcher.git
|
git clone https://github.com/assafelovic/gpt-researcher.git
|
||||||
@@ -81,35 +81,89 @@ cd gpt-researcher
|
|||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
> **Step 2** - Install dependencies
|
> **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:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
pip install -r requirements.txt
|
python -m venv env
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To activate the virtual environment, use the following activation script in PowerShell/CMD terminal:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
.\env\Scripts\activate
|
||||||
|
```
|
||||||
|
|
||||||
|
To deactivate the virtual environment, run the following deactivation script in PowerShell/CMD terminal:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
deactivate
|
||||||
|
```
|
||||||
|
|
||||||
|
#### *Install the dependencies for a Virtual environment*
|
||||||
|
|
||||||
|
After activating the `env` environment, install dependencies using the `requirements.txt` file with the following command:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
> **Step 3** - Create .env file with your OpenAI Key and Tavily API key or simply export it
|
> **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.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
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.
|
||||||
|
|
||||||
|
```bash
|
||||||
|
poetry shell
|
||||||
|
```
|
||||||
|
|
||||||
|
<br />
|
||||||
|
|
||||||
|
> **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:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
export OPENAI_API_KEY={Your OpenAI API Key here}
|
export OPENAI_API_KEY={Your OpenAI API Key here}
|
||||||
```
|
|
||||||
```bash
|
|
||||||
export TAVILY_API_KEY={Your Tavily 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:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
OPENAI_API_KEY={Your OpenAI API Key here}
|
||||||
|
TAVILY_API_KEY={Your Tavily API Key here}
|
||||||
|
```
|
||||||
|
|
||||||
- **For LLM, we recommend [OpenAI GPT](https://platform.openai.com/docs/guides/gpt)**, but you can use any other LLM model (including open sources) supported by [Langchain Adapter](https://python.langchain.com/docs/guides/adapters/openai), simply change the llm model and provider in config/config.py. Follow [this guide](https://python.langchain.com/docs/integrations/llms/) to learn how to integrate LLMs with Langchain.
|
- **For LLM, we recommend [OpenAI GPT](https://platform.openai.com/docs/guides/gpt)**, but you can use any other LLM model (including open sources) supported by [Langchain Adapter](https://python.langchain.com/docs/guides/adapters/openai), simply change the llm model and provider in config/config.py. Follow [this guide](https://python.langchain.com/docs/integrations/llms/) to learn how to integrate LLMs with Langchain.
|
||||||
- **For search engine, we recommend [Tavily Search API](https://app.tavily.com) (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.
|
- **For search engine, we recommend [Tavily Search API](https://app.tavily.com) (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](https://platform.openai.com/docs/guides/gpt) models and [Tavily Search API](https://app.tavily.com) for optimal performance.**
|
- **We highly recommend using [OpenAI GPT](https://platform.openai.com/docs/guides/gpt) models and [Tavily Search API](https://app.tavily.com) for optimal performance.**
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
> **Step 4** - Run the agent with FastAPI
|
> **Step 5** - Launch the FastAPI application agent on a *Virtual Environment or Poetry* setup by executing the following command:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
uvicorn main:app --reload
|
python -m uvicorn main:app --reload
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- **Issue: OSError** - For Windows 11 Pro/Home users encountering the 'OSError: cannot load library 'gobject-2.0-0'' error, please refer to [this OSError GitHub issue](https://github.com/assafelovic/gpt-researcher/issues/314). To resolve this issue, install the `WeasyPrint` software on your local machine by using the [GTK for Windows Runtime Environment Installer](https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases/tag/2022-01-04).
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
> **Step 5** - Go to http://localhost:8000 on any browser and enjoy researching!
|
> **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](https://docs.tavily.com) page.
|
To learn how to get started with Docker or to learn more about the features and services check out the [documentation](https://docs.tavily.com) page.
|
||||||
|
|
||||||
|
|||||||
2778
poetry.lock
generated
Normal file
2778
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
2
poetry.toml
Normal file
2
poetry.toml
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[virtualenvs]
|
||||||
|
in-project = true
|
||||||
39
pyproject.toml
Normal file
39
pyproject.toml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
[tool.poetry]
|
||||||
|
name = "gpt-researcher"
|
||||||
|
version = "0.0.5"
|
||||||
|
description = "GPT Researcher is an autonomous agent designed for comprehensive online research on a variety of tasks."
|
||||||
|
authors = ["Tavily <support@tavily.com>"]
|
||||||
|
license = "MIT"
|
||||||
|
readme = "README.md"
|
||||||
|
|
||||||
|
[tool.poetry.dependencies]
|
||||||
|
python = "^3.11"
|
||||||
|
asyncio = "3.4.3"
|
||||||
|
beautifulsoup4 = "4.12.2"
|
||||||
|
colorama = "0.4.6"
|
||||||
|
duckduckgo_search = "4.1.1"
|
||||||
|
md2pdf = "1.0.1"
|
||||||
|
openai = "~1.3.3"
|
||||||
|
playwright = "1.39.0"
|
||||||
|
python-dotenv = "~1.0.0"
|
||||||
|
pyyaml = "6.0.1"
|
||||||
|
selenium = "4.15.2"
|
||||||
|
webdriver-manager = "4.0.1"
|
||||||
|
uvicorn = "0.24.0.post1"
|
||||||
|
pydantic = "2.5.1"
|
||||||
|
fastapi = "0.104.1"
|
||||||
|
python-multipart = "0.0.6"
|
||||||
|
markdown = "3.5.1"
|
||||||
|
langchain = "0.0.350"
|
||||||
|
tavily-python = "0.2.8"
|
||||||
|
permchain = "0.0.6"
|
||||||
|
arxiv = "2.0.0"
|
||||||
|
PyMuPDF = "1.23.6"
|
||||||
|
requests = "2.31.0"
|
||||||
|
jinja2 = "3.1.2"
|
||||||
|
aiofiles = "23.2.1"
|
||||||
|
|
||||||
|
|
||||||
|
[build-system]
|
||||||
|
requires = ["poetry-core"]
|
||||||
|
build-backend = "poetry.core.masonry.api"
|
||||||
Reference in New Issue
Block a user