Prompt Examples
Examples of prompts for various use cases. Learn how to use prompt functions effectively.
Dynamically Referencing a Codex Entry
How do I dynamically load a codex entry based on e.g. the current chapter number? Like this: “Reference Chapter X Details” where X is the current chapter.
{#if codex.has("Chapter " + chapter.number + " Details")}
Reference the following for extra details:
{codex.get("Chapter " + chapter.number + " Details")}
{#endif}
Getting a specific number of Summaries
Is it possible to automatically include the summaries of only the most recent 3 scenes in a prompt?
{takeLast(chapter.summary(storySoFar),3)}
storySoFar
/storyToCome
Parameters
Can I filter the context from storySoFar and storyToCome? For example, can I limit it to just the current Act or a specific character’s point of view?
You can provide most things: novel
, act
, chapter
and scene
work as you would expect.
Character codex entries will look for any scenes with that POV and use the summaries from all of them.
You can also add as many arguments as needed, and the output will be the intersection of all of them (meaning if you supply Chapter 2
and the current Scene, you will only get the scenes from chapter 2 with the same POV as the current scene)
Detect the used model
How can I provide model-specific instructions within a single prompt? For instance, if one model in a collection requires additional instructions than the others.
{#if "qwen" in lowercase(prompt.model)}
{! qwen specific instructions !}
{#endif}
Input Fallback
Is there an easier way to have a fallback value for an input instead of nesting
{#if}
statements?
{either(input("Input"), "Fallback")}
This will return the value of the input if it is defined; otherwise, it will return “Fallback”.
How to create Words Input
How can I add a word count input to my prompt, similar to the one in the General Purpose prompt?
See here: How to make a Prompt Input
Getting All Codex Entries by Type or Category
How do I get a complete list of all codex entries, not just the ones in the current context? For example, I want to list all Character entries in the entire novel, or all entries from my custom ‘Timeline’ category.
To get all Codex Entries and not just the current Context, you need to supply codex.all
to the corresponding codex function.
For built-in types like Characters, Lore, etc.:
{codex.characters(codex.all)}
{codex.lore(codex.all)}
{codex.subplots(codex.all)}
For custom categories:
{codex.all(codex.category("Timeline"))}
Summary Without XML
How can I format a summary as a simple paragraph of text, instead of the default XML structure?
With scene titles:
{! For the current scene !}
{asPlainText(scene.summary)}
{! For a specific scene input: !}
{asPlainText(scene.summary(input("summary")))}
Chapter 1 - Scene 1: scene 1 summary
Chapter 1 - Scene 2: scene 2 summary
Without scene titles:
{asPlainText(content(scene.summary(input("summary"))))}
scene 1 summary
scene 2 summary
List all currently existing character names
How do I show the AI a list of all existing character names so it doesn’t accidentally reuse one?
{codex.name(codex.characters(codex.all))}
If you leave out the codex.all
you only get the names of the characters in the current context, which is not useful here.