Prompt Reference
Prompts are authored using Jinja2-style syntax. Refer to the Jinja2 documentation for details:
https://jinja.palletsprojects.com/en/stable/templates/
Prompt Blocks
Prompts can include other prompts, referred to as “blocks”. This is useful to organize common formatting and logic so it can be easily reusable. To include a block, use the Jinja include function and provide the ID of the prompt to include. For example:
{% include "prompt_block_selected_character_memories" %}
Globals
You have access to a set of global variables that contain relevant data for prompt generation:
| Variable | Type | Description |
|---|---|---|
actor |
Actor |
The Actor for whom the prompt is being generated. |
s |
Snapshot |
The current snapshot that contains all relevant StoryEngine state. |
ra |
RenderAction |
The RenderAction that invoked the Prompt evaluation |
ctx |
Context |
The context object from the Event that triggered the RenderAction. This typically contains the JSON payload from the game that emitted the event. |
actions |
Actions |
MutationActions that will be applied when the tick is complete. |
incidents |
Incident |
Relevant history incidents for this tick. |
Types
Actor
Represents a snapshot of an actor in the system.
Methods
GetID() string: Retrieves the unique identifier of the actor.GetSourceID() *string: Retrieves the source identifier, if available.GetName() string: Retrieves the name of the actor.GetTimestamp() time.Time: Retrieves the timestamp of the actor snapshot.GetWorldID() string: Retrieves the ID of the world the actor belongs to.GetLocationID() string: Retrieves the ID of the location where the actor resides.GetFactIDs() []string: Retrieves the IDs of facts associated with the actor.GetMemoryIDs() []string: Retrieves the IDs of memories associated with the actor.GetValidEpisodeIDs() []string: Retrieves the IDs of valid episodes linked to the actor.GetStoryHistory() string: Retrieves the actor's story history.GetTempSubmittedAnswerIDs() []string: Retrieves temporary IDs of submitted answers by the actor.
Location
Represents a snapshot of a location in the system.
Methods
GetID() string: Retrieves the unique identifier of the location.GetSourceID() *string: Retrieves the source identifier, if available.GetName() string: Retrieves the name of the location.GetTimestamp() time.Time: Retrieves the timestamp of the location snapshot.GetLat() float32: Retrieves the latitude of the location.GetLng() float32: Retrieves the longitude of the location.GetFactIDs() []string: Retrieves the IDs of facts associated with the location.GetValidEpisodeIDs() []string: Retrieves the IDs of valid episodes linked to the location.GetDestinationIDs() []string: Retrieves the IDs of potential destination locations.
Item
Represents a snapshot of an item in the system.
Methods
GetID() string: Retrieves the unique identifier of the item.GetSourceID() *string: Retrieves the source identifier, if available.GetName() string: Retrieves the name of the item.GetTimestamp() time.Time: Retrieves the timestamp of the item snapshot.GetOwnerID() *string: Retrieves the ID of the item's owner, if available.GetLocationID() string: Retrieves the ID of the location where the item resides.GetFactIDs() []string: Retrieves the IDs of facts associated with the item.GetValidEpisodeIDs() []string: Retrieves the IDs of valid episodes linked to the item.
PassiveGoal
Represents a snapshot of a passive goal in the system.
Methods
GetID() string: Retrieves the unique identifier of the goal.GetSourceID() *string: Retrieves the source identifier, if available.GetOwnerID() *string: Retrieves the ID of the goal owner, if available.GetWebhookURL() string: Retrieves the webhook URL for the goal.GetRequestID() string: Retrieves the request ID for the goal.GetGoalDefinitionID() string: Retrieves the goal definition ID.
ActiveGoal
Represents a snapshot of an active goal in the system.
Methods
GetID() string: Retrieves the unique identifier of the goal.GetSourceID() *string: Retrieves the source identifier, if available.GetOwnerID() *string: Retrieves the ID of the goal owner, if available.GetWebhookURL() string: Retrieves the webhook URL for the goal.GetRequestID() string: Retrieves the request ID for the goal.GetGoalDefinitionID() string: Retrieves the goal definition ID.
GoalDefinition
Represents a snapshot of a goal definition in the system.
Methods
- Various methods for retrieving IDs and associated entities, such as facts, actors, items, and locations.
- Methods for determining goal completion, creating actions, and retrieving metadata.
MutationActionDefinition
Represents a snapshot of a mutation action definition.
Methods
GetID() string: Retrieves the unique identifier of the mutation.GetSourceID() *string: Retrieves the source identifier, if available.
RenderActionDefinition
Represents a snapshot of a render action definition.
Methods
GetID() string: Retrieves the unique identifier of the render action.GetSourceID() *string: Retrieves the source identifier, if available.
Fact
Represents a snapshot of a fact in the system.
Methods
GetID() string: Retrieves the unique identifier of the fact.GetText() string: Retrieves the textual representation of the fact.
Asset
Represents a snapshot of an asset in the system.
Methods
GetID() string: Retrieves the unique identifier of the asset.GetURL() string: Retrieves the URL of the asset.GetContentType() string: Retrieves the content type of the asset (e.g., image, video).
Incident
Represents a snapshot of an incident in the system.
Methods
GetID() string: Retrieves the unique identifier of the incident.GetText() string: Retrieves the description of the incident.GetValidEpisodeIDs() []string: Retrieves the IDs of valid episodes linked to the incident.GetLocationID() string: Retrieves the ID of the location associated with the incident.GetSubjectActorIDs() []string: Retrieves the IDs of the actors involved in the incident.
Memory
Represents a snapshot of a memory in the system.
Methods
GetID() string: Retrieves the unique identifier of the memory.GetText() string: Retrieves the textual content of the memory.GetTag() string: Retrieves the tag associated with the memory.IsSharableWithActor(memoryOwner ActorSnapshot, withActor ActorSnapshot, ctx interface{}, ss *Snapshot) (bool, error): Determines whether the memory is sharable with another actor under the given context.
MemorySharingRule
Represents a snapshot of a memory-sharing rule in the system.
Methods
GetID() string: Retrieves the unique identifier of the rule.GetWorldID() string: Retrieves the world ID where the rule is applied.GetOwnerID() *string: Retrieves the owner ID of the memory-sharing rule, if available.GetMemoryID() *string: Retrieves the ID of the memory associated with the rule, if available.GetTag() string: Retrieves the tag associated with the memory-sharing rule.GetRule() string: Retrieves the actual rule for sharing the memory.GetDescription() string: Retrieves the description of the memory-sharing rule.IsSharableWithActor(memoryOwner ActorSnapshot, actor ActorSnapshot, ctx interface{}, ss *Snapshot) (bool, error): Determines if the memory can be shared with a specific actor under the given context.
Answer
Represents a snapshot of an answer in the system.
Methods
GetID() string: Retrieves the unique identifier of the answer.GetText() string: Retrieves the text of the answer.
Episode
Represents a snapshot of an episode in the system.
Methods
GetID() string: Retrieves the unique identifier of the episode.GetSourceID() *string: Retrieves the source identifier, if available.GetName() string: Retrieves the name of the episode.GetCompleted() bool: Retrieves whether the episode is completed.GetCompleteCriteriaGoalDefinitionID() *string: Retrieves the ID of the goal definition associated with completing the episode, if available.
Event
Represents a snapshot of an event in the system.
Methods
GetID() string: Retrieves the unique identifier of the event.GetWorldID() string: Retrieves the world ID in which the event occurs.GetOwnerID() string: Retrieves the ID of the event's owner.GetWebhookURL() string: Retrieves the webhook URL associated with the event.GetRequestID() string: Retrieves the request ID associated with the event.GetEventTypeID() string: Retrieves the event type ID.GetTargetActorIDs() []string: Retrieves the IDs of the target actors associated with the event.GetTargetItemIDs() []string: Retrieves the IDs of the target items associated with the event.GetTargetLocationIDs() []string: Retrieves the IDs of the target locations associated with the event.GetSubjectActorIDs() []string: Retrieves the IDs of the subject actors associated with the event.GetSubjectItemIDs() []string: Retrieves the IDs of the subject items associated with the event.GetSubjectLocationIDs() []string: Retrieves the IDs of the subject locations associated with the event.GetSubjectMemoryIDs() []string: Retrieves the IDs of the subject memories associated with the event.GetSubjectFactIDs() []string: Retrieves the IDs of the subject facts associated with the event.GetContext() string: Retrieves the context or description of the event.