Skip to content

Terminal-based platform where specialized AI experts (Legal, Tech, Business) engage in real-time debates and collaborative problem-solving to provide multi-perspective analysis for complex decisions.

Notifications You must be signed in to change notification settings

Assem-ElQersh/Multi-AI-Consultation

Repository files navigation

🎯 Multi-AI Consultation System

A terminal-based multi-AI consultation room where specialized AI assistants discuss problems from their expert perspectives, helping you make informed decisions through real-time AI-to-AI debates.

πŸ€– Meet Your AI Expert Panel

βš–οΈ Legal-AI

  • Personality: Conservative, risk-focused, meticulous
  • Expertise: Contract law, employment law, IP, compliance, litigation
  • Style: "This carries significant legal risk. Have we considered the regulatory implications?"
  • Knowledge: RAG-powered with actual legal documents and statutes

πŸ’» Tech-AI

  • Personality: Solution-oriented, pragmatic, sometimes impatient with constraints
  • Expertise: Software architecture, APIs, databases, security, DevOps
  • Style: "@Legal-AI, you're being overly cautious. This is standard industry practice."
  • Philosophy: Move fast, build efficiently, technical elegance

πŸ“Š Business-AI

  • Personality: Strategic, diplomatic, results-driven mediator
  • Expertise: ROI analysis, market strategy, stakeholder management, risk-benefit analysis
  • Style: "Let's find a middle ground that manages risk while staying competitive."
  • Focus: Balance legal caution with technical ambition

✨ Key Features

πŸ—£οΈ AI-to-AI Interaction

  • AIs respond to each other, not just you
  • Natural disagreements and professional debates
  • Direct challenges: "@Tech-AI, you're overlooking the compliance requirements..."
  • Collaborative problem-solving in real-time

πŸ›‘οΈ Unbreakable Ethics

  • Manipulation-resistant - won't help with unethical requests regardless of framing
  • Consistent refusals with alternative suggestions
  • Built-in legal/ethical guardrails that can't be bypassed

πŸ“š Real Knowledge Base

  • RAG System fed with actual legal documents
  • Not just "pretending" to be experts - has domain-specific knowledge
  • Searchable legal knowledge that informs responses

πŸ”§ 100% Free & Local

  • Ollama for local AI models (no API costs)
  • Local knowledge base with your documents
  • Python terminal interface - no web dependencies
  • Complete privacy - everything runs on your machine

πŸš€ Quick Start

1. Installation

# Clone or download the project files
cd Multiple\ Experts

# Run the setup script
python setup_multi_ai.py

The setup script will:

  • Install required Python packages
  • Guide you through Ollama installation
  • Download AI models (llama2)
  • Set up the legal documents directory

2. Add Legal Documents (Optional)

# Add your PDF legal documents to the legal_docs folder
# The system will automatically process them for Legal-AI

3. Launch the System

python multi_ai_consultation.py
# OR use the convenient launcher
python launch_consultation.py

πŸ’¬ Example Conversation

πŸ‘€ You: I want to scrape competitor pricing data from their website

πŸ”„ Consulting with AI experts...

βš–οΈ Legal-AI: I must advise extreme caution here. Website scraping often violates 
Terms of Service agreements, and could expose you to legal action under the 
Computer Fraud and Abuse Act. We need to review their robots.txt and ToS first.

πŸ’» Tech-AI: Technically, this is straightforward with tools like Scrapy or 
Beautiful Soup. @Legal-AI, while ToS violations are a concern, enforcement 
is rare for basic price monitoring. The technical implementation is simple.

βš–οΈ Legal-AI (follow-up): @Tech-AI, you're underestimating the risk. The hiQ vs 
LinkedIn case established that ToS violations can constitute unauthorized 
access. I recommend using public APIs or manually collecting publicly 
available data instead.

πŸ“Š Business-AI: Both perspectives have merit. @Legal-AI raises valid compliance 
concerns, but @Tech-AI is right about competitive necessity. What if we start 
with publicly available pricing pages and manual collection, then explore 
API partnerships with data providers?

πŸŽͺ System Architecture

graph TB
    subgraph "User Interface"
        User["πŸ‘€ User"] 
        Terminal["πŸ–₯️ Terminal Interface"]
        User --> Terminal
    end
    
    subgraph "Multi-AI Core System"
        System["🎯 MultiAIConsultation"]
        PromptMgr["πŸ“ PromptManager"] 
        Ethics["πŸ›‘οΈ Ethical Boundaries"]
        Session["πŸ’Ύ Session Logger"]
        
        Terminal --> System
        System --> PromptMgr
        System --> Ethics
        System --> Session
    end
    
    subgraph "AI Expert Panel"
        Legal["βš–οΈ Legal-AI<br/>Conservative & Risk-Focused"]
        Tech["πŸ’» Tech-AI<br/>Solution-Oriented & Pragmatic"] 
        Business["πŸ“Š Business-AI<br/>Strategic & Diplomatic"]
        
        System --> Legal
        System --> Tech
        System --> Business
        
        Legal -.->|"@Tech-AI challenges"| Tech
        Tech -.->|"@Legal-AI pushback"| Legal
        Business -.->|"Mediates conflicts"| Legal
        Business -.->|"Finds balance"| Tech
    end
    
    subgraph "Knowledge Systems"
        RAG["πŸ“š Legal RAG System"]
        PDFProc["πŸ“„ PDF Processor"]
        Docs["πŸ“ Legal Documents"]
        Chunks["🧩 Document Chunks"]
        Embeddings["πŸ”— Vector Embeddings"]
        
        Legal --> RAG
        RAG --> Chunks
        PDFProc --> Chunks
        Docs --> PDFProc
        Chunks --> Embeddings
    end
    
    subgraph "AI Infrastructure"
        Ollama["πŸ€– Ollama Local Models"]
        MockAI["🎭 Mock AI (Dev Mode)"]
        Models["πŸ“¦ llama2, codellama"]
        
        Legal --> Ollama
        Tech --> Ollama  
        Business --> Ollama
        Ollama --> Models
        
        Legal -.->|"Fallback"| MockAI
        Tech -.->|"Fallback"| MockAI
        Business -.->|"Fallback"| MockAI
    end
