Skip to content

dexmac221/AiSociety

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

16 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AI Society - LLM Model Router

Python 3.8+ License: MIT Ollama OpenAI

๐ŸŽฏ Democratizing AI Access with Intelligent Routing
A Python-based model routing system that intelligently selects appropriate local LLMs for different types of queries. Features advanced multilingual support, conversation memory, and OpenAI-enhanced routing for superior query analysis and optimization.

AI Society Web Interface

What is AI Society?

AI Society is an advanced model routing system that combines dual AI intelligence - using OpenAI's superior query analysis with efficient local model execution. It features conversation memory for extended interactions and multilingual support for global accessibility.

โœจ Core Features

  • ๐ŸŒ Multilingual Intelligence - Automatic language detection and translation for optimal performance
  • ๐Ÿง  Dual AI Architecture - OpenAI meta-routing + Local model execution
  • ๐Ÿ”ง Query Optimization - Automatically enhances queries for dramatically better results
  • ๐Ÿ’ฌ Conversation Memory - Multi-turn conversations with hybrid FAISS indexing
  • ๐ŸŽฏ Smart Model Selection - AI-powered routing to specialized models
  • โšก Performance Tracking - Comprehensive monitoring and analytics

๐Ÿš€ Quick Start

Prerequisites

  • Python 3.8+
  • Ollama installed and running
  • GPU with 8GB+ VRAM (tested on RTX 3090)
  • OpenAI API key (optional, for enhanced routing)

Installation

# Clone and setup
git clone https://github.com/dexmac221/AiSociety.git
cd AiSociety

# Automated setup
chmod +x setup.sh && ./setup.sh

# Quick start
chmod +x start.sh && ./start.sh

Access

โœ… Current Status (September 2025)

๐ŸŽฏ System is LIVE and fully operational!

Latest Features:

  • โœ… 14 cutting-edge 2025 models integrated
  • โœ… Enhanced UI with dark mode and 8+ example categories
  • โœ… Multilingual support with OpenAI translation framework
  • โœ… Hybrid memory system with conversation context
  • โœ… Real-time technical dashboard with performance metrics

๐ŸŽฏ Model Inventory (14 Latest 2025 Models)

๐Ÿ’ป Coding Specialists

  • Qwen2.5-Coder:7B - Advanced multilingual coding with debugging
  • DeepSeek-Coder-v2:16B - Complex algorithms and system programming
  • CodeLlama:7B - General coding, documentation, refactoring

๐Ÿงฎ Math & Reasoning

  • Phi-4:14B - Microsoft's latest math reasoning model
  • Qwen2.5:7B - Algebra, calculus, statistics, problem solving
  • Phi3:mini - Quick calculations and basic math

๐ŸŽจ Creative Specialists

  • Hermes-4:14B - NousResearch's latest uncensored creative model
  • Yi:9B - Long-form content, poetry, fiction
  • Neural-Chat:7B - Dialogue, conversation, roleplay

๐ŸŒ Multimodal & Efficiency

  • Qwen2.5-Omni:7B - Real-time voice, text, image, audio, video
  • Gemma-3:27B/4B - Google's latest multimodal models
  • Gemma-3:1B - Ultra-efficient edge deployment

๐ŸŽฏ General Purpose

  • Llama3.1:8B - Meta's latest reasoning and code model
  • Mistral:7B - Advanced reasoning and function calling

๐Ÿ—๏ธ System Architecture

System Architecture

Dual AI Intelligence Flow

  1. Query Reception - User sends message in any supported language
  2. Language Detection - OpenAI automatically detects query language
  3. Translation Layer - Non-English queries translated for optimal performance
  4. Memory Integration - System builds context from conversation history
  5. OpenAI Analysis - GPT-4.1-mini analyzes and optimizes query
  6. Model Selection - AI recommends optimal local model
  7. Local Execution - Enhanced query runs on selected model
  8. Response Enhancement - Results include optimization details and context

๐ŸŒ Multilingual AI Enhancement

  • Universal Language Support - Spanish, French, German, Italian, Portuguese, Japanese, Chinese, and more
  • Intelligent Translation - OpenAI detects language and translates for optimal comprehension
  • Native Response Language - Models receive instructions to respond in original language
  • Real-time Indicators - Language panel shows detection and translation status

๐Ÿ’ฌ Conversation Memory System

  • Multi-turn Conversations - "Write a function" โ†’ "Explain that code" โ†’ "Make it more efficient"
  • Context Awareness - Remembers previous messages and maintains flow
  • Smart References - Understands "that code", "the previous example"
  • Hybrid Architecture - FAISS indexing with OpenAI summarization

๐Ÿ”ง Query Optimization

Before vs After

Original Query OpenAI Enhancement
"sort list" "Write a well-documented Python function with error handling..."
"quantum" "Explain quantum computing in simple terms with examples..."
"5+3*2" "Calculate step-by-step showing order of operations..."

โš™๏ธ Configuration

OpenAI Integration (Recommended)

# Set API key for enhanced routing
export OPENAI_API_KEY="your-api-key-here"

Configuration File (config/router_config.json)

{
  "max_model_size": "8GB",
  "openai_meta_routing": {
    "enabled": true,
    "model": "gpt-4.1-mini",
    "cache_decisions": true
  },
  "specialization_weights": {
    "coding": 1.5,
    "math": 1.3,
    "creative": 1.2
  }
}

Testing & Validation

# Run comprehensive tests
./test_system.py

# Test specific components
python test_multilingual.py
python test_conversation_memory.py
python test_query_optimization.py

๐ŸŒŸ Example Usage

Coding Query

๐Ÿ‘ค "Debug this Python code: def fibonacci(n): return n + fibonacci(n-1)"
๐Ÿ”ง Enhanced: "Analyze and debug this recursive Python function..."
๐Ÿค– qwen2.5-coder โ†’ Identifies missing base case and infinite recursion

Conversation Memory

๐Ÿ‘ค "Write a Python sorting function"
๐Ÿค– [Provides function] ๐Ÿง  2 messages

๐Ÿ‘ค "Explain how that works"  
๐Ÿค– [Explains previous function] ๐Ÿง  4 messages

๐Ÿ‘ค "Make it more efficient"
๐Ÿค– [Improves with optimizations] ๐Ÿง  6 messages

๐Ÿ“ Project Structure

AiSociety/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ daemon/          # Model discovery
โ”‚   โ”œโ”€โ”€ memory/          # Conversation memory  
โ”‚   โ””โ”€โ”€ routing/         # Intelligent routing
โ”œโ”€โ”€ web/
โ”‚   โ””โ”€โ”€ app.py          # FastAPI web interface
โ”œโ”€โ”€ config/             # Configuration files
โ”œโ”€โ”€ docs/               # Documentation
โ”œโ”€โ”€ requirements.txt    # Dependencies
โ”œโ”€โ”€ setup.sh           # Setup script
โ””โ”€โ”€ start.sh           # Start script

๐Ÿค Contributing

See CONTRIBUTING.md for guidelines on:

  • Reporting issues and feature requests
  • Development setup and workflow
  • Code style and testing requirements
  • Pull request process

๐Ÿ“š Documentation

๐Ÿ“„ License

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

๐Ÿ™ Acknowledgments

  • Ollama team for excellent local LLM infrastructure
  • OpenAI for API integration capabilities
  • FastAPI for the robust web framework
  • FAISS for efficient vector similarity search

๐Ÿ“ž Support

About

Hybrid LLM router: local+cloud models with meta-routing,memory, FastAPI UI, and FAISS; integrates Ollama and OpenAI.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors