Skip to content

Add Message Operator

The Add Message operator allows you to dynamically insert messages into a conversation table within your TouchDesigner project. This is useful for simulating user input, testing chatbot responses, or pre-populating a conversation with system messages. The operator supports various message roles (user, assistant, system), injection locations (start, end, index), and can pull message text from an external DAT. It leverages a shared sidecar server for asynchronous tasks, ensuring smooth operation without blocking the main TouchDesigner thread.

  • Sidecar Server: Must be running (shared with other LOPs like Florence).
  • No additional Python packages required.
  • Input 1 (Conversation Table, DAT, Optional): If provided and Use Input Conversation is enabled, this table is the initial conversation. Columns: role, message, id, timestamp.
  • Input 2 (Text DAT, Optional): If Text From Dat [ in2 ] is enabled, text from this DAT is injected.
  • Output Conversation Table (DAT): Contains the injected message plus any input conversation messages. Columns: role, message, id, timestamp.
Insert Message (Insert) op('add_message').par.Insert Toggle
Default:
1
Message Role (Role) op('add_message').par.Role Menu
Default:
user
Options:
user, assistant, system
Message to Inject (Message) op('add_message').par.Message String
Default:
i add message here
Text From Dat [ in2 ] (Fromin2) op('add_message').par.Fromin2 Toggle
Default:
0
Use Input Conversation (Useinput) op('add_message').par.Useinput Toggle
Default:
1
Inject Location (Location) op('add_message').par.Location Menu
Default:
end
Options:
end, start, index
Insert Index (Index) op('add_message').par.Index Integer
Default:
3
Inject ID (Injectid) op('add_message').par.Injectid String
Default:
add_message
Spacer Header
Bypass (Bypass) op('add_message').par.Bypass Toggle
Default:
0
Show Built In Pars (Showbuiltin) op('add_message').par.Showbuiltin Toggle
Default:
0
Version (Version) op('add_message').par.Version String
Default:
1.0.0
Last Updated (Lastupdated) op('add_message').par.Lastupdated String
Default:
2025-01-13
Creator (Creator) op('add_message').par.Creator String
Default:
dotsimulate
Website (Website) op('add_message').par.Website String
Default:
https://dotsimulate.com
ChatTD Operator (Chattd) op('add_message').par.Chattd OP
Default:
/dot_lops/ChatTD
  • Lightweight operation.
  • Frequent injections at the start of long conversations might have minor impact.
  • Using Input 2 with large DATs might add slight delay.
add_msg = op('add_message1')
conv_dat = op('existing_conversation')
add_msg.inputConnectors[0].connect(conv_dat)
add_msg.par.Useinput = 1
add_msg.par.Role = 'user'
add_msg.par.Message = "This is my latest input."
add_msg.par.Location = 'end'
add_msg.par.Insert = 1
# Output DAT now has the new message appended

Injecting System Message at Start (New Conversation)

Section titled “Injecting System Message at Start (New Conversation)”
add_msg = op('add_message1')
# No input connected to Input 1
add_msg.par.Useinput = 0
add_msg.par.Role = 'system'
add_msg.par.Message = "Welcome to the system."
add_msg.par.Location = 'start'
add_msg.par.Insert = 1
# Output DAT contains only the system message
  • Simulating user input for chatbot testing.
  • Pre-populating conversations with system messages.
  • Injecting prompts or instructions into ongoing chats.
  • Dynamically updating conversations based on events.