The AI Debate System implements an agentic framework where multiple autonomous AI agents collaborate to conduct structured debates. The system utilizes the HuggingFace Inference API with the Zephyr-7b-beta model for natural language processing capabilities.
Each agent in the system follows a common agentic structure with five key properties:
- Goals: Specific objectives driving agent behavior
- Actions: Available operations the agent can perform
- Perception: Ability to analyze and understand context
- Memory: Storage of historical information and learned patterns
- Learning: Adaptation mechanisms based on experience
- Purpose: Present and defend assigned viewpoints in debates
- Properties:
{ "name": "string", "stance": "string (in favor/against)", "memory": "list of past arguments", "strategy": "string (balanced/aggressive/defensive)", "stats": { "arguments_made": "integer", "rebuttals_made": "integer", "points_addressed": "integer" } }
- Key Methods:
generate_opening_statement(topic, parameters)
generate_rebuttal(topic, opponent_argument, parameters)
generate_closing_statement(topic, parameters)
analyze_opponent(argument)
remember(content, type)
- Purpose: Ensure factual accuracy of debate content
- Properties:
{ "verified_facts": "dictionary of checked statements", "verification_history": "list of past verifications" }
- Key Methods:
check_facts(statement)
- Track verification history with timestamps
- Purpose: Guide debate flow and maintain order
- Properties:
{ "debate_history": "list of moderation actions" }
- Key Methods:
moderate(topic, stage)
- Different moderation styles for introduction, transition, and closing
- Main Components:
{ "topic": "debate topic", "parameters": "debate configuration", "debater_pro": "DebateAgent instance", "debater_con": "DebateAgent instance", "fact_checker": "FactCheckerAgent instance", "moderator": "ModeratorAgent instance", "debate_log": "list of debate events" }
-
System Initialization:
graph TD A[User Input] --> B[Parameter Setup] B --> C[Agent Initialization] C --> D[Debate Start]
-
Debate Round Flow:
graph TD A[Moderator Introduction] --> B[Opening Statements] B --> C[Main Arguments] C --> D[Rebuttals] D --> E[Closing Statements] E --> F[Moderator Closing] B & C & D --> G[Fact Checking]
- Analyzes opponent arguments using structured prompts
- Adapts tone and approach based on debate parameters
- Maintains memory of previous points for coherent arguments
- Validates content against inappropriate terms
- Identifies specific, verifiable claims
- Rates claims with confidence levels
- Provides supporting evidence
- Notes missing context or biases
- Guides debate progression through stages
- Maintains neutrality while ensuring flow
- Provides appropriate transitions
- Summarizes key points
class HFInferenceLLM:
- Initialization with API token
- Text generation with parameters:
- max_new_tokens=256
- temperature=0.7
- repetition_penalty=1.1
- Checks for inappropriate terms:
inappropriate_terms = [ "violent", "abusive", "hate", "discriminatory", "threatening", "explicit", "offensive" ]
- Configurable options:
parameters = { 'debate_style': ["Formal", "Casual", "Academic"], 'debate_rounds': 1-5, 'focus_points': 1-5, 'fact_checking': boolean, 'show_thinking': boolean }
- Enhanced agent learning capabilities
- More sophisticated fact-checking algorithms
- Dynamic strategy adaptation
- Real-time audience interaction
- Expanded content filtering
- Track debate quality metrics
- Monitor fact-checking accuracy
- Measure agent adaptation effectiveness
- Evaluate content appropriateness
- HuggingFace API access
- Streamlit for UI
- Python 3.7+
- Required libraries:
- huggingface_hub
- streamlit
- time
- typing
- json
- Install dependencies
- Configure HuggingFace API token
- Launch Streamlit interface
- Configure debate parameters
- Input debate topic
- Start debate session
- Real-time content validation
- Inappropriate term detection
- Civil discourse enforcement
- Secure token handling
- Rate limiting
- Error handling
- Detailed debate logs
- Agent action tracking
- System performance metrics
- Real-time agent thinking display
- Progress tracking
- Error reporting