Skip to content

dheeraj966/ai_dev_project-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI API Application Skeleton

This is a comprehensive skeleton for AI API applications with support for multiple AI model types (REST and WebSocket), input/output testing interface, and modular architecture.

Features

  • Multiple AI Model Support: Supports different AI models (General, GPT, Grok, Custom, etc.) with a pluggable architecture
  • REST API Endpoints: Dedicated endpoints for each model type plus a generic endpoint
  • WebSocket Support: Real-time communication for interactive AI applications
  • Web Interface: Enhanced UI with input/output boxes for testing AI model responses
  • Modular Architecture: Clean separation of concerns with model manager and configuration
  • Configuration Management: Environment variables and configuration files

Architecture

  • app.py: Main Flask application with SocketIO support
  • models.py: AI model manager with abstract base classes
  • config.py: Configuration management
  • index.html: Enhanced web interface with tabs for REST, WebSocket, and configuration
  • .env: Environment variables (API keys, etc.)
  • requirements.txt: Python dependencies

API Endpoints

  • GET / - Main UI interface
  • POST /api/test - Generic AI model endpoint
  • POST /api/general/test - General model endpoint
  • POST /api/grok/test - Grok model endpoint (x-ai/grok-4-fast:free via OpenRouter)
  • POST /api/gpt/test - GPT model endpoint
  • POST /api/custom/test - Custom model endpoint
  • GET /api/models - List available models
  • GET /health - Health check endpoint

WebSocket Events

  • connect - Client connected event
  • disconnect - Client disconnected event
  • test_request - Request to process AI model
  • ping/pong - Connection validation

Setup

  1. Install dependencies: pip install -r requirements.txt
  2. Configure environment variables in .env
  3. Run the application: python3 app.py
  4. Access the UI at http://localhost:3000

UI Features

  • Tabbed interface for REST API, WebSocket, and Configuration
  • Model type selector for different AI models
  • Parameter configuration (temperature, max tokens, etc.)
  • Real-time chat interface for WebSocket communication
  • Connection status indicators
  • Input/output boxes for testing AI responses

Extending the Skeleton

To add a new AI model:

  1. Create a new class extending AIModel in models.py
  2. Add the model type to the AIModelManager
  3. Optionally add a dedicated endpoint in app.py

Environment Variables

  • PORT - Server port (default: 3000)
  • GENERAL_API_KEY, GPT_API_KEY, GROK_API_KEY, CUSTOM_API_KEY - API keys for different models
  • GENERAL_API_URL, GPT_API_URL, CUSTOM_API_URL - API endpoints for different models
  • DEFAULT_MODEL - Default model to use
  • MODEL_* parameters - Default parameter values# ai_dev_project-

About

this project at present is in progress and actively developing it to make enterprise ready

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published