thomazrossito/data-agents/databricks-ai-functions
Claude Code and agent skill by thomazrossito/data-agents
- community
Checking that the SKILL.md file is still in the repository.
Use Databricks built-in AI Functions (ai_classify, ai_extract, ai_summarize, ai_mask, ai_translate, ai_fix_grammar, ai_gen, ai_analyze_sentiment, ai_similarity, ai_parse_document, ai_query, ai_forecast) to add AI capabilities directly to SQL and PySpark pipelines without managing model endpoints. Also covers document parsing and building custom RAG pipelines (parse → chunk → index → query).
Install
npx vskill@latest install thomazrossito/data-agents/databricks-ai-functionsSKILL.md
The same SKILL.md was published earlier as thomazrossito/data-agents/databricks-ai-functions.
Databricks AI Functions
Official Docs: https://docs.databricks.com/aws/en/large-language-models/ai-functionsIndividual function reference: https://docs.databricks.com/aws/en/sql/language-manual/functions/
Overview
Databricks AI Functions are built-in SQL and PySpark functions that call Foundation Model APIs directly from your data pipelines — no model endpoint setup, no API keys, no boilerplate. They operate on table columns as naturally as UPPER() or LENGTH(), and are optimized for batch inference at scale.
There are three categories:
| Category | Functions | Use when | |
|---|---|---|---|
| Task-specific | ai_analyze_sentiment, ai_classify, ai_extract, ai_fix_grammar, ai_gen, ai_mask, ai_similarity, ai_summarize, ai_translate, ai_parse_document | The task is well-defined — prefer these always | |
| General-purpose | ai_query | Complex nested JSON, custom endpoints, multimodal — last resort only | |
| Table-valued | ai_forecast | Time series forecasting |
Function selection rule — always prefer a task-specific function over `ai_query`:
| Task | Use this | Fall back to ai_query when... | |
|---|---|---|---|
| Sentiment scoring | ai_analyze_sentiment | Never | |
| Fixed-label routing | ai_classify (2–500 labels; add descriptions for accuracy) | Never | |
| Entity / field extraction | ai_extract | Never | |
| Summarization | ai_summarize | Never — use max_words=0 for uncapped | |
| Grammar correction | ai_fix_grammar | Never | |
| Translation | ai_translate | Target language not in the supported list | |
| PII redaction | ai_mask | Never | |
| Free-form generation | ai_gen | Need structured JSON output | |
| Semantic similarity | ai_similarity | Never | |
| PDF / document parsing | ai_parse_document | Need image-level reasoning | |
| Complex JSON / reasoning | — | This is the intended use case for `ai_query` |
Prerequisites
- Databricks SQL warehouse (not Classic) or cluster with DBR 15.1+
- DBR 15.4 ML LTS recommended for batch workloads
- DBR 17.1+ required for
ai_parse_document ai_forecastrequires a Pro or Serverless SQL warehouse- Workspace in a supported AWS/Azure region for batch AI inference
- Models run under Apache 2.0 or LLAMA 3.3 Community License — customers are responsible for compliance
Quick Start
Classify, extract, and score sentiment from a text column in a single query:
Common Patterns
Pattern 1: Text Analysis Pipeline
Chain multiple task-specific functions to enrich a text column in one pass:
Pattern 2: PII Redaction Before Storage
Pattern 3: Document Ingestion from a Unity Catalog Volume
Parse PDFs/Office docs, then enrich with task-specific functions:
Pattern 4: Semantic Matching / Deduplication
Pattern 5: Complex JSON Extraction with ai_query (last resort)
Use only when the output schema has nested arrays or requires multi-step reasoning that no task-specific function handles:
Pattern 6: Time Series Forecasting
Reference Files
- 1-task-functions.md — Full syntax, parameters, SQL + PySpark examples for all 9 task-specific functions (
ai_analyze_sentiment,ai_classify,ai_extract,ai_fix_grammar,ai_gen,ai_mask,ai_similarity,ai_summarize,ai_translate) andai_parse_document - 2-ai-query.md —
ai_querycomplete reference: all parameters, structured output withresponseFormat, multimodalfiles =>, UDF patterns, and error handling - 3-ai-forecast.md —
ai_forecastparameters, single-metric, multi-group, multi-metric, and confidence interval patterns - 4-document-processing-pipeline.md — End-to-end batch document processing pipeline using AI Functions in a Lakeflow Declarative Pipeline; includes
config.ymlcentralization, function selection logic, custom RAG pipeline (parse → chunk → Vector Search), and DSPy/LangChain guidance for near-real-time variants
Common Issues
| Issue | Solution | |
|---|---|---|
ai_parse_document not found | Requires DBR 17.1+. Check cluster runtime. | |
ai_forecast fails | Requires Pro or Serverless SQL warehouse — not available on Classic or Starter. | |
| All functions return NULL | Input column is NULL. Filter with WHERE col IS NOT NULL before calling. | |
ai_translate fails for a language | Supported: English, German, French, Italian, Portuguese, Hindi, Spanish, Thai. Use ai_query with a multilingual model for others. | |
ai_classify returns unexpected labels | Use clear, mutually exclusive label names. Fewer labels (2–5) produces more reliable results. | |
ai_query raises on some rows in a batch job | Add failOnError => false — returns a STRUCT with .response and .error instead of raising. | |
| Batch job runs slowly | Use DBR 15.4 ML LTS cluster (not serverless or interactive) for optimized batch inference throughput. | |
| Want to swap models without editing pipeline code | Store all model names and prompts in config.yml — see 4-document-processing-pipeline.md for the pattern. |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/databricks/databricks-ai-functions/SKILL.md
Popularity
- Repository stars
- 30
- Repository forks
- 20
- 7-day trend score
- 17
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/thomazrossito/data-agents/databricks-ai-functions)