Skip to content

Redefine Roles Operator

The Redefine Roles LOP allows you to dynamically change the role (e.g., ‘user’, ‘assistant’, ‘system’) of messages passing through it, based on specified patterns or conditions. This is useful for manipulating conversation history before sending it to an LLM.

  • None (standard TouchDesigner installation).
  • Input Conversation (Table DAT): Table with conversation data. Required columns: role, message. Optional: id, timestamp.
  • Output Conversation (Table DAT): Contains the conversation with redefined roles. Other columns are copied.
Set User Role (Setuser) op('redefine_roles').par.Setuser Menu
Default:
user
Options:
user, assistant, system
Set Assistant Role (Setassistant) op('redefine_roles').par.Setassistant Menu
Default:
assistant
Options:
user, assistant, system
Set System Role (Setsystem) op('redefine_roles').par.Setsystem Menu
Default:
system
Options:
user, assistant, system
Bypass (Bypass) op('redefine_roles').par.Bypass Toggle
Default:
Off
Show Built In Pars (Showbuiltin) op('redefine_roles').par.Showbuiltin Toggle
Default:
Off
Version (Version) op('redefine_roles').par.Version String
Default:
None
Last Updated (Lastupdated) op('redefine_roles').par.Lastupdated String
Default:
None
Creator (Creator) op('redefine_roles').par.Creator String
Default:
None
Website (Website) op('redefine_roles').par.Website String
Default:
None
ChatTD Operator (Chattd) op('redefine_roles').par.Chattd OP
Default:
None
  • Generally fast due to simple table operations.
  • Very large input tables might slightly impact network performance.
  1. Create a redefine_roles LOP.
  2. Connect a Table DAT containing your conversation (with role and message columns) to the input of the redefine_roles LOP.
  3. On the redefine_roles LOP, set Set User Role to assistant.
  4. Set Set Assistant Role to user.
  5. Keep Set System Role as system (or change if desired).
  6. The output DAT will now have the user and assistant roles swapped.
  1. Create a redefine_roles LOP.
  2. Connect a Table DAT containing your conversation to the input of the redefine_roles LOP.
  3. Set Set System Role to assistant.
  4. Keep Set User Role as user and Set Assistant Role as assistant.
  5. The output DAT will now show original system messages as assistant messages.
  • Correcting mislabeled roles in conversation logs.
  • Adapting conversations for models requiring different role structures.
  • Experimenting with conversational dynamics.
  • Preprocessing conversation data for other LOPs.