Skip to content

An intelligent, context-aware Q&A backend powered by Groq LLM and Django REST Framework. Supports real-time chat, multi-turn memory, and blazing-fast responses. Seamlessly integrates with a React frontend available in a separate repo.

Notifications You must be signed in to change notification settings

M-Husnain-Ali/AI-QA-Agent-Neural-Interface-Backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Q&A Agent Neural Interface (Backend)

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.

🔗 Related Repositories

🌟 Features

  • Real-time AI-powered question answering
  • Conversation history management
  • Session-based interactions
  • RESTful API endpoints
  • Error handling and logging
  • Scalable architecture

🛠️ Tech Stack

  • 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

🚀 Getting Started

Prerequisites

  • Python 3.x
  • pip (Python package manager)
  • A Groq API key
  • Frontend application running (see frontend repository)

Installation

  1. Clone the repository:

    git clone <your-repository-url>
    cd backend
  2. Create and activate a virtual environment:

    python -m venv venv
    venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Set up environment variables: Copy .env.example to create your .env file:

    cp .env.example .env

    Then edit .env with your actual configuration values.

  5. Run migrations:

    python manage.py migrate
  6. Start the development server:

    python manage.py runserver

🔧 Environment Variables

Required environment variables:

  • DEBUG: Set to True for development, False for production
  • SECRET_KEY: Django secret key for security
  • GROQ_API_KEY: Your Groq API key for AI services
  • ALLOWED_HOSTS: Comma-separated list of allowed hosts
  • CORS_ALLOWED_ORIGINS: Comma-separated list of allowed CORS origins

Optional database configuration:

  • DB_NAME: Database name
  • DB_USER: Database user
  • DB_PASSWORD: Database password
  • DB_HOST: Database host
  • DB_PORT: Database port

🔌 API Endpoints

Chat with AI

  • POST /chat/
    • Request body:
      {
          "query": "Your question here",
          "session_id": "optional_session_id"
      }
    • Returns AI response and conversation history

Get Conversation History

  • GET /history/?session_id=your_session_id
    • Returns conversation history for the specified session

Clear Conversation History

  • DELETE /clear/?session_id=your_session_id
    • Clears conversation history for the specified session

🔒 Security

  • CSRF protection enabled
  • Environment variables for sensitive data
  • Session-based conversation management
  • Error logging and handling

🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

📝 License

This project is licensed under the MIT License - see the LICENSE file for details.

⭐ Elite Experience

Experience the power of advanced AI with our Neural Interface - providing instant, intelligent responses to your queries while maintaining context and conversation flow.

About

An intelligent, context-aware Q&A backend powered by Groq LLM and Django REST Framework. Supports real-time chat, multi-turn memory, and blazing-fast responses. Seamlessly integrates with a React frontend available in a separate repo.

Topics

Resources

Stars

Watchers

Forks

Languages