Skip to content

Conversation

@VathareVinayak
Copy link

@VathareVinayak VathareVinayak commented Oct 12, 2025

Streamlit RAG PromptBot

@Shubhamsaboo , This PR adds a full working example of a Retrieval-Augmented Chatbot using Streamlit and OpenRouter API. The app reads PDF files as a knowledge base and answers user queries intelligently without storing any data in a database — all chat is kept in session memory.

Features

  • RAG-based responses using PDF context.
  • Upload your own PDF knowledge files.
  • Streamlit interactive UI with chat interface.
  • Session-only memory; no database required.
  • OpenRouter API integration for LLM responses.
  • Error handling for API issues.

Tech Stack

  • Streamlit (Frontend UI)
  • OpenRouter API (gpt-3.5-turbo) for LLM
  • Python 3.10+
  • PyPDF2 for PDF text extraction
  • python-dotenv for environment variables

Project Folder

rag_tutorials/openrouter_rag_based_chatbot/
├── app.py
├── utils/pdf_reader.py
├── requirements.txt
├── .gitignore
├── .env.example
├── README.md
└── snaps/
├── OpenrouterResting.png
└── testSnaps.png

Installation & Running

  1. Clone the repo or fork.
  2. Create a Python virtual environment and activate it.
  3. Install dependencies: pip install -r requirements.txt.
  4. Add your OpenRouter API key in .env.
  5. Run: streamlit run app.py.

Performance & Notes

  • Response time: ~1-2.038 seconds (also depending on PDF contains tables , imagnes or not and also API)
  • Best performance with PDFs < 20 MB.
  • Lightweight, no database used.

Screenshots

Screenshots

Upload PDF Interface:
Upload PDF

Chat Interface:
Chat Example

This PR adds a ready-to-run, self-contained example project for users to try RAG with Streamlit + OpenRouter API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants