NEWSimplify is a an AI-powered news assistant built using Python and seamlessly integrating custom tools with the powerful Llama 3.1-70B large language model (LLM). This smart AI agent fetches and summarizes the latest news articles on any topic of interest, offering users a dynamic, chat-based interface for effortless interaction and real-time insights.
- Custom Tools Integration: Demonstrates custom functions for:
- Fetching the top 3 relevant news articles using
search_web
. - Extracting and summarizing content from the selected article using
extract_article
.
- Fetching the top 3 relevant news articles using
- AI-Powered Backend: Powered by the Llama 3.1-70B model to generate responses and dynamically call tools when required.
- Streamlit Web UI: Simple and user-friendly chat interface for interacting with the assistant.
- Real-Time News Fetching: Utilizes
duckduckgo_search
to gather the latest articles.
- User Query: The user enters a topic of interest via the chat interface.
- Custom Tool Call (
search_web
):- The assistant fetches the top 3 relevant articles related to the topic.
- Article Selection:
- The user selects an article by providing its number or title.
- Custom Tool Call (
extract_article
):- The assistant extracts and summarizes the content of the selected article.
- Follow-Up Questions:
- Users can ask follow-up questions based on the content of the article.
- Python 3.12+
- Poetry - Python dependency manager (
pip install poetry
) - Streamlit - For the chat-based web UI.
-
Clone the Repository:
git clone https://github.com/Arnab1311/NewsSimplify.git cd NewsSimplify
-
Install Dependencies Using Poetry:
poetry install
-
Set Up Environment Variables:
- Create a
.env
file in the project directory and add your credentials:GROQ_API_KEY=your_groq_api_key
- Create a
-
Run the Application: Start the Streamlit interface:
streamlit run newsimplify.py
-
Interact with the Assistant: Open http://localhost:8501 in your browser and start asking for news topics!
This project uses the following libraries:
- streamlit: To build the chat-based UI.
- duckduckgo-search: For fetching real-time news articles.
- selenium: For web scraping and article extraction.
- python-dotenv: To manage environment variables securely.
- groq: API library to interact with the Llama 3.1-70B model.
- newspaper4k: For extracting news article
newsimplify.py
: Main script handling the assistant logic and Streamlit UI.websearch.py
: Custom tool for searching news articles.article.py
: Custom tool for extracting and summarizing article content..gitignore
: Ignores unnecessary files like virtual environments and caches.pyproject.toml
: Poetry configuration file for dependency management.
Here's how the NEWSimplify assistant works in action:
This project highlights tool-calling capabilities in LLMs where the assistant dynamically calls external functions based on user queries. It showcases practical applications of integrating large language models with real-world tools to automate tasks like:
- Fetching Information
- Summarizing Content
- Providing Follow-Up Insights
Contributions are welcome! To get started:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes and push:
git commit -m "Add new feature" git push origin feature-name
- Open a pull request.
This project is licensed under the Apache-2.0 License. See LICENSE
for details.
- Arnab Kumar Chand
- GitHub: Arnab1311
- Add advanced filtering options for news articles.
- Integrate more tools to fetch weather, sports stats, or stock data.
- Enhance the assistant’s ability to answer deeper analytical queries.