This project is a news chatbot that fetches and summarizes articles from news websites based on user queries.
The chatbot is built using Python and integrates with Streamlit for the user interface, and LangChain for language model operations.
The design is based on the React Agent model.
Currently, the chatbot supports fetching articles from the following websites:
- BBC
- The Guardian
- Fetches articles from the specified website.
- Summarizes articles based on user-specified categories.
- Interactive chat interface using Streamlit.
- Supports both Azure and OpenAI language models.
-
Clone the repository:
git clone https://github.com/amrsamii/news-chatbot.git cd news-chatbot
-
Create and activate a virtual environment:
python -m venv .venv source .venv/bin/activate # On Windows use `.venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Configure the language model in
config.json
file in the root directory. Example:{ "provider": "openai", "model": "gpt-4o", "temperature": 0 }
-
Create a
.env
file in the root directory with the required environment variables. Example:OPENAI_API_KEY=<your-openai-api-key>
-
Run the Streamlit app:
streamlit run main.py
-
Interact with the chatbot through the Streamlit interface.
main.py
: Initializes the Streamlit app and handles user interactions.graph.py
: Defines theNewsGraph
class for processing user queries.tools.py
: Contains functions to fetch articles from news websites.scraping_utils.py
: Utility functions for web scraping.requirements.txt
: Lists the dependencies required for the project.config.json
: Configuration file for the language model..env
: Environment variables file (not included in the repo).
This project is licensed under the MIT License. See the LICENSE
file for more details.