AskReference
ProcessIntermediate

What is the purpose of the 'Data to Message' component in the RAG workflow, and what configuration does it require?

The Data to Message component converts the table output of the vector database search into plain text, which the LLM can use in the prompt. It requires a Template parameter that describes the output format by referencing column names in curly brackets, such as setting it to {text} to extract the chunk text column.

In the RAG workflow, the retrieval step returns a table with columns such as file_path and text, one row per retrieved chunk. Because the LLM needs a text-based prompt, the Data to Message component transforms this Data-format table into a Text-format string. Its key configuration is the Template parameter, which defines the output format using the column names inside curly brackets. Setting the template to {text} extracts only the chunk text from the table. The component's data input is connected to the Chroma DB's Search Results output, and its output can then be connected to the Prompt component's context input.

Key points

  • Data to Message converts Data-format tables into Text-format strings.
  • It is used after the vector DB retrieval to turn the table of retrieved chunks into plain text.
  • The Template configuration specifies how to format the output by referencing column names in curly brackets.
  • A template of {text} extracts the actual chunk text column from the retrieval results.
  • The component's Data input receives the Search Results from the Chroma DB component.
Source:AI Agents and Applications· Building your first GenAI app· p. 102–110

Related questions

Cover of AI Agents and Applications

AI Agents and Applications

Andrea De Mauro

MEAP Edition Version 7 · Manning Publications

View this ebook