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:
assistant
Options:
user, assistant, system
Set Assistant Role (Setassistant) op('redefine_roles').par.Setassistant Menu
Default:
user
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:
0
Show Built In Pars (Showbuiltin) op('redefine_roles').par.Showbuiltin Toggle
Default:
0
Version (Version) op('redefine_roles').par.Version String
Default:
1.0.0
Last Updated (Lastupdated) op('redefine_roles').par.Lastupdated String
Default:
2024-11-06
Creator (Creator) op('redefine_roles').par.Creator String
Default:
dotsimulate
Website (Website) op('redefine_roles').par.Website String
Default:
https://dotsimulate.com
ChatTD Operator (Chattd) op('redefine_roles').par.Chattd OP
Default:
/dot_lops/ChatTD
  • Generally fast due to simple table operations.
  • Very large input tables might slightly impact network performance.
redef_op = op('redefine_roles1')
conv_dat = op('conversation_log')
redef_op.inputConnectors[0].connect(conv_dat)
redef_op.par.Setuser = 'assistant'
redef_op.par.Setassistant = 'user'
redef_op.par.Setsystem = 'system' # Keep system role the same
# Output DAT has user and assistant roles swapped
redef_op = op('redefine_roles1')
conv_dat = op('conversation_log')
redef_op.inputConnectors[0].connect(conv_dat)
# Change original system messages to appear as assistant messages
redef_op.par.Setsystem = 'assistant'
# Keep original user and assistant roles
redef_op.par.Setuser = 'user'
redef_op.par.Setassistant = 'assistant'
  • Correcting mislabeled roles in conversation logs.
  • Adapting conversations for models requiring different role structures.
  • Experimenting with conversational dynamics.
  • Preprocessing conversation data for other LOPs.