|
1 | | -{% test ai_data_validation(model, column_name, expectation_prompt, context='', llm_model_name='claude-3-5-sonnet') %} |
| 1 | +{% test ai_data_validation(model, column_name, expectation_prompt, context='', llm_model_name) %} |
2 | 2 | {{ config(tags = ['elementary-tests']) }} |
3 | 3 | {%- if execute and elementary.is_test_command() and elementary.is_elementary_enabled() %} |
4 | 4 | {% set model_relation = elementary.get_model_relation_for_test(model, context["model"]) %} |
|
32 | 32 | {% endmacro %} |
33 | 33 |
|
34 | 34 | {% macro snowflake__generate_ai_data_validation_sql(model, column_name, prompt_template, llm_model_name) %} |
| 35 | + {% set default_snowflake_model_name = 'claude-3-5-sonnet' %} |
| 36 | + {% set chosen_llm_model_name = llm_model_name if llm_model_name is not none and llm_model_name|trim != '' else default_snowflake_model_name %} |
| 37 | + |
35 | 38 | with ai_data_validation_results as ( |
36 | 39 | select |
37 | 40 | snowflake.cortex.complete( |
38 | | - '{{ llm_model_name }}', |
| 41 | + '{{ chosen_llm_model_name }}', |
39 | 42 | concat('{{ prompt_template }}', {{ column_name }}::text) |
40 | 43 | ) as result |
41 | 44 | from {{ model }} |
|
46 | 49 | where lower(result) like '%false%' |
47 | 50 | {% endmacro %} |
48 | 51 |
|
49 | | -{% macro databricks__generate_ai_data_validation_sql(model, column_name, prompt_template, llm_model_name='databricks-meta-llama-3-3-70b-instruct') %} |
| 52 | +{% macro databricks__generate_ai_data_validation_sql(model, column_name, prompt_template, llm_model_name) %} |
| 53 | + {% set default_databricks_model_name = 'databricks-meta-llama-3-3-70b-instruct' %} |
| 54 | + {% set chosen_llm_model_name = llm_model_name if llm_model_name is not none and llm_model_name|trim != '' else default_databricks_model_name %} |
| 55 | + |
50 | 56 | with ai_data_validation_results as ( |
51 | 57 | select |
52 | 58 | ai_query( |
53 | | - '{{ llm_model_name }}', |
| 59 | + '{{ chosen_llm_model_name }}', |
54 | 60 | concat('{{ prompt_template }}', cast({{ column_name }} as string)) |
55 | 61 | ) as result |
56 | 62 | from {{ model }} |
|
62 | 68 | {% endmacro %} |
63 | 69 |
|
64 | 70 |
|
65 | | -{% macro bigquery__generate_ai_data_validation_sql(model, column_name, prompt_template, llm_model_name='gemini-1.5-pro') %} |
| 71 | +{% macro bigquery__generate_ai_data_validation_sql(model, column_name, prompt_template, llm_model_name) %} |
| 72 | + {% set default_bigquery_model_name = 'gemini-1.5-pro' %} |
| 73 | + {% set chosen_llm_model_name = llm_model_name if llm_model_name is not none and llm_model_name|trim != '' else default_bigquery_model_name %} |
| 74 | + |
66 | 75 | with ai_data_validation_results as ( |
67 | 76 | SELECT ml_generate_text_llm_result as result |
68 | 77 | FROM |
69 | 78 | ML.GENERATE_TEXT( |
70 | | - MODEL `{{model.schema}}.{{llm_model_name}}`, |
| 79 | + MODEL `{{model.schema}}.{{chosen_llm_model_name}}`, |
71 | 80 | ( |
72 | 81 | SELECT |
73 | 82 | CONCAT( |
|
0 commit comments