Skip to main content
MindStudio
Pricing
Blog About
My Workspace
Databases

Query Data Source

The Query Data Source block searches a vectorized data source using retrieval-augmented generation (RAG) and returns the most relevant document chunks matching a given query.

Search a vector data source and return relevant chunks

The Query Data Source block searches a vectorized data source using retrieval-augmented generation (RAG) and returns the most relevant document chunks matching a given query. You configure it by specifying a data source ID, a search query string, the maximum number of chunks to return, and an optional variable name where the joined result text will be saved. The recommended range for max results is 1 to 3 chunks.

The block returns several output fields: a joined text string of all matching chunks separated by newlines, an array of individual chunk strings, the resolved query that was searched, source citations for the matched chunks, and the query execution time in milliseconds. These outputs give you both a ready-to-use combined text and the granular chunk data if you need to process results individually.

This block fits into workflows where you need to ground AI responses in specific document content — for example, passing retrieved chunks into a prompt block to answer questions based on a knowledge base, or surfacing citations alongside generated responses. It acts as the retrieval step in a RAG pipeline, sitting between user input and any downstream text generation or response formatting blocks.

What you can build

Real-world workflows powered by the Query Data Source block.

Knowledge Base Q&A

Retrieve relevant document chunks from a company knowledge base and pass them to a prompt block to generate grounded answers to user questions.

Document-Backed Support Bot

Query a vectorized support documentation data source to surface the most relevant help content when a user submits a support request.

Legal Document Search

Search a corpus of legal documents to retrieve clauses or precedents relevant to a specific query, then pass results to a summarization step.

Research Assistant Workflow

Pull relevant chunks from a research paper data source based on a user's topic query, providing source citations alongside the retrieved content.

Product Recommendation Context

Retrieve product descriptions or specifications from a vectorized catalog to provide context for an AI block generating personalized recommendations.

Policy Compliance Checking

Query an internal policy data source to retrieve the most relevant policy sections when evaluating whether a proposed action meets compliance requirements.

Ready to add Query Data Source to your workflow?

Get Started Free

Common questions about Query Data Source

What parameters are required to configure this block?

The block requires a data source ID identifying which vector data source to query, a search query string, and a maximum results count specifying how many chunks to return. The destination variable for saving the joined result text is optional.

What does the block return as output?

The block returns a joined text string of all matching chunks separated by newlines, an array of individual chunk strings, the resolved query that was searched, source citations for the matched chunks, and the query execution time in milliseconds.

How many chunks should I configure the block to return?

The metadata recommends a maximum results value between 1 and 3 chunks.

What kinds of workflows is this block used in?

This block is used in retrieval-augmented generation (RAG) workflows, where retrieved document chunks are passed as context to downstream prompt or text generation blocks to ground AI responses in specific source material.

What is the difference between the 'text' and 'chunks' output fields?

The 'text' field contains all matching chunks joined together into a single string with newlines, while 'chunks' is an array of the individual matching text segments, allowing you to process or display each chunk separately if needed.

Add Query Data Source to your workflow

Build powerful AI workflows with drag-and-drop blocks. No coding required.