This is a meta-issue for a collection of AI features. Please review the proposal; then we can plan for implementation by you and me, or delegation to other students.
Helpers
#context This is a tag which indicates that the tagged content should not be displayed, but should be included in the story's state history for AI context. Unfold Studio generally uses tags to style content.
input() This externally-bound function presents a text input for the user. This could be used in non-AI stories to capture user input (e.g. playerName = input()). Authors have gone to great lengths to collect user input in the past. We may want to provide options to style the input as a paragraph textbox.
SEED_AI(number) This sets a seed for AI interfaces. Follows the SEED_RANDOM built-in function. A static default AI seed will be used when SEED_AI is not called. Backend AI calls will be memoized with (seed, prompt), substantially saving on AI API expenses. The default AI seed will be changed with each minor release of Unfold Studio, allowing for tweaks to AI params and meta-prompts.
AI interfaces
generate(prompt). Returns text generated according to the prompt. This is already implemented.
continue(->target). This prompts the story to automatically generate a series of story turns, followed by open-ended user input (via input()). For each story turn, the entire state history is used as context. The ->target knot is interpreted as the conditions for returning control flow to the story:
Any content in ->target is taken as the target conditions; the meta-prompt instructs the AI to try to steer interaction with the user toward those conditions. Each turn, the user is presented with an input text box. After each each user input, another call to AI evaluates whether the story can continue with the user input. There are four possibilities:
The story can continue with ->target.
The story can continue with ->target, but some generated text needs to be inserted first as a bridge.
The user's input moves us toward the target condition, but another story turn is needed to steer the story toward ->target.
The user's response was out of scope and needs to be rejected.
If ->target contains choices, then the choices are treated as an enumeration of possible conditions for resuming the story's control over flow. After each user input, the AI evaluates whether the story can continue with the content (if any) of ->target and the text of one of its options, with the same four possible outcomes as above. When the story continues, the final user input will be displayed, then the content of ->target, then the choice text of the selected choice, and then the story continues with the choice output.
agent(->character, ->target). Continues the story toward ->target in the same manner as continue(), but with a character interacting with the user. The ->character knot is pre-preprocessed as a sub-story, with a pre-specified number of Monte Carlo runs of ->character generating text to be used as a sort of RAG. The intended usage is that -> character is "lore", backstory, or an interview with the character, describing who they are.
Let's start working on this by confirming the feasibility of the proposed features--I created the beginnings of code to do this in the ai_affordances_dev branch, in the test_ai_narrative_collaboration dir.
This is a meta-issue for a collection of AI features. Please review the proposal; then we can plan for implementation by you and me, or delegation to other students.
Helpers
#context
This is a tag which indicates that the tagged content should not be displayed, but should be included in the story's state history for AI context. Unfold Studio generally uses tags to style content.input()
This externally-bound function presents a text input for the user. This could be used in non-AI stories to capture user input (e.g.playerName = input()
). Authors have gone to great lengths to collect user input in the past. We may want to provide options to style the input as a paragraph textbox.SEED_AI(number)
This sets a seed for AI interfaces. Follows theSEED_RANDOM
built-in function. A static default AI seed will be used whenSEED_AI
is not called. Backend AI calls will be memoized with (seed, prompt), substantially saving on AI API expenses. The default AI seed will be changed with each minor release of Unfold Studio, allowing for tweaks to AI params and meta-prompts.AI interfaces
generate(prompt)
. Returns text generated according to the prompt. This is already implemented.continue(->target)
. This prompts the story to automatically generate a series of story turns, followed by open-ended user input (viainput()
). For each story turn, the entire state history is used as context. The->target
knot is interpreted as the conditions for returning control flow to the story:->target
is taken as the target conditions; the meta-prompt instructs the AI to try to steer interaction with the user toward those conditions. Each turn, the user is presented with an input text box. After each each user input, another call to AI evaluates whether the story can continue with the user input. There are four possibilities:->target
.->target
, but some generated text needs to be inserted first as a bridge.->target
.->target
contains choices, then the choices are treated as an enumeration of possible conditions for resuming the story's control over flow. After each user input, the AI evaluates whether the story can continue with the content (if any) of->target
and the text of one of its options, with the same four possible outcomes as above. When the story continues, the final user input will be displayed, then the content of->target
, then the choice text of the selected choice, and then the story continues with the choice output.agent(->character, ->target)
. Continues the story toward->target
in the same manner ascontinue()
, but with a character interacting with the user. The->character
knot is pre-preprocessed as a sub-story, with a pre-specified number of Monte Carlo runs of->character
generating text to be used as a sort of RAG. The intended usage is that-> character
is "lore", backstory, or an interview with the character, describing who they are.