A production-grade Streamlit application that combines Retrieval-Augmented Generation (RAG) with Live Web Search to provide intelligent retail price competitive analysis. Powered by OpenRouter API (Meta Llama models) and HuggingFace embeddings.
- Features
- Screenshots
- Project Structure
- Quick Start
- How to Use
- Test Data
- Technical Stack
- Configuration
- Response Modes
- Troubleshooting
- License
- Contributing
- 📄 PDF Catalog Processing: Upload your product catalog and leverage RAG for instant price lookups
- 🌐 Live Market Intelligence: Real-time web search for current competitor pricing
- 🤖 AI-Powered Analysis: LangChain agent with dual tools (Internal Knowledge + Market Search)
- 💬 Interactive Chat Interface: Natural language queries with conversation history
- 🎚️ Dual Response Modes:
- Concise: Executive 2-sentence summaries
- Detailed: Comprehensive analysis with sources and strategic recommendations
Clean, modern interface with dashboard statistics and easy navigation
Configure response mode, upload catalogs, and manage API settings
AI-powered chat interface with natural language queries and intelligent responses
neo_retail_scout/
├── config/
│ ├── config.py # Environment variables & constants
│ └── prompts.py # System prompts for Concise/Detailed modes
├── data/ # Folder for storing PDF catalogs
├── models/
│ ├── llm.py # LLM initialization (OpenRouter with Llama)
│ └── embeddings.py # HuggingFace embedding model setup
├── utils/
│ ├── document_loader.py # PDF loading & FAISS vectorization
│ └── search_tool.py # DuckDuckGo search tool wrapper
├── scripts/
│ └── generate_mock_data.py # Generate test PDF catalog
├── app.py # Main Streamlit UI
├── requirements.txt # Dependencies
└── .env # API Keys (create from .env.example)
# Clone or navigate to the project directory
cd neo_retail_scout
# Install dependencies
pip install -r requirements.txtCreate a .env file with your OpenRouter API key:
# Copy the example file
cp .env.example .env
# Edit .env and add your API key
OPENROUTER_API_KEY=your_openrouter_api_key_hereGet your API key from: https://openrouter.ai/keys
# Generate the mock product catalog PDF
python scripts/generate_mock_data.pyThis creates data/NeoStats_Spring_Catalog.pdf with intentionally high prices for testing.
streamlit run app.pyThe app will open in your browser at http://localhost:8501
- Upload your product catalog PDF (or use the generated test catalog)
- Select response mode:
- Concise: Quick 2-sentence executive summary
- Detailed: Full analysis with markdown tables and sources
- Ask pricing questions:
- "What is the price of Sony WH-1000XM5 Headphones?"
- "Is our Logitech MX Master 3S Mouse price competitive?"
- "Compare our Samsung T7 Shield SSD pricing with the market"
You: "Is our Sony WH-1000XM5 Headphones price competitive?"
Agent:
- 🔍 Searches internal catalog → Finds: $450.00
- 🌐 Searches live web → Finds: Market average ~$348
- 📊 Analyzes gap → Recommends: Price reduction to stay competitive
The generated mock catalog includes "trap items" with intentionally high prices:
| Product | Our Price | Market Price | Gap |
|---|---|---|---|
| Sony WH-1000XM5 Headphones | $450.00 | ~$348 | +$102 |
| Logitech MX Master 3S Mouse | $130.00 | ~$99 | +$31 |
| Samsung T7 Shield 2TB SSD | $200.00 | ~$160 | +$40 |
These items are designed to test the agent's ability to detect non-competitive pricing.
- Frontend: Streamlit
- LLM: Meta Llama (via OpenRouter API)
- Primary:
meta-llama/llama-3.3-70b-instruct - Alternative:
meta-llama/llama-3.1-70b-instruct
- Primary:
- Framework: LangChain
- RAG: FAISS vector store + HuggingFace embeddings
- Embedding Model:
sentence-transformers/all-MiniLM-L6-v2
- Embedding Model:
- Web Search: DuckDuckGo
- PDF Processing: PyPDF
- Document Generation: ReportLab
Key settings in config/config.py:
DEFAULT_MODEL: LLM model (default: meta-llama/llama-3.3-70b-instruct)TEMPERATURE: Response creativity (default: 0.7)MAX_TOKENS: Maximum response length (default: 2048)CHUNK_SIZE: Text splitting size (default: 1000)CHUNK_OVERLAP: Chunk overlap (default: 200)
Perfect for executives who need quick insights:
- 2-sentence format
- Direct recommendation
- No extra details
For strategic decision-making:
- Markdown comparison table
- Source citations
- Price gap analysis
- Strategic recommendations
- Risk assessment
Issue: "OPENROUTER_API_KEY not found"
- Solution: Create a
.envfile with your OpenRouter API key
Issue: "No content found in PDF"
- Solution: Ensure the PDF contains text (not just images)
Issue: "Error initializing search tool"
- Solution: Check internet connection for DuckDuckGo search
This project is for demonstration and educational purposes.
This is a case study demo project. Feel free to fork and customize for your needs!
Built with ❤️ for Retail Pricing Managers