April 7, 2024 - last updated
GenAI For Practitioners

Conversational AI: Talk to your Data vs. RAG

Gon Rappaport
Gon Rappaport

Solutions Architect

5 min read Feb 13, 2024

In conversational AI, ‘Talk to your Data’ (TTYD) and Retrieval-Augmented Generation (RAG) both share the common goal of facilitating dialogue between users and data, but they diverge in their methodologies and applications. TTYD revolves around structured data interactions, facilitating direct, SQL-based queries on databases. On the other hand, RAG is tailored for document-centric conversations and efficiently navigating knowledge bases, PDFs, and other textual resources. 

Let’s talk about the specific features of each method below. 

What is ‘Talk to your Data’

Talk to your Data” or “Chat with your Data” is a conversational approach to interacting with structured data, such as CSV files, Postgres databases, and data warehouses like Snowflake. The primary goal of this approach is to replace conventional BI dashboards with direct analytical queries expressed in simple language. This method empowers any employee to pose analytical business inquiries and receive instant responses while eliminating the need for technical expertise or other tools.

TTYD instructs language models to formulate an SQL statement based on the user’s query. Example scenario for TTYD:

  • User Query: What is the average salary for employees in department 101?
  • TTYD: Converts the user query into an SQL statement:  

SELECT AVG(salary) FROM employee WHERE dept_id = 101;

  • TTYD: Executes the SQL statement on the database.
  • TTYD: Provides the user with the outcome: “The average salary of employees in department 101 is $80,000.”

Note that when uploading CSV files to ChatGPT, the system typically generates and executes Python/Pandas code instead of SQL. Nonetheless, the underlying concept remains unchanged. TTYD holds the potential to transform the way businesses engage with their data, enhancing accessibility and user-friendliness. 

RAG (Retrieval-augmented Generation)

Retrieval-augmented generation (RAG) helps engage with diverse documents, such as Notion or Confluence knowledge bases, PDFs, contracts, and product documentation.

Image source

Its primary goal is to enhance the quality of responses generated by large language models (LLMs) by grounding the model in external, authoritative information sources. The RAG process comprises the following steps:

  • User inquiry: The user poses a question, like “How do I create a new ticket?”
  • Knowledge base search: The system searches the pertinent knowledge base or database to locate information that could address the question.
  • LLM prompt with context: The retrieved information forms an LLM prompt that contextualizes the question. The prompt structure may resemble, “Answer the following question: {question} based only on the following context: {context}.”
  • Answer retrieval: The LLM generates a response using the provided context, ensuring accuracy and relevance to the user’s question.

RAG offers various advantages, including granting users access to the latest and most reliable information and enabling verification of the model’s claims. There is also a myth that RAGs help minimize hallucinations, however, this has been debunked and is not true. 

RAGs don’t solve AI hallucinations

This adaptable approach holds the potential to transform how users interact with different document types, simplifying the process of finding and retrieving relevant information.

Differences between Talk to Your Data and RAG

While both ‘Talk to your Data’ (TTYD) and Retrieval-augmented Generation (RAG) contribute to conversational AI, they cater to different use cases, emphasizing their specialized roles in information retrieval.

AspectsTTYDRAG
PurposeTTYD is tailored for structured data.RAG is designed to handle unstructured data.
WorkingTTYD formulates SQL statements based on user queries and executes them on relevant databases, providing instant responsesRAG employs a combination of information retrieval and text generation to deliver contextually relevant answers to user queries. 
ApplicationsTTYD’s primary application is the substitution of traditional BI dashboards with direct analytical queries in plain English. This empowers employees to pose analytical business questions and receive immediate, accessible answers without requiring technical expertise or intricate tools. RAG’s versatility allows it to handle various documents, simplifying the retrieval of pertinent information. It can integrate data from diverse sources like internet data streams, relational databases, newsfeeds, audio transcripts, transaction logs, and unstructured document archives. RAG finds applications in customer service, content creation, and recommendation systems.
Use Cases TTYD is predominantly employed for structured databases. RAG excels in dealing with diverse documents and offers robust information retrieval capabilities.

How are TTYD and RAG similar?

Let’s explore how the harmonious coexistence of TTYD and RAG can bring about a holistic solution to meet the multifaceted needs of users.

Chatbot fit

Recognizing the strengths of ‘Talk to your Data’ (TTYD) and Retrieval-augmented Generation (RAG), there exists substantial potential for these two approaches to complement each other within a single chatbot ecosystem.


Enhanced user interactions

The synergy between TTYD and RAG can significantly enhance user interactions by offering a well-rounded conversational experience. While TTYD excels in structured data interactions, facilitating seamless queries on databases, RAG’s prowess lies in handling diverse documents and extracting information from unstructured sources.

Scenario illustration

Consider a scenario where a user, within the same interaction, seeks both data-related insights and information from various documents. TTYD can efficiently handle queries like “What are the sales figures for the last quarter?” by directly engaging with structured data. Simultaneously, RAG can be employed to answer questions like “Provide details on the new product launch from the latest documentation.” 

This combined use shows the versatility of integrating TTYD and RAG to address diverse user needs within a single chatbot platform.

Control conversational AI with Aporia 

Mitigate hallucinations and other GenAI risks effectively with Aporia’s AI Guardrails, ensuring the reliability and trustworthiness of your conversational AI applications. 

Aporia provides an enterprise-wide solution that centralizes oversight across all LLM applications, offering out-of-the-box and customizable guardrails to enhance TTYD and RAG use cases while maintaining operational efficiency and control.

GenAI risks don’t have to be a pain.
Book a demo to see Guardrails in action.

Green Background

Control All your GenAI Apps in minutes