Databricks: see which chunks support each ai_search answer
Enable citations in the ai_search function to identify which retrieved chunks the model used to ground each generated answer.
O que mudou
The ai_search function now includes a generate_citations option, enabling you to track which retrieved documents supported the answer synthesized by the model.
Use cases
Imagine you built a RAG workflow using vector search indexes or synced tables and need to audit the accuracy of the generated answers.
- Track the exact document chunks used in AI-generated answers.
- Audit and validate responses in batch RAG pipelines.
- Expose contextual searches to compound AI systems.
How to use
Run the ai_search function in the SQL editor, passing the citation generation option alongside your knowledge source.
SELECT ai_search(
'How do I configure auto-scaling for my SQL warehouse?',
PARSE_JSON('[{
"type": "vector_search",
"config": {
"index_name": "prod_catalog.docs.support_articles",
"text_col": "article_body",
"doc_uri_col": "article_url"
}
}]'),
options => map('generate_answer', 'true', 'generate_citations', 'true')
) AS result;
What happens in this code:
- The function performs a semantic search on the specified vector index using the natural language query.
- The model synthesizes an answer based on the retrieved documents.
- The generate_citations option returns the index of the specific chunks used to ground the generated text.
What it returns
| Field | Description |
|---|---|
| document | Array of retrieved documents ordered by relevance. |
| document[].page_content | Text content of the retrieved chunk. |
| document[].doc_uri | URI of the source document. |
| document[].metadata | Additional metadata from the index. |
| answer | Grounded natural-language answer synthesized from the retrieved documents. |
| citations | Array containing the 0-based position (document_index) of the chunks used by the model to support the answer. |
Limitations and requirements
- This feature is in Beta.
- Requires Databricks Runtime 18.2 or above.
- The generate_citations option requires generate_answer to be set to true.
- Requires serverless environment version 3 or above when using serverless compute.
Using it in a pipeline
This function fits into the consumption layer or RAG pipelines to enrich operational data, allowing AI-powered applications to return both the synthesized answer and the corresponding source evidence.
- ai_search
- vector search
- generative ai
- sql
- rag
See which chunks support each ai_search answer (Beta)
Resumo e explicação gerados por IA a partir da release note oficial. Em caso de dúvida, a documentação oficial da plataforma prevalece.
Relacionadas
- DatabricksGA
Repositórios de pacotes em nível de workspace para Databricks Apps
Administradores de workspace podem configurar repositórios padrão de pacotes Python e npm para Databricks Apps.
databricks apps · workspace settings - DatabricksGA
Redimensione partições de stateful streaming sem perder o checkpoint no Databricks
Agora é possível alterar o número de partições de shuffle em queries Structured Streaming e pipelines Lakeflow sem descartar o estado do checkpoint.
structured streaming · lakeflow - DatabricksAtualização
Google Gemini 4 Argon disponível no Unity Gateway do Databricks
O modelo multimodal Google Gemini 4 Argon já pode ser acessado via Foundation Model APIs e Unity Gateway.
unity catalog · foundation model apis