← All updates Databricks Update One-Pager Light version
databricks Platform · Updated Jun 15, 2026

ai_query

General-purpose AI function for querying models.

What it does

`ai_query` is a versatile AI function that allows users to query any supported AI model directly from SQL or Python. It provides full control over the model, prompt, and parameters, distinguishing it from task-specific AI functions. This function is designed for use with Databricks-hosted models, provisioned throughput models, and custom or external models, enabling flexible querying for various use cases.

Why it matters

The availability of `ai_query` empowers data teams to leverage AI models more effectively, enhancing productivity and flexibility in data processing tasks. By allowing precise control over model parameters and prompts, organizations can optimize their AI workflows for better performance and tailored outputs, ultimately driving more insightful data-driven decisions.

Key capabilities
Flexible Model Querying
Query any supported AI model with customizable prompts and parameters.
Batch Inference Support
Optimized for high-throughput batch workloads, enhancing processing efficiency.
Integration with Unity AI Gateway
Automatically routes requests through Unity AI Gateway for usage tracking.
Support for Custom Models
Allows querying of custom and external models for tailored AI solutions.
Prerequisites
Databricks Runtime 18.2 or above is required.
Serverless compute is required; not supported on classic compute clusters.
Not available on Pro or Classic SQL warehouses.
Recommended use cases
Control over model parameters for specific outputs.Querying custom or fine-tuned models.High-throughput batch processing for large datasets.Automated data extraction from unstructured data.
Limitations · remember
!Not supported on classic compute clusters.
!Requires Databricks Runtime 18.2 or higher.
Architecture
Data Ingestion → Data Processing → AI Query Execution → Model Serving → Output Generation
Get started
1
Enable Serverless Compute
Ensure your Databricks workspace is configured for serverless compute.
2
Check Runtime Version
Verify that your Databricks Runtime is version 18.2 or above.
3
Select Supported Models
Choose from Databricks-hosted or provisioned throughput models for optimal performance.
4
Use SQL or Python
Implement `ai_query` in your SQL queries or Python scripts as needed.
5
Monitor Usage
Utilize Unity AI Gateway for tracking and optimizing your AI queries.
Key takeaway
`ai_query` is now generally available, enabling flexible and powerful querying of AI models directly from SQL or Python, enhancing data processing capabilities.
2026-06-15-ai-query-is-now-generally-available Generated by the Databricks Updates Agent · browse all updates