|
| 1 | +Debate System Using LLM Agents |
| 2 | +============================== |
| 3 | + |
| 4 | +Overview |
| 5 | +-------- |
| 6 | +This project is a debate system powered by LLMs using Langroid, enabling structured debates on various topics |
| 7 | +such as AI in healthcare, education, intellectual property, and societal biases. |
| 8 | +The program creates and manages agents that represent opposing sides of a debate, |
| 9 | +interact with users, and provide constructive feedback based on established debate criteria. |
| 10 | + |
| 11 | +New Topics and Pro and Con Side System messages can be manually configured by updating or modifying the |
| 12 | +system_messages.json File. |
| 13 | +"pro_ai": { |
| 14 | + "topic": "Your New TOPIC", |
| 15 | + "message": " YOUR Prompt" |
| 16 | + }, |
| 17 | +"con_ai": { |
| 18 | + "topic": "Your New TOPIC", |
| 19 | + "message": " YOUR CON or opposing Prompt" |
| 20 | + } |
| 21 | + |
| 22 | +Features |
| 23 | +-------- |
| 24 | +- Multiple Debate Topics: |
| 25 | + - AI in Healthcare |
| 26 | + - AI and Intellectual Property |
| 27 | + - AI and Societal Biases |
| 28 | + - AI as an Educator |
| 29 | +- Agent-Based Interaction: |
| 30 | + - Pro and Con agents for each topic simulate structured debate arguments. |
| 31 | +- Configurable to use different LLMs from OPENAI, Google, & Mistral: |
| 32 | + - 1: gpt-4o |
| 33 | + 2: gpt-4 |
| 34 | + 3: gpt-4o-mini |
| 35 | + 4: gpt-4-turbo |
| 36 | + 5: gpt-4-32k |
| 37 | + 6: gpt-3.5-turbo-1106 |
| 38 | + 7: Mistral: mistral:7b-instruct-v0.2-q8_0a |
| 39 | + 8: Gemini:gemini-2.0-flash |
| 40 | + 9: Gemini:gemini-1.5-flash |
| 41 | + 10: Gemini:gemini-1.5-flash-8b |
| 42 | + 11: Gemini:gemini-1.5-pro |
| 43 | +- Feedback Mechanism: |
| 44 | + - Provides structured feedback on debate performance based on key criteria. |
| 45 | +- Interactive or Autonomous Mode: |
| 46 | + - Users can either control interactions manually or let agents autonomously continue debates. |
| 47 | + |
| 48 | +File Structure |
| 49 | +-------------- |
| 50 | +- main.py: The entry point of the application. Initializes the system, configures agents, and starts the debate loop. |
| 51 | +- config.py: Provides functions for configuring global settings and LLM-specific parameters. |
| 52 | +- model.py: Pydantic model for system_messages.json |
| 53 | +- system_messages.json: Topic Titles and system_messages for pro and con agents. You can add more topics and their |
| 54 | +respective pro and con system messages here. The system_messages has a statement: |
| 55 | +"Limit responses to MAXIMUM 2 points expressed as single sentences." Please change or delete it for a realistic debate. |
| 56 | +- system_message.py: Global system messages |
| 57 | +- utils.py: User Prompts and other helper functions |
| 58 | +- generation_config_models.py: pydantic model for generation_config.json |
| 59 | +- generation_config.json: LLM generation parameters |
| 60 | +The system dynamically updates user selection with the topics from this file. |
| 61 | + |
| 62 | +Getting Started |
| 63 | +--------------- |
| 64 | +Prerequisites |
| 65 | +1. Python 3.8+ |
| 66 | +2. Langroid Framework: Install Langroid with necessary dependencies: |
| 67 | + pip install "langroid[litellm]" |
| 68 | +3. Setup the following env variables in the .env File in the root of your repo |
| 69 | +or set them on your terminal. |
| 70 | + export OPENAI_API_KEY=OPEN AI KEY |
| 71 | + export GEMINI_API_KEY=GEMiNi API KEY |
| 72 | + export METAPHOR_API_KEY=METAPHOR_API_KEY |
| 73 | +4. Please read the following page for more information: |
| 74 | + https://langroid.github.io/langroid/quick-start/setup/ |
| 75 | + |
| 76 | +Usage |
| 77 | +----- |
| 78 | +Run the CLI Application |
| 79 | +Start the application from the root of the langroid repo with: |
| 80 | + python examples/multi-agent-debate/main.py |
| 81 | + |
| 82 | +Options |
| 83 | +- Debug Mode: Run the program with debug logs for detailed output. |
| 84 | + python examples/multi-agent-debate/main.py --debug |
| 85 | +- Disable Caching: Avoid using cached responses for LLM interactions. |
| 86 | + python examples/multi-agent-debate/main.py --nocache |
| 87 | + |
| 88 | + |
| 89 | +Interaction |
| 90 | +1. Decide if you want to you use same LLM for all agents or different ones |
| 91 | +2. Decide if you want autonomous debate between AI Agents or user vs. AI Agent. |
| 92 | +3. Select a debate topic. |
| 93 | +4. Choose your side (Pro or Con). |
| 94 | +5. Engage in a debate by providing arguments and receiving responses from agents. |
| 95 | +6. Request feedback at any time by typing `f`. |
| 96 | +7. Decide if you want the Metaphor Search to run to find Topic relevant web links |
| 97 | + and summarize them. |
| 98 | +8. End the debate manually by typing `done`. |
| 99 | + |
| 100 | +Feedback Criteria |
| 101 | +----------------- |
| 102 | +The feedback mechanism evaluates debates based on: |
| 103 | +1. Clash of Values |
| 104 | +2. Argumentation |
| 105 | +3. Cross-Examination |
| 106 | +4. Rebuttals |
| 107 | +5. Persuasion |
| 108 | +6. Technical Execution |
| 109 | +7. Adherence to Debate Etiquette |
| 110 | +8. Final Focus |
| 111 | + |
| 112 | +License |
| 113 | +------- |
| 114 | +This project is licensed under the MIT License. |
| 115 | +""" |
0 commit comments