Context

The Context is effectively the AI's memory. Understanding how it works will greatly help with leading to "good" generations.

Context Window

The context window is comprised:

View Last Context at the top of the Advanced tab of the settings panel opens a window which displays all the tokens sent to the AI for the previous generation. This helps you check if anything you feel is important was omitted. View Current Context does the same, but for the input you're about to send.


Elements of Context

Prompt

The prompt is displayed in cream by default. It is the first piece of text fed into the AI. If you have put anything into the Memory or Author's note, they will be inserted before it in the context before being sent to the AI.

image

Injected Text

Injected Text is any text that is not part of the story, but part of the context. All of these elements are injected text:

There are two important things to consider about injected text:

Square brackets are recommended mostly for Author, Title, Tags, Genre metadata in Memory (and Knowledge, Style tags for Clio and Kayra). The brackets must be separated from their contents by a space, and everything should be lowercase outside of category titles and proper nouns.

[ Author: George R.R. Martin; Title: A Song of Ice and Fire; Tags: dragons, politics, dynasty; Genre: fantasy ]


Memory

By default, the Memory is inserted at the top of the context, before anything else. Its position may be adjusted for a stronger (closer to the bottom) or a weaker (further to the top) effect.

Traditionally used it to make the AI remember broad context elements and the Author, Title, Tags, Genre metadata.

image


Author's Note

image

The Author's Note or A/N is identical in format and use to Memory, but it is inserted three newlines by default before the last token in the input. It has a greater influence as a result. The A/N's position may be adjusted for a stronger (closer to the bottom) or a weaker (further to the top) effect. Traditionally, it is used to either give immediate instructions, and immediately important information, such as the name of the POV character, the date, etc.

Keep in mind that Author's Note influence is extremely strong. It is strongly recommended to leave it empty unless you are using it for a specific purpose, after which it should be cleared. Leaving elements in the Author's Note can degrade generation quality.

Lorebook

Further described in the dedicated Lorebook page.


Why use Brackets?

Bracketed text is used specifically in the fine-tuning material for metadata, which includes Author, Title, Tags and Genre.

Brackets used for metadata, look like this:

[ Author: Neil Gaiman; Title: Sandman; Tags: ; Genre: Modern Fantasy; ]

As you can see, you can use empty categories, or even omit them outright. Note the spaces next to the brackets! For optimal effect on your story, it is recommended to include the metadata headers in their original order, even if they are empty. You can omit the first ones if they are empty, but it is better if you keep Genre: at the very least.

Each category is separated by a semicolon (;) and elements in a category are separated by a comma (,).

It is also usable for:

Bracketed text is thus best described as being read by the AI as "Pertinent information but not part of the text." This helps it keep things into memory without trying to continue from them as if they were sentences in the text.

Punctuation outside of colons is usually only as part of a chapter/work title.

You can encase only descriptive passages in Injected Text entries if they differ from the usual style of your prose.

Brackets do not notably affect the accuracy of the text - this is Generation Settings at work.

It is generally not recommended to use brackets in Euterpe or Krake for anything outside of the aforementioned purposes.

As a note, if you are using Krake, enable the Preamble in your AI settings to reinforce the Metadata's effect.


Context Viewer

The Context Viewer is a powerful tool to identify what elements were used by the AI in the last generation. This helps you diagnose Memory, Author's Note and Lorebook usage. Check for bloat, trimmed entries, or ones that take too much space using this tool.

image

Identifiers

Lists the Identifier of each element of the context that describes it's origin from one of the following:

Inclusion

Lists if this element is included in the context:

Reason

Lists the reason for this element's inclusion or omission:

Included

Omitted

Key

Lists the key that triggered this Lorebook entry.

Reserved

Lists the amount of tokens reserved for this entry. This is usually lower than the Reserved Tokens setting of that entry, as that setting is the upper limit.

Tokens

Lists how many tokens are used by this entry solely on its own. Tokenization can cause a couple extra (or sometimes less) tokens to be used when this entry is placed in the text.

Trim Type

Lists how this entry was trimmed. There are four trim steps, which occur in this sequence:

Advanced Context Settings

image

Remember all the advanced settings of the Lorebook? Those are used here, but for the Story, Memory and Author's Note.

These can be accessed in the Advanced Options collapse in the Options tab on the right.

This allows you to:


Ephemeral Context

image

Ephemeral Context entries are effectively time-sensitive Text injections. Think Mission Impossible:

This message will self-destruct in 30 seconds...

Every time you generate text, you perform a step. Ephemeral Context entries wait a certain number of steps, appear, remain for a certain number of steps, and disappear.

The syntax example is as follows: {0+30r~15,+5:[Angela's amnesia temporarily dissipates.]}

Several symbols are used to define the type of information specified:

Thus: {0+30r~15,+5:[Angela's amnesia temporarily dissipates.]} will add "\[Angela's amnesia temporarily dissipates.\]" to the context, five new lines from the top of the context, for fifteen steps, starting thirty steps after you set up this entry. Effectively, it'll be on half the time.

You may also add a ! after the first curly brace to be able to specify a temporarily inactive entry. This makes it always present except during the Ephemeral Context's entry duration.

{!0+30r~15,+5:[Angela's amnesia makes her forget why she is here and what she is doing..]}

This one will be off half the time, when the other entry is active.

You can also type out Ephemeral Context entries directly in the Input box.