Role Creator Operator
The Role Creator operator is a powerful utility for dynamically generating system prompts (personas) for AI assistants. It takes a high-level user description of a desired persona and uses an LLM with a specialized “meta-prompt” to craft a detailed, tailored system prompt. This generated prompt can then be easily assigned to an Agent operator to define its behavior, expertise, and personality.
This operator streamlines the process of creating and managing different AI roles within a TouchDesigner project, allowing for rapid prototyping and iteration of AI agent behaviors without manual prompt engineering.
Requirements
Section titled “Requirements”- ChatTD Operator: This operator requires a valid
ChatTD
operator to be specified in its ‘About’ page parameters. TheChatTD
operator handles all the underlying API communication with the selected LLM provider. - API Credentials: The referenced
ChatTD
operator must be configured with the necessary API keys for the selected LLM service (e.g., OpenAI, OpenRouter, Groq).
Input/Output
Section titled “Input/Output”The Role Creator operator does not have standard DAT inputs. It operates based on its internal parameters and generates DATs as outputs.
Outputs
Section titled “Outputs”output_dat
(Text DAT): Contains the final, generated system prompt (persona). This is the primary output.history_table
(Table DAT): A log of all generation requests made by the operator, including response metadata like tokens used, model, and response time.meta_prompt_dat
(Text DAT): An internal DAT containing the meta-prompt. Users can view and edit this DAT to change how personas are generated.info_dat
(Text DAT): Contains helpful information and usage instructions for the operator.model_info
(Table DAT): Displays detailed information about the currently selected AI model.
Parameters
Section titled “Parameters”Page: Options
Section titled “Page: Options”op('role_creator').par.Active
Toggle - Default:
false
op('role_creator').par.Generateprompt
Pulse - Default:
None
op('role_creator').par.Promptdescription
String - Default:
None
op('role_creator').par.Metapromptdat
OP - Default:
./meta_prompt_dat
op('role_creator').par.Addreftoagent
Toggle - Default:
false
op('role_creator').par.Sendtoagent
Toggle - Default:
true
op('role_creator').par.Agent
OP - Default:
None
op('role_creator').par.Reset
Pulse - Default:
None
Page: Model
Section titled “Page: Model”op('role_creator').par.Maxtokens
Int - Default:
4096
op('role_creator').par.Temperature
Float - Default:
2.0
op('role_creator').par.Modelcontroller
OP - Default:
None
op('role_creator').par.Search
Toggle - Default:
false
op('role_creator').par.Modelsearch
String - Default:
None
Callbacks
Section titled “Callbacks”The Role Creator does not have its own dedicated callbacks DAT, but it triggers the Customapicall
functionality within the referenced ChatTD
operator. The response from the LLM is handled internally by the HandleResponse
method in the Role Creator’s extension.
Usage Examples
Section titled “Usage Examples”Generate a Simple Persona
Section titled “Generate a Simple Persona”- On the ‘Options’ page, enter text into the
Persona Description
parameter, for example: “You are a helpful assistant that only speaks like a pirate.” - Pulse the
Generate Persona Prompt
parameter. - Change the
Display
parameter to “Output” to view the generated pirate-themed system prompt in the node viewer, or view theoutput_dat
directly.
Assign Persona to an Agent
Section titled “Assign Persona to an Agent”- Create an
Agent
operator (e.g., namedagent1
). - On the Role Creator’s ‘Options’ page, set the
Agent Path
parameter to point to your agent:../agent1
. - Enter a
Persona Description
(e.g., “You are a concise expert on TouchDesigner.”). - Enable the
Send Text to Agent
toggle. - Pulse
Generate Persona Prompt
. The generated text will be sent directly to theagent1
operator’s system message DAT. - Alternatively, enable
Assign Output DAT to Agent
to create a live reference, where any new persona generated will automatically update the agent.
Technical Notes
Section titled “Technical Notes”- This operator relies on a connection to a configured
ChatTD
operator (specified on the ‘About’ page) to perform the LLM call for generation. Ensure theChatTD
operator is set up correctly with API keys and necessary configurations. - The quality of the generated persona depends heavily on the clarity of the
Persona Description
and the instructions within theMeta Prompt DAT
. You can edit themeta_prompt_dat
to fine-tune how the operator instructs the LLM.