Skip to content

ai_classify v2 + ai_extract v2.1 + sentiment via ai_classify (AI Functions demo notebooks)#89

Open
srikantdas11 wants to merge 1 commit into
databricks-solutions:mainfrom
srikantdas11:ai-functions-v2-syntax
Open

ai_classify v2 + ai_extract v2.1 + sentiment via ai_classify (AI Functions demo notebooks)#89
srikantdas11 wants to merge 1 commit into
databricks-solutions:mainfrom
srikantdas11:ai-functions-v2-syntax

Conversation

@srikantdas11
Copy link
Copy Markdown
Contributor

@srikantdas11 srikantdas11 commented May 15, 2026

Summary

  • Updates the 5 demo notebooks in 2026-05-ai-functions-data-warehouse-use-cases/ to the latest AI Functions syntax and the GA-only pre-publish gate.
  • All examples now run on GA-only AI Functions.
  • All ai_classify calls use v2 JSON STRING label syntax + :response[0]::STRING cast.
  • All ai_extract calls use v2.1 JSON STRING schema (typed schema in Notebook 04) + :response:field:value::TYPE path access.
  • ai_query calls that duplicated task-specific functionality are now ai_extract. The one remaining ai_query (generative "next_step" in Notebook 03) uses databricks-gpt-oss-120b.
  • ai_analyze_sentiment (Preview) replaced with ai_classify over four sentiment labels (positive, negative, neutral, mixed) so the example is GA-runnable.
  • README.md "Functions Used" column refreshed to match.
  • DBC archive regenerated from the tested workspace state.
Notebook Substance
01_document_intelligence.py ai_queryai_extract; VARIANT path access replaces from_json STRUCT
02_communication_triage.py ai_classify v1 → v2 + cast
03_summarization.py Split into ai_extract (facts) + ai_query for next_step on databricks-gpt-oss-120b
04_translation_normalization.py ai_extract v1 → v2.1 (array form in Step 2, typed schema in Step 3)
05_sentiment_analysis.py Sentiment via ai_classify; all ai_classify v1 → v2
README.md Functions-used column updated

Test plan

  • Run each notebook end-to-end on a Serverless SQL warehouse
  • Verify the v2 VARIANT outputs match the "Expected output" tables in each notebook
  • Confirm databricks-gpt-oss-120b endpoint is available in the test workspace
  • Spot-check the README rendering on GitHub
  • Sanity scan: no remaining claude-sonnet-4, meta-llama-3-3-70b-instruct, ai_analyze_sentiment, or v1 ARRAY(...) label form

Copy link
Copy Markdown
Contributor Author

@srikantdas11 srikantdas11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made changes to the code to use the Version 2 syntax

- ai_classify (v1 ARRAY -> v2 JSON STRING) + ":response[0]::STRING" cast
  (Notebooks 02, 05)
- ai_extract (v1 ARRAY -> v2.1 JSON STRING / typed schema) + VARIANT path
  access via ":response:field:value::TYPE" (Notebooks 01, 03, 04)
- ai_query calls that duplicated task-specific functionality replaced with
  ai_extract; the remaining ai_query (Notebook 03, generative "next_step")
  uses databricks-gpt-oss-120b
- ai_analyze_sentiment (Preview) replaced with ai_classify over the four
  standard sentiment labels so the example is GA-runnable (Notebook 05)
- README "Functions Used" column refreshed
- DBC archive regenerated from tested workspace state to match

Co-authored-by: Isaac
@srikantdas11 srikantdas11 force-pushed the ai-functions-v2-syntax branch from faf9f44 to b01e2fb Compare May 15, 2026 13:35
Copy link
Copy Markdown
Contributor Author

@srikantdas11 srikantdas11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code tested and Updated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant