Intelligent RAG-powered chatbot for NGOs and social organizations to provide instant, context-aware assistance about donations, events, feedback, and community activities.
Solace AI RAG transforms your organization's data into an intelligent conversational assistant that helps visitors get instant answers about your work, impact, and ways to contribute.
- Vector Search: Semantic similarity using sentence transformers
- Context-Aware Responses: GPT-powered responses based on your actual data
- Multi-Source Integration: Donations, events, feedback, and posts in one system
- Real-time Updates: Automatic knowledge base refresh when data changes
- RESTful Endpoints: Easy integration with any website or application
- High Performance: FAISS vector database for lightning-fast searches
- Scalable Architecture: Handles multiple concurrent users
- Comprehensive Monitoring: Health checks, analytics, and performance metrics
- API Authentication: Secure API key-based access control
- Rate Limiting: Prevents abuse and ensures fair usage
- Input Validation: Protects against malicious inputs
- CORS Support: Configurable cross-origin resource sharing
- Usage Tracking: Monitor chat interactions and user engagement
- Performance Metrics: Response times and system health monitoring
- Data Statistics: Real-time insights into your organization's data
- Donor Support: "How can I donate?" "What projects need funding?"
- Event Information: "What events are happening this month?" "Where is the next meetup?"
- Impact Stories: "What has our organization achieved?" "Show me recent feedback"
- Volunteer Coordination: "How can I help?" "What volunteer opportunities are available?"
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β Frontend β β FastAPI β β MongoDB β
β (React) βββββΊβ RAG Server βββββΊβ Atlas β
β β β β β β
βββββββββββββββββββ ββββββββββββββββββββ βββββββββββββββββββ
β
βΌ
ββββββββββββββββββββ
β OpenAI GPT β
β + Vector DB β
β (FAISS) β
ββββββββββββββββββββ
- Python 3.10
- MongoDB Atlas account
- OpenAI API key
git clone https://github.com/OpenVanguard/Solace-AI-RAG.git
cd Solace-AI-RAG# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txtCreate .env file:
MONGO_URI=mongodb+srv://username:password@cluster.mongodb.net/
DB_NAME=your_ngo_database
OPENAI_API_KEY=sk-your-openai-api-key-here
API_SECRET_KEY=your-secret-api-key
ENVIRONMENT=development# Development
python main.py
# Production
uvicorn main:app --host 0.0.0.0 --port 8000Your API will be available at http://localhost:8000
curl -X POST "http://localhost:8000/chat" \
-H "Content-Type: application/json" \
-d '{"message":"How many donations have we received?"}'| Method | Endpoint | Description |
|---|---|---|
POST |
/chat |
Send message to chatbot |
GET |
/health |
Health check |
GET |
/stats |
Database statistics |
POST |
/refresh |
Refresh knowledge base |
Request:
{
"message": "How can I donate to your organization?",
"user_id": "user123",
"session_id": "session456"
}Response:
{
"response": "You can donate through our website...",
"relevant_documents": [
{
"document": {
"text": "Donation - Donor: John Doe, Amount: βΉ500",
"type": "donation",
"id": "doc123"
},
"score": 0.95
}
],
"query": "How can I donate to your organization?",
"session_id": "session456",
"timestamp": "2025-01-27T10:30:00"
}async function askChatbot(message) {
const response = await fetch('/api/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message })
});
const data = await response.json();
return data.response;
}const [response, setResponse] = useState('');
const sendMessage = async (message) => {
const result = await fetch('/api/chat', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ message })
});
const data = await result.json();
setResponse(data.response);
};import requests
def chat_with_bot(message):
response = requests.post('http://localhost:8000/chat',
json={'message': message}
)
return response.json()['response']Solace-AI-RAG/
βββ main.py # FastAPI application
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables template
βββ Dockerfile # Docker configuration
βββ docker-compose.yml # Docker Compose setup
βββ README.md # This file
βββ tests/ # Test files
βββ test_api.py # API tests
βββ test_chatbot.py # Chatbot tests
# Build and run
docker-compose up --build -d
# View logs
docker-compose logs -f
# Stop
docker-compose down# Build image
docker build -t solace-ai-rag .
# Run container
docker run -d \
--name solace-ai-rag \
-p 8000:8000 \
--env-file .env \
solace-ai-ragThe API will be available at http://localhost:8000
See deployment guide for detailed instructions.
Your MongoDB collections should follow this structure:
{
"_id": "ObjectId",
"fullName": "Donor Name",
"amount": 1000,
"status": "completed",
"orderId": "order_123",
"createdAt": "ISO Date"
}{
"_id": "ObjectId",
"title": "Event Title",
"description": "Event Description",
"date": "2025-05-27",
"time": "19:29",
"location": "City Name",
"participants": [],
"createdAt": "ISO Date"
}{
"_id": "ObjectId",
"message": "User feedback message",
"createdAt": "ISO Date"
}{
"_id": "ObjectId",
"content": "Post content",
"fullName": "Author Name",
"status": "published",
"createdAt": "ISO Date"
}# Install test dependencies
pip install pytest pytest-asyncio httpx
# Run tests
pytest
# Run with coverage
pytest --cov=main --cov-report=html- Response Time: < 2 seconds average
- Concurrent Users: 100+ simultaneous connections
- Throughput: 1000+ requests/minute
- Knowledge Base: Supports 10K+ documents efficiently
- β API key authentication
- β Rate limiting (10 requests/minute)
- β Input validation and sanitization
- β CORS protection
- β SQL injection prevention
- β XSS protection
We welcome contributions! Please see our Contributing Guide.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ by OpenVanguard
Empowering NGOs with AI-driven solutions for better community engagement