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.

  • 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:
Off
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:
None
Text From Dat [ in2 ] (Fromin2) op('add_message').par.Fromin2 Toggle
Default:
Off
Use Input Conversation (Useinput) op('add_message').par.Useinput Toggle
Default:
Off
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:
0
Inject ID (Injectid) op('add_message').par.Injectid String
Default:
None
Spacer Header
Bypass (Bypass) op('add_message').par.Bypass Toggle
Default:
Off
Show Built In Pars (Showbuiltin) op('add_message').par.Showbuiltin Toggle
Default:
Off
Version (Version) op('add_message').par.Version String
Default:
None
Last Updated (Lastupdated) op('add_message').par.Lastupdated String
Default:
None
Creator (Creator) op('add_message').par.Creator String
Default:
None
Website (Website) op('add_message').par.Website String
Default:
None
ChatTD Operator (Chattd) op('add_message').par.Chattd OP
Default:
None
  • Lightweight operation.
  • Frequent injections at the start of long conversations might have minor impact.
  • Using Input 2 with large DATs might add slight delay.
  1. Create an add_message LOP.
  2. Create a Table DAT with an existing conversation and connect it to the first input of the add_message LOP.
  3. Enable the Use Input Conversation toggle.
  4. Set the Message Role to user.
  5. Enter your message in the Message to Inject field.
  6. Set the Inject Location to end.
  7. Toggle the Insert Message parameter on.
  8. The output DAT will now have the new message appended to the conversation.

Injecting System Message at Start (New Conversation)

Section titled “Injecting System Message at Start (New Conversation)”
  1. Create an add_message LOP.
  2. Ensure the Use Input Conversation toggle is off.
  3. Set the Message Role to system.
  4. Enter your message in the Message to Inject field.
  5. Set the Inject Location to start.
  6. Toggle the Insert Message parameter on.
  7. The output DAT will contain only the new 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.