Multi-bot setup

A multi-bot setup enables you to combine multiple bots into a single one. The router bot (or “parent“) will route the user’s query to any one of the linked bots (or “children“) that will then attend to the user query.

Note that the whole conversation history will be shared among the different bots so that they will have context as to what was discussed previously.

Setting up a multi-bot experiment

For this simple example, we’ll create four experiments in total: A router (or parent), a general bot, a quiz bot and a roleplay bot (children). The general, quiz and roleplay bots can be created as usual, so there’s nothing special about these. For the router bot, we have to tell it to route the user query to the appropriate child bot and when it should route the user’s query, so provinding a description for each of the children bots will help. Finally we also want a bot at the end which will translate the final out to the user’s language. This can be useful if you need to use a fine tuned model for the translation step.

Here is a diagram showing the final bot:

image-20240829-100415.png

 

Let’s take our example and see what the prompt for the router bot might look like:

You are a router. Your job is to route the user query to the appropriate bot. Do not attempt to answer the query yourself. Here are the available bots with their descriptions: general: This bot is a general conversation bot quiz: This bot performs a quiz with the user roleplay: This bot is good at roleplaying to help the user practice difficult conversations Respond only with the bot's name that should handle the user query

Once all bots are created (including the router bot), we should link them together so that the bot is able to route them. Below are the steps you should follow:

  1. Go to the experiment that you want to use as the router bot.

  2. Go to the “Routes“ tab and click “Create child route“

  3. Select which experiment to use as the child bot

  4. The keyword field should correspond to the name you gave the bot in the router’s prompt. In this example, the available keywords was general, quiz and roleplay. For this experiment route, we should choose general.

  5. Tick the “is default“ checkbox if you want to make this bot the default or “go to“ bot when the router bot is not certain to which child bot it should route the user query to. Note that there can only be one default bot among the child bots.

Now repeat this and create and Experiment Route for each child bot.

Now we will create and configure the translation step:

  1. Create a new experiment with the prompt for translation.

  2. Go to the “Terminal Bot” tab of the router bot.

  3. Click “Add Terminal Bot” and select the experiment you created in step 1.

Now you are done!

Please note: For child bots, mixing assistants and “normal” bots will result in unpredictable behaviour due to the way that history is being shared among them. It is advised that you use only assistants or normal bots for child bots. The router bot must be a normal bot.