SnowPro Advanced: Security Engineer Question 408
Single answerConfigure COMPLETE() and TRY_COMPLETE() functions to filter contentA security engineering team is building an internal analyst assistant in Snowflake that summarizes support tickets with the COMPLETE() family of functions. The assistant must block responses that contain disallowed content categories, but the application must continue operating even if content filtering causes a generation request to fail. During testing, the team notices that some prompts cause COMPLETE() calls to raise errors, which interrupts downstream SQL pipelines. Which approach should the security engineer implement to meet the requirement?
- A
Replace COMPLETE() with TRY_COMPLETE(), and evaluate the returned value so blocked or failed generations can be handled without aborting the SQL statement.
- B
Keep using COMPLETE(), but wrap the call in a masking policy so Snowflake automatically suppresses blocked model responses before they are returned.
- C
Use COMPLETE() and set the temperature to 0 so the model avoids generating disallowed content and no filtering errors occur.
- D
Store prompts in a temporary table first, because content filtering is only enforced for inline prompts and not for prompts read from tables.
Show answer and explanation
Correct answer: A
Explanation
The key requirement is twofold: apply content filtering to model output and keep the SQL workflow resilient when a request is blocked or otherwise fails. In Snowflake Cortex AISQL, COMPLETE() can raise an error when generation cannot be completed successfully. TRY_COMPLETE() is the safer choice when the application must continue processing because it is designed to return a result that can be checked programmatically rather than terminating the statement. This aligns with secure application design: enforce filtering, fail safely, and handle exceptions explicitly in code or SQL logic. Best practice is to use TRY_COMPLETE() in production pipelines where robustness matters, then inspect the response and route blocked or null/error outcomes to logging, fallback text, or manual review. Temperature and storage location do not control content filtering behavior, and governance features like masking policies do not replace generation-time safety handling.
- A. Correct.
Correct. TRY_COMPLETE() is intended for cases where the application should continue running even when the underlying COMPLETE() operation fails, including failures related to content filtering or other generation issues. In a security-sensitive workflow, this lets the engineer inspect the returned result and implement fallback handling, logging, or safe user messaging instead of allowing the SQL pipeline to fail outright.
- B. Incorrect.
Incorrect. Masking policies protect column data at query time, but they do not function as wrappers that intercept COMPLETE() execution failures or model content-filtering exceptions. A masking policy is not the mechanism for handling LLM generation errors.
- C. Incorrect.
Incorrect. Lowering temperature can make output more deterministic, but it does not disable or guarantee avoidance of content filtering outcomes. Content filtering is a safety control, not a randomness setting. A common misconception is to treat model parameters as substitutes for enforcement controls.
- D. Incorrect.
Incorrect. Content filtering is not bypassed based on whether the prompt is inline or sourced from a table. Snowflake does not provide a pattern where storing prompts in a temporary table avoids safety enforcement. This distractor reflects an incorrect assumption that data source location changes model safety behavior.