- Enable AI (LLM) Functions in Your Warehouse
- Create a Custom SQL Source
- Create Validators on your Custom SQL Source
Enable AI functions in your warehouse
BigQuery
BigQuery providesML.GENERATE_TEXT and AI.GENERATE functions for text generation and analysis.
Prerequisites
- Enable the Vertex AI API in your Google Cloud project
-
Create a BigQuery ML remote model pointing to a Gemini model:
SQL (BigQuery)
-
Grant the connection service account Vertex AI User role:
- Go to your connection details to find the service account
- Grant
roles/aiplatform.useron your project
Documentation
Refer to the following documentation for more information:Databricks
Databricks providesai_query() and task-specific AI functions.
Prerequisites
- Workspace in a supported Model Serving region
- AI functions are enabled by default for Foundation Model APIs
- For external models: Enable “AI_Query for Custom Models and External Models” in Databricks Previews UI
Available models
- Databricks-hosted:
databricks-meta-llama-3-3-70b-instruct,databricks-mixtral-8x7b-instruct, and more - Task-specific functions:
ai_analyze_sentiment(),ai_classify(),ai_extract(),ai_summarize()
Documentation
Refer to the following documentation for more information:Snowflake
Snowflake Cortex providesCOMPLETE and task-specific AI functions via Snowflake Cortex AISQL.
Prerequisites
- CORTEX_USER database role (granted to PUBLIC by default)
- Snowflake account in a supported region
-
Grant access (if needed)
SQL (Snowflake)
Available models
- Snowflake Arctic, Meta Llama 3 (8B/70B), Mistral Large, Mixtral-8x7b, Reka Core, and more
- Task-specific:
CLASSIFY_TEXT(),EXTRACT_ANSWER(),SENTIMENT(),SUMMARIZE(),TRANSLATE()
Documentation
Refer to the following documentation for more information:Create a Custom SQL source
Create your source in Validio using Custom SQL instead of creating a Custom SQL Validator with LLM function calls. This allows you to define the LLM output as a field on the source, which will make it easier to apply thresholds and debug incidents. Additional benefits of using a Custom SQL Source include:- Test and debug AI queries directly in the source configuration
- Iterate on prompt engineering independent of Validators configuration
- Better error messages when using the debug query
Creating the Custom SQL source
In Validio,- Navigate to the Sources page and click + New source
- Select your warehouse type: BigQuery, Databricks, or Snowflake
- Under “Specify the data”, choose Use Custom SQL
- Paste your SQL query with the AI function
- Set your Polling schedule
- Click Continue to infer the schema
- Add Tags, Owner, and create the source
Example of Custom SQL source definition
SQL (Snowflake)
Create validators on your Custom SQL source
Now create validators on your Custom SQL Source to monitor the AI-validated results. The following validator configuration will count the number of irregular country names per day.Example: Count invalid country names
In Validio,- Navigate to your Custom SQL source
- Click + New validator
- Select validator type: Volume → Count
- Configure:
- Field:
country_validation_result(or your AI result column) - Filter: Use String filter →
Field country_validation_resultis exactlyNO - Window: Choose appropriate window (e.g., Daily)
- Field:
- Set Threshold:
- Fixed Threshold:
>= 0to alert on any irregular entries - Dynamic Threshold: To detect anomalies in patterns over time
- Fixed Threshold:
- Add Name, Description, and click Continue
Additional examples
Product category validation
Custom SQL Source:SQL (BigQuery)
category_is_valid = 'NO'.
Product description quality
Custom SQL Source:SQL (Snowflake)
description_quality_score <= 2.