Generation Nodes
Note that enabling this feature will use credits when used in a playthrough. For more details, please view the licencing docs.
Generation nodes bring the capabilities of large language models directly into Charisma, giving you the flexibility to safely mix both author-written replies with generated replies.
To get started, toggle on the 'Is generation node available?' checkbox on the Story Overview page (note you need to be a Manager of the story to do this).
After a generation node has been created in the graph, you can click 'Edit prompt' to get started.
Selecting a model
The models available are:
- Anthropic's
claude-1
- Anthropic's
claude-instant-1
- Anthropic's
claude-2
- Anthropic's
claude-3-haiku
- Anthropic's
claude-3-5-sonnet
- Anthropic's
claude-3-opus
- OpenAI's
gpt-4
(GPT-4) - OpenAI's
gpt-4o
(GPT-4o-2024-08-06) - OpenAI's
gpt-4o-mini
(GPT-4o-mini) - Meta's
llama3.1 8B
- Meta's
llama3.2 3B
Writing a prompt
GPT-4o, GPT-4o-mini, GPT-4, Llama3.1, Llama3.2
Every message in the prompt is expected to have a role
associated with it. This can either be system
, user
or assistant
. For more information on the roles, see the OpenAI docs (opens in a new tab).
Charisma supports using multiple message in a single prompt by prefixing a block of one or more lines with system:
, user:
or assistant:
. Here's an example:
user:You are roleplaying as a fisherman, having a conversation with <player_name>. Say something about fish:
Generally, user
prompts are the most useful, though you may find you have use cases for other types of prompt.
Here's another example:
system: you are a poet
user: write a poem about dogs
assistant: Beside us on the winding trail, Through whispering winds and moonlight pale, Adventures shared, both big and small, Their joyful bark, a loving call.
user: now write one about cats that also features the phrase "moonlight pale"
Anthropic Claude 3 (haiku, opus) and Anthropic Claude 3.5 Sonnet
In line with GPT-4o, GPT-4o-mini and GPT-4, each message in the prompt is required to have an associated role. However, Anthropic exclusively accepts roles as either user
or assistant
.
As an example:
user:You are roleplaying as a fisherman, having a conversation with <player_name>.
user:Say something about fish:
Legacy Anthropic models
The legacy Anthropic models - including claude-1, claude-instant-1 and claude-2 - are simpler to use than GPT-4, GPT-4o, GPT-4o-mini or Anthropic Claude 3, and expect only text with no associated role
metadata. Here's an example:
You are roleplaying as a fisherman, having a conversation with <player_name>.
Say something about fish:
On the bottom-right of the Prompt editor, you already have the stop sequence pre-filled with \n
. Make sure to delete this if you expect line breaks.
Using prompt variables
In the above examples, we saw the use of <player_name>
. You can use any Charisma memories directly in the prompt! Simply use the same angle bracket syntax as in Character nodes.
There are also some special prompt variables which allow you to inject other useful bits of text.
<STORY_DESCRIPTION>
: Whatever was put in the story description on the "Story Overview" page.<GRAPH_DESCRIPTION>
: The description entered into the scene or subplot, by clicking "Edit details..." under the graph in the sidebar.<MESSAGE_HISTORY>
: The last few character and player messages in the conversation, in the following form:
Player: Hello there!
Character: It's good to meet you.
Player: Nice to meet you too.
Character: You're a pleasant one.
Note that Character
is replaced with the actual character's name.
By default MESSAGE_HISTORY
returns the latest 10 messages. You can increase or reduce this by putting a number in brackets specifying the number of messages you want to return, such as <MESSAGE_HISTORY(2)>
for the last 2 messages.
-
<PLAYER_MESSAGE>
: The text of the currently considered player message (withoutPlayer:
like in theMESSAGE_HISTORY
). A generation node with this in the prompt can only be after a Wildcard or Player node. -
<CHARACTER_BIO>
: The biography on the character page for the character selected in the Generation Node's Related Character drop-down. -
<CHARACTER_EXAMPLE_DIALOGUE>
: The example dialogue on the character page for the character selected in the Generation Node's drop-down.
Examples
system:You are a government official who has just listened to a pitch. The idea of the pitch is <player_idea>.
The PLAYER has just answered your question as best as they can. The question and answer are listed below.
<MESSAGE_HISTORY(2)>
Now, quote back what they said in a way that demonstrates that you don't really understand the concept. What you say should be similar enough to what the PLAYER said, but show you weren't really listening.
Do this in one sentence ending in the words "is that right?":
system:You are roleplaying as a court jester.
Scene context: <GRAPH_DESCRIPTION>
The PLAYER has just described why they want you to dance all day and all night. They said "<PLAYER_MESSAGE>".
Now respond to them, telling them why you can't just do what they say:
Using the generation
The generation can be used in any attached Character node by using the <Generation>
tag.
Additionally, a generation can be saved directly into a memory to then recall in the future, by selecting a memory on the Generation node. You can even use a generation saved into a memory in the prompt of a future generation, as described in using prompt variables!
If you use multiple Generation nodes in a row before a Character node, each relying on the output of the node before ('chaining'), note that this will significantly increase latency of the character responding to a player as the generations are performed sequentially. Here's an example:
Sometimes a generation may not generate successfully. For example, the request to the underlying model may fail, or either the input or output may not pass content moderation checks.
In these cases, it is highly recommended to have an alternative route with lower priority.
Increase the priority by selecting the connector into the generation node and pressing +
.
Limitations
Outputs are restricted to 150 tokens. Long outputs take a long time to generate so it's generally advised to include limit your response to 2 sentences
or similar in your prompts.
Even with short outputs, some models may take several seconds to generate, so be patient, and also experiment to find the best model for your use-case.
If the generated response exceeds 150 tokens it will end abruptly at that limit.
Analytics
You can review any generations for a Generation node by clicking the "View analytics" button on the node.
This will show you a list of the responses that were generated. The full prompt with any variable substitutions made can be reviewed by toggling the arrow to the left.