An AI chatroom (beginnings)

Posted on 29 December 2024 in Programming, Python, AI

So, I know that I decided I would follow a "no side quests" rule while reading Sebastian Raschka's book "Build a Large Language Model (from Scratch)", but rules are made to be broken.

I've started building a simple Telegram bot that can be used to chat with multiple AI models at the same time, the goal being to allow them to have limited interaction with each other. I'm not sure if it's going to work well, and it's very much a work-in-progress -- but here's the repo.

More info below the fold.

The reason I started looking at this was because I was leaning on chats with both Claude and ChatGPT to help me understand some of the underlying concepts I was encountering in the LLM book. And while they were both helpful, having two separate chats running and copy/pasting ideas between them was becoming a bit of a pain.

"What if", I thought, "I could just have one chat with both? Perhaps I could get them both (and maybe even Grok and DeepSeek) into the same Telegram chat, and I could get thoughts from multiple AIs at once, perhaps even with the possibility of them correcting each other or addressing each others' points. How hard could it be?"

I figured that I could get Claude to rough something out, and it did a reasonably decent job, but after playing with it a bit I decided I really didn't like the architecture it had chosen, so I spent some time refactoring it into a shape that I liked.

After a few hours work, I have something that works. You can see it at the repo linked above. To use it, just install the requirements and set the environment variables as per the README, then python bot.py.

The code structure is still undergoing heavy refactoring, and I need to work out how to get the AIs to understand the structure of the conversation better (I think that currently they're tripping over the fact that all AI messages in the history are tagged as "role": "assistant", and they should instead have their own messages tagged that way and other bots' messages tagged as "user"). But I'm going to play with it a bit more and see if I can get it to a stage where it's useful, even if it's just useful for me.