Skip to content

Rag Retriever Operator

The RAG Retriever LOP retrieves relevant context from a pre-built index (created by a Rag Index LOP) based on a given query. It enhances the capabilities of Language Model Operators (LOPs) by providing contextual information to improve the accuracy and relevance of generated text. The operator supports various search modes, similarity thresholds, and output formats, making it a versatile tool for Retrieval Augmented Generation (RAG) workflows within TouchDesigner.

Note: This operator requires the llama-index Python library and access to a running Rag Index LOP.

Parameters are organized into pages.

Query Index (Query) op('rag_retriever').par.Query Pulse
Default:
None
RAG Index OP (Indexsource) op('rag_retriever').par.Indexsource COMP
Default:
None
Search Mode (Searchmode) op('rag_retriever').par.Searchmode Menu
Default:
last_user
Options:
last_user, full_chat, last_assistant, custom
Query Phrase (Queryphrase) op('rag_retriever').par.Queryphrase Str
Default:
None
Add Text (Addtext) op('rag_retriever').par.Addtext Str
Default:
None
Status Log (Statuslog) op('rag_retriever').par.Statuslog Str
Default:
None
Active Index (Indexstatus) op('rag_retriever').par.Indexstatus Toggle
Default:
None
Top Result Only (Topresultonly) op('rag_retriever').par.Topresultonly Toggle
Default:
Off
Top K Results (Topk) op('rag_retriever').par.Topk Int
Default:
0
Range:
0 to 10
Similarity Threshold (Similaritythreshold) op('rag_retriever').par.Similaritythreshold Float
Default:
0
Range:
0 to 1
Display Results (Displayresults) op('rag_retriever').par.Displayresults Toggle
Default:
Off
Out1 Output Mode (Outputmode) op('rag_retriever').par.Outputmode Menu
Default:
raw
Options:
raw, chat
Clear Results (Clearresults) op('rag_retriever').par.Clearresults Pulse
Default:
None
ChatTD (Chattd) op('rag_retriever').par.Chattd OP
Default:
None
Show Built In Pars (Showbuiltin) op('rag_retriever').par.Showbuiltin Toggle
Default:
Off
Bypass (Bypass) op('rag_retriever').par.Bypass Toggle
Default:
Off
Version (Version) op('rag_retriever').par.Version Str
Default:
None
Lastupdated (Lastupdated) op('rag_retriever').par.Lastupdated Str
Default:
None
Creator (Creator) op('rag_retriever').par.Creator Str
Default:
None
Website (Website) op('rag_retriever').par.Website Str
Default:
None
Available Callbacks:
  • onRetrievalComplete
  • onError
  • onStatusUpdate
  1. Point ‘RAG Index OP’ to a configured Rag Index LOP.
  2. Set ‘Search Mode’ to Custom.
  3. Enter your query in ‘Query Phrase’.
  4. Adjust ‘Top K Results’ and ‘Similarity Threshold’.
  5. Pulse ‘Query Index’.
  6. Results appear in output1 (raw text) and output_table (chat format).
  1. Connect a chat table (DAT) to Input 1.
  2. Point ‘RAG Index OP’ to a configured Rag Index LOP.
  3. Set ‘Search Mode’ to Last User or Full Chat.
  4. Pulse ‘Query Index’.
  5. output_table will contain the original chat plus a system message with context.
  • Retrieval is performed asynchronously to avoid blocking the main TouchDesigner thread.
  • Performance depends on the size of the index, the complexity of the query, Top K, and Similarity Threshold.
  • Ensure the specified RAG Index OP contains a loaded and accessible index.
  • The output table (output_table) is formatted for direct use with downstream LLM operators like Agent or Chat.
  • The raw text output (output1) provides chunks separated by ---.