Shubham-10000/RAG-enabled-AI-assistant
1
AI Assistant with RAG
An AI-powered assistant with Retrieval Augmented Generation (RAG) capabilities, running on Docker.
Features
- ๐ฏ Department-specific assistants: HR, Finance, IT, Product Manager
- ๐ Document upload: Support for .txt and .md files
- ๐ RAG (Retrieval Augmented Generation): Search and use uploaded documents as context
- ๐ฌ Multi-turn conversations: Maintains chat history
- โ๏ธ Adjustable settings: Control temperature and retrieval parameters
- ๐ณ Docker deployment: Isolated and reproducible environment
How to Use
- Configure API Key: Add your Groq API key in Space Settings โ Repository secrets
- Secret name:
GROQ_API_KEY - Get free key: https://console.groq.com/
- Select Department: Choose your department from the sidebar
- Upload Documents (optional): Upload .txt or .md files for RAG
- Enable RAG: Toggle RAG to use uploaded documents as context
- Start Chatting: Type your message and press Enter
Technology Stack
- LLM: Groq API (kimi-k2-instruct-0905)
- Embeddings: Sentence Transformers (all-MiniLM-L6-v2)
- Vector Search: FAISS
- UI: Streamlit
- Deployment: Docker
Setup (for local development)
# Clone the repository
git clone https://huggingface.co/spaces/Shubham-10000/RAG-enabled-AI-assistant
cd ai-assistant-rag
# Create .env file
echo "GROQ_API_KEY=your_key_here" > .env
# Build and run with Docker
docker build -t ai-assistant .
docker run -p 7860:7860 --env-file .env ai-assistant
# Or use docker-compose
docker-compose upConfiguration
Environment Variables
GROQ_API_KEY: Your Groq API key (required)GROQ_MODEL: Model to use (default:moonshotai/kimi-k2-instruct-0905)
Hugging Face Secrets
Add these in Space Settings โ Repository secrets:
GROQ_API_KEY: Your Groq API key
Files Structure
.
โโโ Dockerfile # Docker configuration
โโโ requirements.txt # Python dependencies
โโโ app.py # Main Streamlit application
โโโ storage.py # Vector storage implementation
โโโ .streamlit/
โ โโโ config.toml # Streamlit configuration
โโโ .dockerignore # Docker ignore file
โโโ README.md # This fileLimitations
โ ๏ธ Storage Note: Documents uploaded to Hugging Face Spaces are stored temporarily. They persist during the session but may be lost on Space restart.
For production use with permanent storage, consider:
- Using external database (MongoDB, Supabase)
- Implementing Hugging Face Datasets API
- Self-hosting with persistent volumes
Development
Local Development without Docker
# Install dependencies
pip install -r requirements.txt
# Set environment variable
export GROQ_API_KEY=your_key_here
# Run app
streamlit run app.pyTesting
# Test with sample document
echo "Company Policy: Remote work allowed on Tuesdays and Thursdays" > test.txt
# Upload test.txt in the app
# Enable RAG
# Ask: "What is the remote work policy?"Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
Apache 2.0
Support
- Issues: Report bugs or request features in the Issues tab
- Documentation: https://huggingface.co/docs/hub/spaces
- Groq API: https://console.groq.com/docs
Note: This Space requires a Groq API key to function. Get your free key at https://console.groq.com/
