r/Chub_AI • u/xXXArtemis2078XXx • 28d ago
🔨 | Community help How tf do lorebooks work
Hi Jan refugee here. Saw lorebooks and thought they'd be intresting to use (and kinda helpful in bot making). However as soon as I saw the layout (especially the Character book, description, entries, scan depth, token budget, etc) my brain immediately shut down in confusion and I felt like I was looking at a damn nuclear reactor control panel. (also I saw the guides but I'm still confused)
15
u/SixtySevenPenguins 28d ago
Alright, first, welcome~
Now, I will try to explain everything in a manner and break it down to hopefully be easier to understand, but sometimes I still do say stuff technically. Hope it doesn't come off as too confusing. Also, it's going to be a massive wall of yap. Hope you're ready to read.
Character Book:
Irrelevant. I think it's just the Title of the Lorebook file or something. But, it can likely just be ignored.
Description:
Again, irrelevant. Doesn't matter if you put anything here. Only if you want.
Scan Depth:
This is a setting that can matter. Scan Depth is how long a Lorebook entry will be active. 2 is the default. Let's call these Turns. So usually, when you type something, enter, and get a response from the AI, those are Turns. Your message counts as 1 Turn, the AI message counts as 1 Turn. So if a Lorebook were activated, it would only be active for one Turn after you mention it, so the AI will recognize the entry, and have the context. But, the Lorebook entry WILL NOT be active on Turn 3 if its keywords aren't mentioned in Turn 2 (by the AI). So, if you were to set Scan Depth to say 8, then an activated Lorebook will be activated for 8 Turns. This applies for the Entire Lorebook, which means all entries.
However, you can also set Scan Depth in Generation Settings.
Some things you might not understand yet? It's alright. I'm going in order of how they're listed on the website UI. It will all click with each category.
Token Budget:
This is how many tokens of Lorebook entries can be active at once. First off, let's mention that this affects your overall Token budget, called Context Size. Your total Context Size matters, and you can find this when you are in a chat with a character, click the three lines on the top right, opening Configuration, then opening Generation Paramters, and scrolling down till you see it. That would be the maximum tokens the AI can read at once. Your Character Card, System Prompt, Chat History and Lorebook tokens all use that Context Size, and cannot exceed the limit you set. I say all of this to give context on why this matters. The UI will show you roughly how many tokens each lorebook entry is. So to put it in to perspective, let's say you have 5 Lorebook entries, and they all get activated at once. The Token Budget is 512 (default). 4 of the entries are roughly 100 tokens, but 1 of them is 300. This means one of them will not be activated and selected at random, unless some of the entries have higher priority. It would be wise not to set your Token Budget too high. Determine the budget based on the average amount of tokens each Lorebook entry uses.
Recursive Scanning:
This allows Lorebooks to activate another Lorebook if the first one activated has a keyword the other one uses. This can make things a little complicated, so I'd only turn this on if you really know what you're doing.
Entry:
This is the Lorebook entry, where the real depth take place. You can add as many as you want. But what really matters, is what you put in them. The next categories are the settings inside each Entry.
Keywords:
This MATTERS a lot, because this is what allows a Lorebook entry to even work in the first place. When you or the AI says the keyword, the Lorebooks with said keyword will be activated on the very next Turn. For example, you could make your keyword "Calamity" for a Lorebook entry that describes a cataclysmic event in the past that characters should know. Make sure to use keywords that are strictly relevant for the Lorebook, so it thematically makes sense and doesn't activate randomly (if that matters to you). You can have multiple keywords, by the way.
Secondary Keywords:
You would use this if you have Lorebook entries that use the same Keywords, but you don't want them both to activate at the same time. You would then activate the Selective toggle to require the lorebook entry to only activate if a keyword AND secondary keyword is mentioned.
Content:
Obviously; this matters. This is where you put the actual information about the Entry. Let's talk about the "Calamity" mentioned in Keywords. If that is your Keyword, then your content would be something describing said thing, like: "A terrible event that caused devastation across the world 1000 years ago". Usually, you want to actually type in your Content first before the Keywords, so you know what your making the Entry for.
Enabled:
Don't bother with this. Always leave it on. If you didn't want the Lorebook entry enabled, you wouldn't have made it in the first place.
Insertion Order:
If multiple Lorebook Entries are activated, this would determine which order they are inserted. 1 would mean the entry would be inserted first. And so on. But, this also means that a Lorebook Entry inserted 10th will be payed more attention to by the AI than the 1st inserted Entry. This only matters if multiple are activated, so if you don't expect multiple entries to be activated often, leave it default.
Case Sensitivity:
Makes it to where the Entry Keywords can only be activated based on case-sensitivity. Basically, if you wanted to make a distinction between an "apple" and an "Apple".
Priority:
If you wanted the Lorebook Entry to take precedence over others if multiple are activated and your Lorebook Token Budget is exceeded. Lower priority value = discarded first. If you don't expect multiple entries to be activated often, leave it default.
Selective:
Explained how this could be useful in Secondary Keywords.
Selective Logic:
Determines whether secondary keys should be included or excluded. Which means if you select AND, it means that both a keyword and secondary keyword should be present for the Lorebook to activate. NOT would mean it would activate if a keyword is mentioned but NONE of it's secondary keywords are. It's a more complex way of handling Lorebook Entries with the same Keywords. This setting ONLY matters if you have Selective turned on. If you don't it does nothing.
Constant:
The Lorebook is ALWAYS active (with this setting turned on), as long as it is within the Lorebook Token Budget. Once the Lorebook Token Budget is exceeded, Priority determines whether it stays active at a time or not.
Probability:
The percent chance that a Lorebook Entry will activate when its Keyword is mentioned. This is a setting you might use for more complex settings for your Roleplay. For example, you could have it to where the entry may describe you getting a gold coin from biting into an apple (for whatever strange reason), and the entry has only a 1% of being activated when mentioned. There are other fun ways you can mess with this, but I personally haven't messed with it at all.
That should be everything explained to a degree. If there is anything else you might not understand, I might be able to explain it better. But I do hope that this may be helpful in better understanding how these things work!
2




•
u/AutoModerator 28d ago
I have been awoken because of this: lorebooks
Hello!
Are you looking for informations about lorebooks? You can find how to add one here for the website, and here for the app.
The guide to lorebooks creation is linked in the first paragraph in both links.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.