Context Grabber
The Context Grabber LOP collects multi-modal context from across your TouchDesigner network — images from TOPs, text from DATs, custom text snippets, and links to external media (PDF, video, audio) — and packages it for injection into LLM prompts. Other operators like Agent or Chat reference this operator to automatically include rich context in their API calls.
Requirements
Section titled “Requirements”- Python packages:
opencv-pythonandnumpy(install via the ChatTD Python Manager).
Context Sources
Section titled “Context Sources”The operator supports six types of context, each with its own toggle and sequence parameters on the Grab Context From Ops page:
| Source | Toggle | What it does |
|---|---|---|
| Images | Add Images to User | Converts TOPs to base64 and attaches them as vision input |
| DATs | Add DATs to Context | Reads table or text DATs and includes their content |
| Text | Add Text to Context | Includes custom text snippets you type directly |
| PDFs | Add PDF to User | Attaches public PDF URLs for model processing |
| Video | Add Video to User | Attaches public video URLs for model processing |
| Audio | Add Audio to User | Attaches public audio URLs for model processing |
Each source type uses a sequence parameter — click the + button to add multiple items of the same type (e.g., multiple images or multiple DATs).
Usage Examples
Section titled “Usage Examples”Adding Images as Context
Section titled “Adding Images as Context”- Enable
Add Images to Useron the Grab Context From Ops page. - In the
Imagessequence, set theTOPparameter to a TOP in your network (e.g., amoviefileinorrenderTOP). - Optionally add a
Labelto describe what the image shows — this label is included as text context alongside the image. - Set
Image Detail Levelto control vision analysis quality (Auto,Low, orHigh).
Adding DAT Content as Context
Section titled “Adding DAT Content as Context”- Enable
Add DATs to Context. - In the
Text or Table DATsequence, set theDATparameter to any text or table DAT. - Add a
Labelto describe the content (e.g., “Sensor readings”, “User preferences”). - Table DATs are automatically converted to tab-separated text. Text DATs are included as-is.
Adding Media URLs
Section titled “Adding Media URLs”- Enable the relevant toggle (
Add PDF to User,Add Video to User, orAdd Audio to User). - Enter a public HTTPS URL in the corresponding sequence parameter.
- URLs must be publicly accessible — the LLM provider fetches them directly.
Linking to an Agent
Section titled “Linking to an Agent”- Configure the Context Grabber with your desired sources (images, DATs, text, etc.).
- Set
Context Insert Modeto control how text context is injected (System, User, Assistant, or Split). - On the Agent operator, find the context OP parameter and drag your Context Grabber onto it.
- When the Agent makes an LLM call, it automatically retrieves and includes all configured context.
Debugging Context Output
Section titled “Debugging Context Output”- Configure the Context Grabber with your desired sources.
- Pulse
Print Context. - Check the TouchDesigner textport (Alt+T) to see the exact messages and media that would be sent to the LLM.
Best Practices
Section titled “Best Practices”- Use descriptive labels on all context sources — they help the LLM understand what each piece of context represents.
- Set
Context Insert Modeto “System” for background reference material, or “User” when the context is part of the user’s question. - Use
Splitmode withSplit Context Locationset to “Both” to place context at both the start and end of the conversation for maximum visibility. - Keep image resolution reasonable — very large TOPs increase token usage and API costs. Consider using a
resolutionTOP to downscale before feeding into the Context Grabber.
Parameters
Section titled “Parameters”Grab Context From Ops
Section titled “Grab Context From Ops”op('context_grabber').par.Printcontext Pulse Print the current context that would be sent to the LLM
- Default:
False
op('context_grabber').par.Addimagestouser Toggle When enabled, adds images to the last user message instead of context
- Default:
False
op('context_grabber').par.Images Sequence - Default:
0
op('context_grabber').par.Images0top TOP - Default:
"" (Empty String)
op('context_grabber').par.Images0label Str - Default:
"" (Empty String)
op('context_grabber').par.Adddattocontext Toggle When enabled, adds text content to context message
- Default:
False
op('context_grabber').par.Datop Sequence - Default:
0
op('context_grabber').par.Datop0dat OP - Default:
"" (Empty String)
op('context_grabber').par.Datop0label Str - Default:
"" (Empty String)
op('context_grabber').par.Addtexttocontext Toggle When enabled, adds messages to context
- Default:
False
op('context_grabber').par.Text Sequence - Default:
0
op('context_grabber').par.Text0text Str - Default:
"" (Empty String)
op('context_grabber').par.Text0label Str - Default:
"" (Empty String)
op('context_grabber').par.Addpdftouser Toggle Enable adding PDF URL to user message
- Default:
False
op('context_grabber').par.Pdf Sequence - Default:
0
op('context_grabber').par.Pdf0url Str Public HTTPS URL to PDF file (application/pdf)
- Default:
"" (Empty String)
op('context_grabber').par.Addvideotouser Toggle Enable adding Video URL to user message
- Default:
False
op('context_grabber').par.Video Sequence - Default:
0
op('context_grabber').par.Video0url Str Public HTTPS URL to Video file (video/mp4)
- Default:
"" (Empty String)
op('context_grabber').par.Addaudiotouser Toggle Enable adding Audio URL to user message
- Default:
False
op('context_grabber').par.Audio Sequence - Default:
0
op('context_grabber').par.Audio0url Str Public HTTPS URL to Audio file (audio/mp3)
- Default:
"" (Empty String)
Changelog
Section titled “Changelog”v1.0.12026-03-01
- Fix Text sequence treating str parameter as DAT operator - Text{i}text is a str par, use its value directly instead of calling .isTable/.text/.path on it
- Initial commit
v1.0.02025-02-23
Initial release