A powerful Django-based backend service that provides an intelligent question-answering system using the Groq API. This application maintains conversation history and provides seamless interaction with advanced language models.
- Frontend: AI-QA-Agent-Neural-Interface-Frontend
- Real-time AI-powered question answering
- Conversation history management
- Session-based interactions
- RESTful API endpoints
- Error handling and logging
- Scalable architecture
- Backend Framework: Django 4.2.7
- API Framework: Django REST Framework 3.14.0
- AI Integration: Groq API
- Cross-Origin Support: django-cors-headers 4.3.1
- Python 3.x
- pip (Python package manager)
- A Groq API key
- Frontend application running (see frontend repository)
-
Clone the repository:
git clone <your-repository-url> cd backend
-
Create and activate a virtual environment:
python -m venv venv venv\Scripts\activate
-
Install dependencies:
pip install -r requirements.txt
-
Set up environment variables: Copy
.env.exampleto create your.envfile:cp .env.example .env
Then edit
.envwith your actual configuration values. -
Run migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
Required environment variables:
DEBUG: Set toTruefor development,Falsefor productionSECRET_KEY: Django secret key for securityGROQ_API_KEY: Your Groq API key for AI servicesALLOWED_HOSTS: Comma-separated list of allowed hostsCORS_ALLOWED_ORIGINS: Comma-separated list of allowed CORS origins
Optional database configuration:
DB_NAME: Database nameDB_USER: Database userDB_PASSWORD: Database passwordDB_HOST: Database hostDB_PORT: Database port
- POST
/chat/- Request body:
{ "query": "Your question here", "session_id": "optional_session_id" } - Returns AI response and conversation history
- Request body:
- GET
/history/?session_id=your_session_id- Returns conversation history for the specified session
- DELETE
/clear/?session_id=your_session_id- Clears conversation history for the specified session
- CSRF protection enabled
- Environment variables for sensitive data
- Session-based conversation management
- Error logging and handling
- 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.
Experience the power of advanced AI with our Neural Interface - providing instant, intelligent responses to your queries while maintaining context and conversation flow.