BoT (Balaur of thought): The friendly manual

If you're looking for download links and/or installing instructions, they can be found HERE.

Wait what?

BoT is a Silly Tavern Script and was initially made available on the r/SillyTavernAI subreddit under the name VoT at version 3.2. Since then I learnt some proper romanian spelling and had to rename it to BoT, which stands for Balaur of Thought.

BoT is meant to enhance the RP experience, be it E or not by forcing short-term memory, basic logic and common-sense on (modern) LLMs. Just keep in mind this is experimental work, and your mileage may vary for a specific combination of LLM, samplers configuration, persona, character card, writing-style, and expected results.

The idea behind it comes from the observation that LLMs like llama-3 or mistral are fairly decent when directly asked basic logic questions, but fail catastrophically at it during RP, when left on their own. The obvious thing was then to directly inject specific information into the context. Then crafting prompts that force the LLM to reflect upon certain things. One thing led to the next and BoT became a thing.

What does it do exactly?

I recommend you use BoT on a fresh new chat.
On chat load, BoT will decide whether the character card belongs to a single character or to multiple characters and format prompts specifically for each case. The LLM is not used for this, instead, if the {{char}} macro cobtaibs " and ", "And ", or "&" the card is considered multi-character.
Upon your first message, a number of things will happen:

  1. A compact comment titled Scene analysis will appear in the chat.
  2. A compact comment titled Spatial analysis will appwar in the chat.
  3. A compact comment titled **Dialog analysis will appear in the chat.
  4. A compact comment titled **Branching analysis will appear in the chat.
  5. The actual reply from the LLM-driven character will appear. Ideally, following all prior guidelines, thus improving the chat.

From the second user mesaage on, something slightly different will happen. First, all prior analyses will dissappear from the chat. Then, steps 2 to 5 will occur. This is because the scene analysis is generated only once.

Them fancy buttonz!

Additionally, a toolbar with a numbet of icons are attached to the top of the input bar:

  • [👀] - Viewing menu
  • [🧠] - Analyses menu
  • [🤔] - Rethink menu
  • [📝] - Edition menu
  • [🛠️] - Additional tools
  • [❓] - About

The choice of emoji icons is a way to make BoT mobile-friendly, since I am a mobile user myself.

[👀] Viewing menu

Opening it will give access ro 2 submenus:

View prompts: A list of the differebt prompts will be displayed. Upon selecting one it will be displayed as a compact comment on the chat, with color-coded text.

View analyses: An analydis type has to be selected and a message number input (The message number corresponds to a user message). The analysis is then displayed as a popup.

[🧠] Analyses menu

This menu allows user to customize the behavior of analyses, but in order to understand it's use, there's something you need to know:

  1. Every analysis generated incorporates the results of all previous analysis of the same batch in their prompts.
  2. To generate the character reply, the fact that the analyses are on the chat or not is irrelevant. They are put in the chat just so you have somethibg to read While the reply generates. Instead, analyses are injected in the context in-chat at depth 0, that is, after the last message.

Knowing those two things, it vecomes obvious that there's more than a way to do the same prompting-injecting drill. The analyses menu is meant to configure exactly how:

  • Analyze: Allows to enable or diaable different types of analyses. If disabled, no new analysis of that type will be generated, shown in the chat, nor injected into the context.
  • Mindread: Allows to show new analyses in the chat or not. When disabled, a new analysis of that type may be generated if enabled but not shown in the chat.
  • Injection: Allows user to customize which type of analysis is injected into the context.In order to be generated, an analysis type needs to be enabled in

[🤔] Rethink

Similar to the regenerate function of ST. It allows finer control on what is being rethought ans how. Rethink all has the same functionality as in prior versions, that is deleting the last batch of analysed (spatial, dialog and branches) and regenerating them from scratch and then regeneraring a char reply.

A number of individual analyses can be rethought, if so, the user will be prompted for an additional instruction to be added to the prompt in order to avoid repeating the error. If thr additional instruction is empty or cancelled the analysis will be generated anyway. Either way the new analysis replaces the old one.

Finally just the last char's message can be rethought, which performs the same ephemeral injection into the context that made the original message. The new one replaces the old one, so careful if you don't want to lose it.

[📝] Edit menu

This one gives a lot of fine control on the orompts and analyses. It contains 3 submenus, bamely edit prompt, reset prompt, and edit analysis. But first some context regarding prompts.

For each analysis, there's a prompt that generates it. A prompt is typically made of three types of text:

  • Common strings such as the "do not roleplay..." at the beginning of each one.
  • A prefix such as the "... keep spatial awareness in mind..." for spatial analysis.
  • Questions such as "What items of clothing is {{char}} wearing?"

The prompt edit and reset allow user to control every individual bit if text that makes up each prompt.

  • Edit prompt: The different analyses types are displayed and in selecting one the individual bits can be modified here. If the modified bit is a question the user might enter a label for it afterwards, this label is only for the user to navigate through prompt bits with ease and the LLM has no access to labels.
  • Reset a prompt: It will display a submenu like the one for prompt editing, and upon selecting an analysos type a list of the edited prompts will appear (or a warning if there is none). If the specific prompt bit to be reset has a custom label, the label will be reset to the default value as well.
  • Edit analysis: A list with the analyses types is displayed. Only the last batch of analyses can be edited. The modified version replaces the old one in both injection and chat (if mindread is on). Keep in mind that for an edited prompt to have any effect, char's last message should be rethought with the mew analysis version.

[🛠️] Additional tools

These are simple but convenient RP tools.

  • Why?: This will ask the LLM why the character's last reply was the way it did. The "I demand an explanation!" button, if you will.
  • Rephrase: Useful when char uses a different person or tense from what it's been using. You can also specify an instruction manually. You can choose which in the submenu. Once generated, the rephrased text will appear on a new input, so you can proofread it and modify it. If accepted, it will replace last character's message. Cancelling will discard the rephrased version and keep the old one instead.
  • Translate: NOT meant as an alternative to ST's built-in translation. This exists instead to evaluate the LLMs translation capabilities.
  • Sync: Similar to the like-named slash command. It replaces all instances of old {{user}} macro with the new value of the same macro in the prompts and unjections. If you want to sybc old messages, you still need to use the /sync slash command.

[❓] About

You probably don't need help to figure this one out.

Thanks! I hate it!

If you need to clean up the around 200 global variables and/or the around 100 local ones, just run /run BOTKILL before disabling BoT.

Wtf is a balaur and why would someone want a LLM to think like one?

A balaur is a 3-headed dragon from romanian mythology. I named my script Balaur of thought in-linw with train, chain and tree of thought. Initially I was just trying to write a script to implement tree of thought, but realized all branches led to the land of hallucination and stupidity; I added a corpus of analyses to the branch-generating prompt and got way better results.

So I ended up with a prompt made of a body of analyses and options on where to head next. The name Balaur sounded appropriate. So in typical me style I proceeded to misspell it lol. By version 3.3 I corrected the name and by 3.4 (hopefully) all variable mames, comments and databank entries will be corrected.

Edit
Pub: 17 Aug 2024 11:14 UTC
Edit: 30 Aug 2024 19:11 UTC
Views: 3009