File size: 2,336 Bytes
0bfdd2a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---

title: PolyThink-YC
emoji: 💭
colorFrom: gray
colorTo: gray
sdk: gradio
sdk_version: "5.11.0"
app_file: App.py
pinned: true
---


# PolyThink Multi-Agent Problem Solver

A multi-agent system that uses multiple AI models to solve problems collaboratively through a consensus-based approach.

## Architecture

PolyThink uses a multi-agent architecture with three specialized AI models:

1. **Solver Agents**:
   - **Cohere Command R**: A powerful reasoning model that generates concise solutions
   - **Llama 3.2 3B**: A Meta AI model that provides alternative perspectives

2. **Judge Agent**:
   - **Gemini 2.0 Flash Thinking**: Evaluates solutions from solver agents and determines if they agree

The system works through multiple rounds of solution refinement until consensus is reached or the maximum number of rounds is completed.

## Setup

1. Clone this repository
2. Install dependencies:
   ```bash

   pip install -r requirements.txt

   ```
3. Set up your API keys:
   - Get your Hugging Face token from [Hugging Face](https://huggingface.co/settings/tokens)
   - Get your Cohere API key from [Cohere](https://dashboard.cohere.com/api-keys)
   - Get your Gemini API key from [Google AI Studio](https://makersuite.google.com/app/apikey)

## Usage

Run the application:
```bash

python App.py

```

The application will launch a Gradio interface where you can:
1. Enter your API keys for each service
2. Input a problem or question
3. Choose the number of rounds for solution refinement (1-3)
4. Watch as multiple AI agents collaborate to solve the problem in real-time

## Process Flow

1. Two solver agents generate initial solutions independently
2. The judge agent evaluates if the solutions agree
3. If solutions disagree, solver agents refine their answers based on feedback
4. Process repeats until agreement is reached or max rounds completed
5. A final report is generated showing the problem-solving process

## Dependencies

- gradio: Web interface framework
- huggingface_hub: Access to Hugging Face models

- cohere: Access to Cohere models

- google-genai: Access to Google's Gemini models



## Note



This application requires valid API keys for Hugging Face, Cohere, and Google Gemini. Make sure you have sufficient API credits for your usage.