TL;DR
Databricks AI Functions call a large language model directly from a SQL query, skipping the endpoint deployment and API key management that used to sit between a table and a model. Nine task-specific functions cover classification, translation, summarization, sentiment, extraction, masking, grammar correction, parsing, and forecasting, plus ai_query for anything outside that set, all governed by Unity Catalog. The catch: cost scales with token volume and compute time, and functions like ai_translate remain in public preview even as ai_query, ai_classify, and ai_extract reached general availability. This blog covers how AI Functions work, cost, governance, and a real Kanerika deployment.
Databricks AI Functions turn a large language model into a callable SQL function, skipping the endpoint deployment, the API key management, and the separate service that used to sit between a table and a model. Nine task-specific functions ship ready to call today, covering classification, translation, summarization, sentiment, extraction, masking, grammar correction, document parsing, and forecasting, plus ai_query for anything the task-specific set skips.
Teams still writing a Python service to call OpenAI or Claude from inside a Databricks pipeline are duplicating work AI Functions already do natively, governed by Unity Catalog the same way a table is. This guide covers how AI Functions work, which function fits which job, practical applications, cost and governance, and what it takes to run them at scale. It closes with a real Kanerika deployment on Databricks.
Key Takeaways AI Functions call LLMs directly from SQL, notebooks, Lakeflow pipelines, and Workflows, with zero endpoint management for Databricks-hosted models. Nine task-specific functions cover the common jobs out of the box. ai_query handles custom prompts and external models. AI Functions require serverless SQL warehouses and Databricks Runtime 18.2 or above. Region and model availability vary by cloud. ai_query, ai_classify, and ai_extract reached general availability in June 2026. Other functions, including ai_translate, remain in public preview. Unity Catalog governs execution through the system.ai schema, down to the individual function. Kanerika used AI Functions patterns on Databricks to cut a sales intelligence platform’s document processing time by 80%.
Modernize Your Data Pipelines with Databricks AI Functions! Partner with Kanerika for Expert Databricks Consulting Services
Book a Meeting
What Are Databricks AI Functions AI Functions apply AI models to data stored on Databricks using SQL and PySpark syntax, for tasks like translation, classification, and sentiment scoring. They run from Databricks SQL, notebooks, Lakeflow Declarative Pipelines, and Workflows, per the Databricks documentation on AI Functions .
Databricks introduced AI Functions to close a specific gap. Data teams already had the data, the compute, and the governance layer in Unity Catalog.
Applying an LLM to that data used to mean leaving the platform, standing up an external call, and reconciling the output back into a table. AI Functions fold that entire round trip into a single function call, the same efficiency principle behind Kanerika’s broader generative AI work .
UPPER() and LENGTH() run pure computation, independent of any external service.
AI Functions work differently. They route a request to a foundation model, either Databricks-hosted or external, and parse the response into a structured column value, which is what separates an AI Function from a traditional SQL function underneath the identical syntax.
How Databricks AI Functions Work A query calls the function, the function passes the relevant column data and a task definition, or a custom prompt for ai_query, to a model serving endpoint, and the response returns as a typed column.
Databricks handles batching, retries, and parallelization behind that flow automatically, so a query against ten rows and one against ten million rows use identical syntax. Runtime and cost carry the difference, while the query itself stays the same either way.
A single line replaces what used to take a full service to build.
sql
SELECT
ticket_id,
ai_analyze_sentiment(customer_message) AS sentiment,
ai_classify(customer_message, ARRAY('billing', 'technical', 'shipping', 'other')) AS category
FROM support_tickets;Unity Catalog sits underneath this entire flow, governing which users and service principals can execute which functions against which data. That governance layer separates AI Functions from a raw API call bolted onto a pipeline, since permissions, lineage, and audit logging apply the same way they do for a standard table query.
Teams already running Kanerika’s data governance engagements on Databricks find AI Functions slot into an access model that already exists.
Key Features of Databricks AI Functions 1. Native SQL Integration AI Functions drop into a SELECT statement the same way any built-in function does. A data analyst writing routine SQL adds a sentiment score or a translated column without switching languages or involving a separate data engineering team to build the plumbing first.
2. Built-In Large Language Models Databricks hosts foundation models optimized for AI Functions, including databricks-gpt-oss-20b and databricks-gpt-oss-120b , with endpoints created automatically and the provisioning step skipped entirely. This model serving layer runs on the same infrastructure Databricks uses across its broader model deployment stack, the same performance layer behind engines like Photon.
3. Structured Data Extraction and Classification ai_extract and ai_classify turn unstructured text into structured fields, pulling named entities from a contract or sorting a support ticket into a category, directly inside a query. Both functions moved to a v2 signature in March 2026 with improved accuracy and native composability with ai_parse_document for end-to-end document workflows.
4. Translation, Sentiment, and Summarization ai_translate, ai_analyze_sentiment, and ai_summarize cover three of the most common enrichment tasks in customer-facing data, each callable with a single argument beyond the input column.
5. Enterprise Governance Through Unity Catalog Every AI Function call inherits Unity Catalog’s permission model. By default, all users hold execute access through the system.ai schema, which opens every supported function to every user.
Admins needing tighter control revoke that default and re-grant execute permission function by function, mapping to the same access-by-risk approach Kanerika applies in its AI governance engagements .
Together, these five features close the two biggest gaps in AI adoption for data teams, the need for a second toolchain and the governance gap between the data platform and the AI layer.
Types of Databricks AI Functions Databricks groups AI Functions into one general-purpose function and a set of task-specific functions built for common jobs.
Table 1: Databricks AI Functions Reference
Function Purpose Example Call ai_query Custom prompt against any supported model ai_query(‘model-name’, prompt) ai_classify Sorts text into labels you define ai_classify(text, ARRAY(‘label1’, ‘label2’)) ai_extract Pulls named fields from unstructured text ai_extract(text, ARRAY(‘vendor’, ‘amount’, ‘date’)) ai_translate Translates text to a target language ai_translate(text, ‘es’) ai_summarize Condenses text to a target word count ai_summarize(text, 40) ai_analyze_sentiment Scores sentiment as positive, negative, mixed, or neutral ai_analyze_sentiment(text) ai_mask Redacts named entity types ai_mask(text, ARRAY(‘person’, ’email’, ‘phone’)) ai_parse_document Extracts text and structure from PDFs ai_parse_document(file_content) ai_fix_grammar Corrects grammar in input text ai_fix_grammar(text) ai_forecast Projects a time series forward ai_forecast(table_name, horizon)
ai_translate currently supports a fixed set of target languages, including Spanish, German, French, Italian, Portuguese, Hindi, and Thai. Confirm the current list against the official documentation before building a translation pipeline around it, since supported languages and functions both expand over time.
ai_query for Custom Prompts and External Models ai_query is the function to reach for when a task-specific function falls short, when a prompt needs custom wording, or when the model lives outside Databricks entirely. It supports Databricks-hosted models, provisioned throughput endpoints, and external models like OpenAI’s API, all through the same call signature.
sql
SELECT ai_query(
'fraud-model-v3',
named_struct('transaction_amount', amount, 'merchant_category', category, 'account_age_days', account_age),
returnType => 'FLOAT'
) AS fraud_score
FROM transactions;Task-Specific Functions for Common Jobs Databricks recommends starting with a task-specific function whenever one matches the objective, since these functions carry pre-tuned prompts maintained by Databricks and skip the trial-and-error of writing a custom instruction. ai_classify, ai_extract, and ai_parse_document cover the bulk of enrichment work data teams handle day to day.
Mixing both inside one pipeline is common in practice. A document ingestion job might call ai_parse_document to extract raw text, then ai_query with a custom prompt to score that text against a business-specific rubric that falls outside every task-specific function.
Why Data Teams Are Adopting Databricks AI Functions 1. Faster Development With Less Custom Code A team that previously wrote a Python service to call an external LLM, parse the response, and write it back to a table can replace that entire service with a SQL statement. The maintenance surface drops from an application to a query, the same reduction in build time Kanerika targets across its broader AI consulting work.
2. Unified Analytics and AI in One Platform Data engineers, analysts, and data scientists work against the same tables using the same governance model, whether the task is a standard aggregation or an AI-driven enrichment. That consistency pays off as AI use cases multiply across a data estate, tracked over time the same way MLflow tracks model experiments on Databricks, covered in Kanerika’s guide to model lifecycle management .
3. Enterprise Security at the Function Level Because AI Functions inherit Unity Catalog permissions, security teams gain a single control point for both data access and model access, rather than managing API keys and service accounts across a separate AI stack.
Databricks Unity AI Gateway (2026): Configuration and Governance Guide Databricks Unity AI Gateway governs AI agents, guardrails, and spend at runtime. See how the four pillars work and configure it for enterprise use.
Learn More
AI Functions in Production Data Workflows 1. Customer Email Routing A logistics company routes inbound customer emails that used to run through a rules-based keyword filter, which misclassified anything phrased unusually. ai_classify sorts each message into delivery status, damage claim, billing question, or general inquiry, then sends it to the right queue, the same category of work Kanerika covers in its intelligent automation practice.
2. PII Redaction Before Data Sharing A financial services firm strips names, emails, and account numbers from free-text customer service notes before that data leaves the governed environment. ai_mask handles the redaction inside the query itself, the same job Kanerika’s Susan agent is purpose-built for outside a SQL context.
3. Review Summarization at Scale A retail chain summarizes thousands of product reviews every week. ai_summarize condenses each review to a fixed word count, and ai_analyze_sentiment scores it in the same pass, giving the retail and FMCG merchandising team a queryable table instead of a folder of raw text.
4. Supplier Contract Extraction A manufacturing team used to read hundreds of supplier PDFs by hand to pull pricing tiers, delivery terms, and penalty clauses. Chaining ai_parse_document into ai_extract turns that stack into a structured table analysts compare across vendors within minutes, close to the pattern in Kanerika’s vendor agreement processing case study .
5. Intake Form Processing A healthcare operations team pulls patient ID, visit reason, and referring physician from scanned intake documents the same way, feeding a structured table instead of a stack of PDFs nobody queries directly.
6. Claims Volume Forecasting An insurance company projects claims volume forward from historical data using ai_forecast, giving planning teams a baseline without a separate forecasting model to build and maintain outside the warehouse, the same forecasting pattern Kanerika’s predictive analytics practice covers in more depth.
7. Documentation Localization A SaaS company runs ai_translate against its documentation table to produce localized versions in each supported target language, keeping the source table as the single point of truth instead of maintaining separate translated repositories by hand.
How Databricks AI Functions Compare to Traditional AI Development Factor Databricks AI Functions Traditional AI Development SQL Integration Direct, native function calls Requires a separate application layer Infrastructure Managed by Databricks Self-managed endpoints and scaling Governance Inherited from Unity Catalog Built and maintained separately Time to Production Days, in many cases Weeks to months Model Flexibility Databricks-hosted, custom, and external models via ai_query Full flexibility, at the cost of setup time
The tradeoff runs in both directions. A team needing deep customization outside what a model serving endpoint supports still reaches for custom development.
For the batch enrichment and classification work most teams need, AI Functions close the gap in a fraction of the time. Most Databricks shops running AI Functions in production still keep a handful of traditional deployments for latency-sensitive or highly customized workloads, and route everything else through AI Functions to keep the maintenance surface small.
Best Practices for Production AI Functions 1. Write Structured, Specific Prompts A vague ai_query prompt produces inconsistent output across rows. A structured prompt with an explicit format and constraints produces output that behaves the same way every time, which counts once a job runs unattended on a schedule.
2. Submit the Full Dataset in One Query Splitting a dataset into small manual batches before calling an AI Function slows the job down. Databricks handles parallelization and retries automatically when the full dataset is submitted in a single query.
3. Set failOnError to False on Large Batch Jobs A single malformed row can stop an entire batch job if failOnError stays at its default. Setting it to false returns an error message for that row and lets the rest of the job complete, a difference that counts most on jobs processing millions of rows overnight.
4. Filter the Table Before You Call the Function Cost scales with token volume and compute time together. Running a function against an entire table when only a filtered subset needs enrichment multiplies spend without improving the output analysts use.
Cost itself tracks two things together. Databricks Unit consumption from the compute running the query, and the underlying model serving cost for tokens processed, both feed the total bill.
Model serving on Databricks offers pay-per-token pricing for prototyping and variable-volume work, and provisioned throughput for production workloads needing guaranteed capacity, according to CloudZero’s breakdown of Databricks pricing .
A batch job against a Databricks-hosted model on pay-per-token billing generally costs less per token than the same volume of real-time calls, since batch inference skips the overhead of a warm endpoint sitting idle between requests.
Source: Databricks Limitations to Consider 1. Token Cost and Latency Grow With Input Size A function called on every row of a large table behaves very differently from the same function filtered to a small, high-value subset. Cost and latency both scale with volume, and that scaling stays linear regardless of warehouse size.
2. Model Accuracy Still Needs Human Review Hallucination risk exists regardless of platform. Output headed for a compliance decision or a customer-facing surface still needs a review step before it ships, the same discipline any LLM-backed system requires.
3. Task-Specific Functions Trade Flexibility for Simplicity A task-specific function carries a pre-tuned prompt maintained by Databricks, which is the entire point, though tuning that function for an unusual edge case sits out of reach. ai_query is the answer once a task-specific function’s fixed behavior stops fitting the job.
4. Rollout Status Still Varies by Function Maturity differs across the function set. ai_query, ai_classify, and ai_extract reached general availability in June 2026 , while functions such as ai_translate remain in public preview.
Region coverage and the supported function list keep expanding, so a rollout plan built around today’s exact feature set should include a recheck against current documentation before the production launch date.
Getting Started With Databricks AI Functions 1. Confirm Compute and Runtime Requirements AI Functions run on serverless SQL warehouses only. Pro and Classic SQL warehouses sit outside supported configurations, and Databricks Runtime 18.2 or above is required for notebook and workflow use.
2. Confirm Region and Model Availability Availability is limited to specific Model Serving regions rather than every workspace globally. A workspace in an unsupported region can still run other Databricks workloads normally, but AI Function calls from that workspace fail until Databricks extends coverage there.
3. Grant Execute Permissions Through Unity Catalog By default, every user holds execute access to every AI Function through the system.ai schema. Teams that need tighter control revoke that default and re-grant per function:
sql
-- Remove the default open access
REVOKE EXECUTE ON SCHEMA system.ai FROM `account users`;
-- Re-grant only the approved functions
GRANT EXECUTE ON FUNCTION system.ai.ai_summarize TO `data-analysts`;
GRANT EXECUTE ON FUNCTION system.ai.ai_classify TO `data-analysts`;4. Write and Test the Query Choose a task-specific function, or ai_query for a custom prompt, and run it against a sample table rather than a full production one. Compare a sample of AI-generated output to a known-correct answer before pointing the query at the full dataset.
5. Monitor Output and Move to Production Errors caught at the sample stage cost minutes. Errors caught after a job runs against millions of rows cost a rerun and a wasted bill, so the validation step earns the extra day it takes.
6. Deploy Through Lakeflow or Workflows Lakeflow Declarative Pipelines call AI Functions inside a transformation step, enriching a table with a derived column every time the pipeline runs, which fits recurring batch jobs better than an ad hoc query run by hand. Databricks Workflows schedules an AI Functions query on a recurring basis, with configurable retry policies at the task level .
Kanerika’s data engineering team builds this scheduling layer alongside most AI Functions rollouts, since production job behavior rarely matches notebook behavior exactly.
A fast-growing, AI-powered sales intelligence platform ran into a scaling problem. Its data engine depended on large-scale web scraping and document ingestion to deliver real-time company and industry insights, running on MongoDB, Postgres, and legacy JavaScript-based processing.
As the client’s customer base and data demands grew, that architecture stopped keeping up. Document handling logic was stuck in JavaScript, pipelines were scattered across disconnected systems, and unstructured data lacked consistency.
That combination slowed insight generation and made maintenance harder with every release. Kanerika re-architected the pipeline on Databricks to modernize the document workflows, improve pipeline performance, and cut manual overhead.
Client’s Challenges Outdated document workflows created maintenance bottlenecks that delayed service delivery and reduced operational agility Disconnected data sources limited visibility across systems, delaying access to timely, reliable insights Unstructured PDF and metadata processes increased manual effort, cutting into team productivity and extending turnaround times
Kanerika’s Solutions Refactored document workflows from JavaScript to Python in Databricks, improving maintainability and processing speed Integrated disconnected data sources into Databricks, improving visibility and enabling faster, more reliable insights Streamlined PDF, metadata, and classification workflows in Databricks, cutting manual effort and accelerating insight delivery
Business Outcomes 80% faster document processing 95% improvement in metadata accuracy 45% faster time-to-insight
How Kanerika Helps Enterprises Deploy AI Functions on Databricks Kanerika holds Databricks Consulting Partner status, applied to production batch inference and document intelligence pipelines. Enterprise rollouts tend to need the same three things:
A governance model that satisfies security review, scoped function by function through Unity Catalog rather than left at the default open state A cost structure that survives production scale, modeled against real data volume before the pilot expands A pipeline architecture built for the data volume ahead, using Lakeflow and Workflows from the start rather than retrofitted after a notebook prototype breaks under load
Kanerika’s Databricks engagements start with the same document and data enrichment patterns covered in this guide, adapted to each client’s stack, industry, and compliance requirements.
Wrapping Up AI Functions fold AI capability directly into SQL, closing the gap between a data table and a model call. Task-specific functions cover the common jobs out of the box, and ai_query handles anything more custom.
Getting production value out of them takes the same discipline as any data platform investment. Right-sized governance, predictable cost controls, and a pipeline built for real volume from day one make the difference.
Transform Your Business with AI-Powered Solutions! Partner with Kanerika for Expert AI implementation Services
Book a Meeting
FAQs 1. What are Databricks AI Functions? Databricks AI Functions are built-in SQL functions that enable users to apply generative AI directly to their data. They support tasks such as summarization, translation, sentiment analysis, classification, and information extraction without requiring custom AI integrations. This allows data teams to build AI-powered workflows faster using familiar SQL syntax.
2. How do Databricks AI Functions work? Databricks AI Functions send prompts or input data to supported AI models and return the results within SQL queries or notebooks. The platform manages model execution and scaling behind the scenes, allowing users to integrate AI into existing data pipelines without building or maintaining separate AI infrastructure.
3. What can you do with Databricks AI Functions? Databricks AI Functions can automate a variety of data tasks, including document summarization, customer feedback analysis, sentiment detection, text translation, entity extraction, and content generation. They help organizations process unstructured data more efficiently while reducing manual effort and accelerating business insights.
4. Can you use Databricks AI Functions in SQL? Yes. Databricks AI Functions are designed to work directly within Databricks SQL. Users can incorporate AI-powered tasks like summarizing text, classifying records, or extracting key information into SQL queries, making it easier for analysts and engineers to build intelligent data workflows.
5. What is the difference between Databricks AI Functions and AI_QUERY? Databricks AI Functions offer predefined capabilities for common AI tasks such as summarization and classification. AI_QUERY, on the other hand, provides greater flexibility by allowing users to send custom prompts to supported AI models. Built-in AI Functions are ideal for standard use cases, while AI_QUERY is better suited for more advanced or customized workflows.
6. What are the best use cases for Databricks AI Functions? Databricks AI Functions are commonly used for summarizing documents, analyzing customer reviews, classifying support tickets, extracting information from invoices, translating multilingual content, and enriching datasets. These capabilities help organizations automate repetitive tasks and improve the speed and accuracy of data-driven decision-making.
7. Which AI models do Databricks AI Functions support? Databricks AI Functions work with Databricks-managed foundation models and can also support external or custom models through AI_QUERY, depending on your workspace configuration. This flexibility allows organizations to choose the right model for their AI applications while maintaining governance and scalability.
8. Why should businesses use Databricks AI Functions? Databricks AI Functions simplify enterprise AI adoption by embedding generative AI into existing data workflows. They reduce development effort, improve productivity, and enable teams to automate AI-powered tasks directly within SQL and notebooks. This helps organizations scale AI initiatives while maintaining security and governance.