Skip to content

charanpool/rag-news-summarizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

7 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“° RAG News Summarizer

CI Python 3.10+ LangChain Ollama License: MIT PRs Welcome

A Retrieval-Augmented Generation (RAG) system for fetching, indexing, and summarizing news articles using local AI models.

RAG News Summarizer demonstrates a complete RAG pipeline β€” from data ingestion to semantic search to LLM-powered summarization β€” all running locally on your machine.


🌱 Why This Project Exists

This project was intentionally built as a simple, educational implementation of RAG concepts.

Modern AI applications increasingly rely on RAG architectures, but many tutorials are either:

  • Too abstract (theory without working code)
  • Too complex (production systems with overwhelming features)
  • Cloud-dependent (requiring API keys and paid services)

RAG News Summarizer fills the gap by providing:

  • βœ… A complete, working implementation you can run locally
  • βœ… Clean, readable code that's easy to understand and modify
  • βœ… No API keys required β€” uses local models only
  • βœ… A foundation to build upon for your own projects

This is ideal for learning, portfolio projects, or as a starting point for production systems.


✨ Features

  • πŸ” Semantic Search β€” Find relevant articles using vector similarity
  • πŸ“° Multi-Source Ingestion β€” Fetches from BBC, Reuters, TechCrunch, and more
  • πŸ€– Local LLM Integration β€” Runs entirely on your machine with Ollama
  • πŸ’Ύ Persistent Storage β€” ChromaDB vector database for efficient retrieval
  • 🎨 Modern Web UI β€” Beautiful Streamlit interface with real-time updates
  • πŸ”’ Privacy-First β€” No data leaves your machine

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     Streamlit Web UI                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   RAG Pipeline (LangChain)                      β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ News Fetcher  β”‚  β”‚ Vector Store   β”‚  β”‚ LLM Chain          β”‚  β”‚
β”‚  β”‚ (RSS Parser)  β”‚  β”‚ (ChromaDB)     β”‚  β”‚ (Ollama)           β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                    β”‚                    β”‚
         β–Ό                    β–Ό                    β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”      β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚ RSS Feedsβ”‚      β”‚ Sentence     β”‚      β”‚ Ollama      β”‚
   β”‚ (Free)   β”‚      β”‚ Transformers β”‚      β”‚ (Llama 3.2) β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

For detailed architecture documentation, see docs/ARCHITECTURE.md.


πŸš€ Quick Start

Prerequisites

  • Python 3.10 or higher
  • Ollama installed

Installation

# 1. Clone the repository
git clone https://github.com/charanpool/rag-news-summarizer.git
cd rag-news-summarizer

# 2. Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# 3. Install dependencies
pip install -r requirements.txt

# 4. Set up Ollama (in a separate terminal)
ollama pull llama3.2
ollama serve

# 5. Run the application
streamlit run app/main.py

Open your browser at http://localhost:8501 πŸŽ‰

First Run

  1. Click "πŸ”„ Fetch & Index News" in the sidebar
  2. Wait for articles to be fetched and indexed
  3. Ask a question like "What's the latest in AI?"
  4. View the AI-generated summary with source citations

πŸ“ Project Structure

RAG_News_Summarizer/
β”œβ”€β”€ app/                    # Application code
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ config.py           # Configuration settings
β”‚   β”œβ”€β”€ embeddings.py       # Embedding generation
β”‚   β”œβ”€β”€ main.py             # Streamlit web interface
β”‚   β”œβ”€β”€ news_fetcher.py     # RSS feed parser
β”‚   β”œβ”€β”€ rag_chain.py        # RAG pipeline logic
β”‚   └── vector_store.py     # ChromaDB operations
β”œβ”€β”€ data/                   # Runtime data (gitignored)
β”‚   └── chroma_db/          # Vector database storage
β”œβ”€β”€ docs/                   # Documentation
β”‚   β”œβ”€β”€ ARCHITECTURE.md     # Technical architecture
β”‚   └── CONCEPTS.md         # Core RAG concepts
β”œβ”€β”€ tests/                  # Test suite
β”‚   └── test_rag.py
β”œβ”€β”€ .env.example            # Environment template
β”œβ”€β”€ .gitignore
β”œβ”€β”€ CONTRIBUTING.md         # Contribution guidelines
β”œβ”€β”€ LICENSE                 # MIT License
β”œβ”€β”€ README.md               # This file
β”œβ”€β”€ ROADMAP.md              # Future enhancement plans
└── requirements.txt        # Python dependencies

