Lorebook
The Lorebook is the perfect place to flesh out your characters, locations, objects, factions and any other narrative elements in your story. You can think of the Lorebook as a repository for supplemental information that's added to the AI's context as each entry comes up in your story. Inside, you will also find tools to generate new lore entries.
You can Import and Export your lorebook with the buttons at the top left. The Image embed button lets you embed your Lorebook inside a .png image - this is a great way to share your Lorebook with others!
Supported file types for importing are: .json, .lorebook and a .png with an embedded Lorebook.
The image below is an example of an embedded Lorebook entry, try downloading the image and importing it to see how it works!
Goose Tip: The NovelAI Discord has a content sharing channel filled with Lorebooks and other creations made by the NovelAI community!
The Selection icon is used to select multiple entries for deletion or to choose which ones you want to export.
The Sort icon is used to sort entries alphabetically or by most recent.
The Search icon is used to perform a search.
Entries
Entries are the main component of your Lorebook. Each entry has its own activation key(s), and when an activation key is found in the recent context, the entry's text gets inserted into the context.
The Delete button deletes the selected entry, the Duplicate button makes a copy of it.
The Entry Title is only for organizational purposes and isn’t visible by the AI. For this reason, you should always include the entry’s title somewhere inside the entry text itself or else the AI won’t know what the entry is about.
The Enabled toggle on the right of the entry's title determines if the entry can be activated. A Disabled entry will not be inserted into the context even if its key is triggered.
Entry Text is the text that will be placed into the context when the entry is activated.
Activation Keys are the words or phrases that activate a lorebook entry when found in the recent story. Keys are case-insensitive.
Keys that begin and end with '/' are evaluated as regex. These regex keys are case-sensitive and support the following flags: i, s, m, and u. If the key is part of a placeholder, add a $ at the very beginning before the first /.
Goose Tip: Regular Expressions are an advanced topic with a steep learning curve. Consider checking out RegExr if you wish to learn more about it.
If Always On is enabled, the entry will always be inserted into the context regardless if their keys are found in the recent story or not.
The Hide button will mark the entry as hidden, preventing you from viewing its contents unless you choose to reveal it. This feature can be helpful when creating a scenario meant for sharing with others, allowing you to conceal details from the player.
Hidden entries will also be hidden from view inside the context viewer.
Generator
Want to write a lore entry but don't know where to start? Let the AI fill in the blanks for you!
The Lore Generator is a powerful tool that allows you to generate lore about any character, object, location or concept you can think of. First, choose the type of entry from the list, enter what you want to generate, and hit generate. You can also have the AI add to text already written in the Lore Entry, just like in the Editor.
Generation Type influences the generator towards generating a specific type of entry. A custom type can be set by typing with the dropdown open and hitting enter.
Input Text is the prompt used by the generator. Names like "Fogwood Keep" or short descriptions like "an enthusiastic merchant" work best. You can add tags in parentheses to further describe the entry, e.g. "Black Skull Fleet (pirates, space)"
Add Context (advanced) can be used to include Memory, Author's Note, the most recent story text (~2500 characters), or other lorebook entries in context so that information can be used when generating entries.
Generation History shows the last 50 outputs of the Lorebook Generator. Cleared on page refresh.
You can change the Model and settings preset used for Lorebook Generation by clicking on Change settings.
Placement
The Placement tab is where you can change where and how the entry text is inserted into the story context.
Note: The Placement tab is intended for experienced users. Only change the placement values if you understand how they work and what the effects will be.
Search Range is the number of characters of the story that will be searched for keys. Maximum of 10000.
Key-Relative Insertion causes the lorebook entry to be inserted relative to the last of its keys to be found within the context.
Positive insertion positions will insert the entry after the key.
Negative insertion positions will insert the entry before the key.
Entries with this setting enabled should typically have a lower Insertion Order than the story context (default 0) and a sufficient amount of reserved tokens. Large numbers of relatively inserted lorebook entries can slow down context creation.
Cascading activation causes the lorebook entry to search for keys in non-story context entries. Search range is not taken into account for non-story context entries. Text from the entry that caused the activation is not guaranteed to end up within the context.
Prefix is text that's added in front of the entry after trimming and before inserting into context.
Suffix is text that's added at the end of the entry after trimming and before inserting into context.
Token Budget is the maximum amount of tokens of the context the entry may use.
Decimal numbers between 0 and 1 (exclusive) will be interpreted as a percentage of the maximum context size (max tokens - output length).
Reserved Tokens is the amount of tokens of the context the entry may reserve for itself. All reservations are made before any entries are placed in context. An entry won't reserve more tokens than the amount it actually contains. For example, if reserved tokens are set to 200 and the entry's text is only 100 tokens, then only 100 tokens will be reserved.
Decimal numbers between 0 and 1 (exclusive) will be interpreted as a percentage of the maximum context size (max tokens - output length).
Entries are ordered by their Insertion Order before context is built. Entries with higher insertion order will reserve tokens and be inserted into the context first. If two entries share the same insertion order, there is no guarantee which will be inserted first.
Insertion Position is the location the entry will be inserted into the context. 0 is the very top of the context, 1 is one unit down, 2 is two units down etc. Negative Numbers will count from the bottom of the context starting with -1 at the very bottom, making -2 one unit up, -3 two units up, etc.
The Trim Direction is where the entry will be trimmed from when the entire entry doesn't fit in the context. If set to 'Do Not Trim' the entry will only be included if the entirety of its text fits within the context.
Maximum Trim Type is the extent to which the entry is allowed to be trimmed.
Insertion Type determines what units will be used to separate the context when inserting entries.
Phrase Bias
Phrase Bias allows you to increase or decrease the chance for certain words or phrases to be generated by the AI when the entry is active. Surround biases with {curly braces} to input exact text. Surround biases with [square brackets] to input token IDs (tokenizer specific). Biases are case-sensitive.
To make a phrase bias, type in the text area, then press enter to save.
You can import and export phrase biases as a .bias file by clicking on the Import and Export buttons.
Biases are organized in groups, each with its own Bias value, which is applied to all tokens and phrases inside it. You can have several groups of phrase biases in a single lorebook entry.
To create a new bias group, click the Add button. The currently selected group can be deleted with the Delete button.
Bias Value represents how much the group of tokens is being biased
The effect of Bias Value varies wildly depending on the AI Model you're using. For example, Krake is much more sensitive to biases compared to other models, so a good rule of thumb is to use decimal values.
Enable is used to toggle whether the bias is enabled or disabled.
When Entry Inactive reverses the group's activation behavior. When enabled, this bias group will be applied when the entry is inactive instead of when active.
If Ensure Completion After Start is enabled, when the first token of a phrase is generated, subsequent tokens will always generate.
If Unbias When Generated is enabled, after a phrase is generated, its bias will be removed for the rest of the generation. This will not prevent it from being generated, only remove the bias placed on it.
Categories
Categories are used to organize your lorebook entries into groups.
The Default tab lets you change the default placement settings of new entries made inside that category or update the settings of all existing entries.
The Subcontext tab has the Create Subcontext toggle. Enabling it will group up the Lorebook entries in that category, which will then be inserted into context using the chosen settings.
The Phrase Bias tab has the same functionality as the entry phrase bias tab, except that biases set at the category level will be activated when any entry inside that category is active.