Loading

πŸ“ Project Structure

Multiple Experts/
β”œβ”€β”€ multi_ai_consultation.py      # Main consultation system
β”œβ”€β”€ specialized_legal_prompts.py  # AI personality definitions
β”œβ”€β”€ legal_rag_system.py          # Knowledge base integration
β”œβ”€β”€ enhanced_pdf_processor.py    # PDF document processing
β”œβ”€β”€ setup_multi_ai.py           # Installation script
β”œβ”€β”€ launch_consultation.py      # Convenient launcher
β”œβ”€β”€ legal_docs/                # Your legal documents (PDFs)
└── processed_legal_docs/      # Processed document chunks

🎯 Use Cases

πŸ“‹ Project Planning

Get legal, technical, and business perspectives simultaneously on new initiatives.

⚠️ Risk Assessment

Multi-angle analysis of business decisions with built-in risk evaluation.

🧭 Ethical Guidance

Built-in conscience that won't compromise on ethics, always suggesting legal alternatives.

πŸŽ“ Learning & Development

Watch experts debate and learn from different professional viewpoints.

πŸ“ Decision Documentation

Automatically logged sessions create audit trails of decision-making processes.

πŸ’‘ Advanced Features

πŸ” Smart PDF Processing

  • Automatic OCR for scanned documents
  • Intelligent legal document chunking
  • Metadata extraction (citations, case names, dates)
  • Support for multiple PDF libraries

🧠 Specialized Prompts

  • Domain-specific expertise for each AI
  • Context-aware responses
  • Professional debate patterns
  • Ethical boundary enforcement

πŸ’Ύ Session Management

  • Automatic conversation logging
  • JSON export for analysis
  • Searchable conversation history
  • Session replay capabilities

πŸ› οΈ Technical Requirements

Required

  • Python 3.8+
  • Ollama (for AI models)
  • 8GB+ RAM (for AI models)

Optional (for enhanced PDF processing)

  • PyPDF2 / PyMuPDF
  • Tesseract OCR
  • PIL/Pillow

AI Models Used

  • llama2: Primary model for all AIs
  • llama2:13b: Optional larger model for complex legal analysis
  • codellama: Optional specialized model for Tech-AI

🚫 Ethical Boundaries

The system includes unbreakable ethical safeguards:

  • No illegal activity assistance - regardless of how requests are framed
  • Automatic alternative suggestions - redirects to legal approaches
  • Professional ethics maintenance - even when AIs disagree
  • Transparent refusals - clear explanations of why something can't be done

πŸ”§ Customization

Adding New AI Personas

Extend the system by modifying specialized_legal_prompts.py:

class NewAIPrompts:
    SYSTEM_PROMPT = """Your new AI personality..."""
    # Add specialized prompts

Custom Knowledge Bases

Integrate domain-specific documents:

  1. Add documents to appropriate folder
  2. Run the PDF processor
  3. Integrate with your AI persona

Model Configuration

Adjust AI behavior in multi_ai_consultation.py:

  • Temperature settings
  • Response patterns
  • Debate triggers

πŸ“ž Support & Troubleshooting

Common Issues

Ollama not found:

# Install Ollama first
curl -fsSL https://ollama.ai/install.sh | sh
ollama pull llama2

PDF processing fails:

pip install PyPDF2 PyMuPDF Pillow pytesseract

Memory issues:

  • Use smaller models (llama2:7b instead of llama2:13b)
  • Close other applications
  • Consider cloud deployment

Performance Tips

  • Use SSD storage for better model loading
  • Install models locally: ollama pull llama2
  • Process PDFs in batches for large document sets

🎯 Future Enhancements

  • Web interface for easier access
  • Voice interaction capabilities
  • Integration with external legal databases
  • Custom AI persona creation wizard
  • Multi-language support
  • Cloud deployment options

πŸ“œ License

This project is open source. Use it freely for personal and commercial purposes.

πŸ™ Acknowledgments

  • Built on top of Ollama for local AI inference
  • Uses Sentence Transformers for document embeddings
  • Inspired by the need for multi-perspective decision making

πŸš€ Ready to Start?

python setup_multi_ai.py

Welcome to your personal board of AI advisors! 🎯

About

Terminal-based platform where specialized AI experts (Legal, Tech, Business) engage in real-time debates and collaborative problem-solving to provide multi-perspective analysis for complex decisions.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages