- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi Team,
I am new to Databricks and working on Gen AI requirements.
Task - Build custom prompt with set of instructions to classify incident e.g. False Positive or True Positive. Input will be columns in Delta Table
Can I build custom LLM function with custom prompt and invoke it similar to built in AI function as SQL query. Or I should register function as model serving endpoint and then use this endpoint to apply on each record in Delta Table. Kindly provide suggestions
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @neha89 -
You can use below approach:
Databricks provides AI Functions that allow invoking large language models directly within SQL queries. Here’s how this approach works:
- Define a Custom AI Function: You can define a SQL function using ai_query or similar built-in AI capabilities, which directly interact with a generative AI model (e.g., Databricks Foundation Models or OpenAI models).
- Prompt Engineering: Build your classification prompt that receives Delta Table columns as input and generates the required classification (False Positive/True Positive).
- Integrating with Delta Table: Use this SQL function to compute the classification and update the Delta Table
- Create an AI Function using ai_query.
- Apply the function in an UPDATE or SELECT statement for your Delta Table.
- Execute through standard SQL pipelines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @neha89 -
You can use below approach:
Databricks provides AI Functions that allow invoking large language models directly within SQL queries. Here’s how this approach works:
- Define a Custom AI Function: You can define a SQL function using ai_query or similar built-in AI capabilities, which directly interact with a generative AI model (e.g., Databricks Foundation Models or OpenAI models).
- Prompt Engineering: Build your classification prompt that receives Delta Table columns as input and generates the required classification (False Positive/True Positive).
- Integrating with Delta Table: Use this SQL function to compute the classification and update the Delta Table
- Create an AI Function using ai_query.
- Apply the function in an UPDATE or SELECT statement for your Delta Table.
- Execute through standard SQL pipelines.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Thank you @Alberto_Umana for explanation. This is really helpful!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
No problem, if you have any other question, let me know!

