SnowPro Specialty: Gen AI Question 214
Single answerCalling the modelA data engineering team is building a SQL-based workflow in Snowflake to generate short product summaries from catalog text stored in a table. The team wants to call a large language model directly from SQL, keep the implementation simple, and make the model used in each query explicit for auditability. Which approach best meets these requirements?
- A
Use the AI_COMPLETE function in SQL and specify the model name in the function call along with the prompt built from the catalog text.
- B
Create a Snowpark UDF that downloads an open-source model into the warehouse and performs inference locally for each row.
- C
Use Cortex Search to send the catalog text directly to a language model and return generated summaries.
- D
Call an external REST API from a SQL SELECT statement without using a Snowflake AI function, because model invocation is not supported directly in SQL.
Show answer and explanation
Correct answer: A
Explanation
For calling a model directly in Snowflake SQL, the supported and practical approach is to use Snowflake Cortex AISQL functions such as AI_COMPLETE for generation tasks. This allows teams to invoke a model within a query, pass prompt text derived from table columns, and explicitly specify the model in the function call. That aligns well with operational simplicity, transparency, and auditability. Cortex Search is a retrieval capability rather than the primary interface for text generation, and building custom inference inside Snowpark is unnecessarily complex for this requirement. Snowflake documentation for Cortex AISQL functions and model calling patterns describes using SQL functions to invoke models directly and specifying the model as part of the function signature.
- A. Correct.
Correct. Snowflake provides SQL functions for calling models directly, including AI_COMPLETE for text generation/completion use cases. Specifying the model name in the function call satisfies the requirement to make the selected model explicit and auditable in the SQL itself. This is also the simplest implementation when the goal is to generate text directly from table data in Snowflake.
- B. Incorrect.
Incorrect. This adds significant operational complexity and does not align with the requirement to keep the implementation simple. Downloading and hosting an open-source model inside warehouse-backed execution is not the intended pattern for standard Snowflake model invocation in SQL. The question asks for direct model calling from SQL using supported Snowflake capabilities.
- C. Incorrect.
Incorrect. Cortex Search is intended for semantic retrieval over indexed content, not for directly generating product summaries from text as the primary model-calling interface. A candidate might choose this if they confuse retrieval/search capabilities with text generation. For summarization or generation, a model invocation function such as AI_COMPLETE is the appropriate tool.
- D. Incorrect.
Incorrect. Snowflake does support direct model invocation from SQL through built-in AI functions, so an external REST API is not required for this scenario. While external functions exist for some integration patterns, they are not the simplest or most direct option when the requirement is to call a supported model from SQL and explicitly name the model used.