SnowPro Specialty: Gen AI exam dumps

SnowPro Specialty: Gen AI practice question 227 of 287

SnowPro® Specialty: Gen AI. Expert level, Snowflake. Free question with the correct answer and a full explanation.

SnowPro Specialty: Gen AI Question 227

Single answerTRY_COMPLETE (SNOWFLAKE.CORTEX)

A support analytics team stores incoming customer emails in a Snowflake table and uses SQL to classify each message with an LLM. They currently call SNOWFLAKE.CORTEX.COMPLETE in a nightly batch job, but occasionally a malformed prompt or model-related issue causes the statement to fail and the entire batch must be rerun. The team wants the job to continue processing all rows even when an individual generation attempt fails, and they want failed rows to return NULL so they can review them later. Which approach best meets this requirement?

  1. A

    Replace SNOWFLAKE.CORTEX.COMPLETE with SNOWFLAKE.CORTEX.TRY_COMPLETE so failed inference attempts return NULL instead of raising an error for the statement.

  2. B

    Wrap SNOWFLAKE.CORTEX.COMPLETE inside TRY_CAST so generation errors are converted to NULL values at runtime.

  3. C

    Use SNOWFLAKE.CORTEX.COMPLETE with a larger warehouse so model invocation errors are suppressed and the query completes.

  4. D

    Call SNOWFLAKE.CORTEX.TRY_COMPLETE only in a stored procedure, because it cannot be used directly in a SQL SELECT statement.

Show answer and explanation

Correct answer: A

Explanation

The key requirement is graceful handling of per-row generation failures in a batch SQL workflow. SNOWFLAKE.CORTEX.COMPLETE raises an error when a completion request fails, which can stop the statement. SNOWFLAKE.CORTEX.TRY_COMPLETE is the appropriate alternative when you want failed calls to return NULL and allow the rest of the query to continue. This pattern is especially useful in production pipelines where you want to preserve throughput, capture failed rows for later inspection, and avoid rerunning an entire batch because of a small number of problematic inputs. Snowflake documentation for Cortex completion functions and TRY_ semantics supports using TRY_COMPLETE for fault-tolerant inference handling in SQL.

  • A. Correct.

    Correct. TRY_COMPLETE is designed for error-tolerant generation scenarios. Like other TRY_ patterns in Snowflake, it returns NULL when the function would otherwise error, allowing the SQL statement to continue processing other rows. This is the right choice when a batch workflow should not fail entirely because some individual prompts or invocations are problematic.

  • B. Incorrect.

    Incorrect. TRY_CAST applies to data type conversion, not to handling execution errors from Cortex LLM generation functions. It will not intercept errors raised by SNOWFLAKE.CORTEX.COMPLETE itself. This option reflects a common misconception that TRY_ wrappers are interchangeable across unrelated function categories.

  • C. Incorrect.

    Incorrect. Warehouse size affects compute resources for query execution, but it does not convert application-level or model invocation errors into successful results. Increasing warehouse size may help performance, but it does not provide the row-level fault tolerance the scenario requires.

  • D. Incorrect.

    Incorrect. TRY_COMPLETE can be used directly in SQL expressions, including SELECT statements. It is not limited to stored procedures. This distractor targets the misconception that Cortex functions must be orchestrated procedurally rather than being usable inline in SQL.

Timed practice exam

Take a SnowPro Specialty: Gen AI practice test under exam conditions

55 questions in 85 minutes, drawn from this bank, with a score report and a per-question review when you finish.

Start timed exam