πŸ› οΈ Tech Stack

Component Technology Purpose
Orchestration LangChain RAG pipeline framework
Embeddings sentence-transformers Text vectorization (local)
Vector DB ChromaDB Similarity search storage
LLM Ollama (Llama 3.2) Text generation (local)
Web UI Streamlit Interactive interface
News Source RSS Feeds Free news data

πŸ“Š How It Works

1. Ingestion Phase

RSS Feeds β†’ Parse Articles β†’ Chunk Text β†’ Generate Embeddings β†’ Store in ChromaDB

2. Query Phase

User Query β†’ Embed Query β†’ Semantic Search β†’ Retrieve Top-K Articles

3. Generation Phase

Retrieved Context + User Query β†’ LLM Prompt β†’ Generated Summary β†’ Display

For a deeper dive, see docs/CONCEPTS.md.


βš™οΈ Configuration

Key settings in app/config.py:

Setting Default Description
EMBEDDING_MODEL all-MiniLM-L6-v2 Sentence-transformer model
OLLAMA_MODEL llama3.2 Local LLM model
CHUNK_SIZE 1000 Text chunk size (characters)
CHUNK_OVERLAP 200 Overlap between chunks
TOP_K_RESULTS 5 Documents to retrieve

Override via .env file:

cp .env.example .env
# Edit .env with your preferences

πŸ“‘ Supported News Sources

Source Category
BBC World World News
Reuters World News
Al Jazeera World News
NPR News World News
The Guardian World News
BBC Tech Technology
TechCrunch Technology
Hacker News Technology
Ars Technica Technology
The Verge Technology
Wired Technology
Science Daily Science
NASA Science
CNBC Business
Bloomberg Business

Add custom sources in app/config.py:

RSS_FEEDS = {
    "Your Source": "https://example.com/rss/feed.xml",
}

πŸ§ͺ Running Tests

# Run all tests
pytest tests/ -v

# Run with coverage
pytest tests/ --cov=app --cov-report=html

🧩 Design Principles

This project follows intentionally lean design principles:

Principle Implementation
Simplicity Minimal dependencies, clear code structure
Local-First No external API calls required
Educational Well-documented, easy to understand
Extensible Clean abstractions for modification
Stateless Core No database beyond vector store

Keeping It Simple

This project skips a few things on purpose to stay beginner-friendly:

  • User authentication
  • Cloud deployments
  • Complex caching layers
  • Microservices architecture
  • Kubernetes configurations

Want to add these? Check out ROADMAP.md for ideas!


πŸ”§ Troubleshooting

Ollama Not Running

# Start Ollama server
ollama serve

# Verify it's running
curl http://localhost:11434/api/tags

Model Not Found

# Pull the required model
ollama pull llama3.2

Memory Issues

  • Use a smaller embedding model in config
  • Reduce CHUNK_SIZE
  • Use a smaller Ollama model: llama3.2:1b

Module Import Errors

Ensure you're running from the project root:

cd /path/to/RAG_News_Summarizer
source venv/bin/activate
streamlit run app/main.py

πŸ“– Documentation

Document Description
CONCEPTS.md Core RAG concepts explained
ARCHITECTURE.md Technical architecture details
ROADMAP.md Future enhancement plans
CONTRIBUTING.md How to contribute

🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Areas where help is appreciated:

  • Improving heuristic parsing
  • Adding test fixtures
  • Documentation improvements
  • UI/UX enhancements

πŸ—ΊοΈ Roadmap

See ROADMAP.md for planned features including:

  • Hybrid search (semantic + keyword)
  • Multiple LLM provider support
  • REST API endpoints
  • Docker containerization
  • Enhanced UI features

πŸ“œ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

  • βœ… Free for personal and commercial use
  • βœ… Modify and distribute freely
  • βœ… Attribution required

πŸ™ Acknowledgments


⭐ Support

If you find this project useful:

  • ⭐ Star the repository
  • πŸ› Report issues you encounter
  • πŸ’‘ Share ideas for improvements
  • πŸ§‘β€πŸ’» Contribute code or documentation

Built with ❀️ for learning and demonstration purposes

About

A local-first RAG pipeline that fetches news from RSS feeds, indexes them in ChromaDB, and generates AI-powered summaries using Ollama. Built with LangChain and Streamlit for learning and experimentation.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages