❄️
Data Flakes

Back

By now, most Snowflake developers have run a COMPLETE() function. But Cortex is evolving into a comprehensive AI suite. Let’s look at the advanced capabilities that separate a “demo” from a production AI app.

Vector search (semantic similarity) is great, but sometimes you need exact keyword matching (Lexical search). Cortex Search now supports Hybrid Retrieval.

  • Use Case: Searching for a specific product SKU (Lexical) while asking “which product is best for hiking” (Semantic).
  • Implementation: The SEARCH() capability now accepts a hybrid_fusion parameter to weight the results from both algorithms.

2. Cortex Analyst (Text-to-SQL)#

Unlike generic LLMs which struggle with schema accuracy, Cortex Analyst relies on a Semantic Model (YAML file defining metrics and dimensions).

  • Best Practice: Don’t just point it at raw tables. Build a simplified view layer and define your synonyms in the semantic model. “Revenue” might mean TOTAL_SALES - DISCOUNTS—the model captures this business logic so the LLM doesn’t have to guess.

3. Structured Output#

Getting an LLM to output valid JSON is notoriously hard. Cortex now supports “constrained generation”. You can pass a JSON schema to the completion function, ensuring the output matches your downstream application’s requirements strictly.

SELECT snowflake.cortex.complete(
    'llama-4-70b',
    'Extract the date and amount from this invoice...',
    options => {'response_format': {'type': 'json_object'}}
);
sql

Conclusion#

Cortex is moving up the stack. It’s not just a wrapper around an LLM; it’s a platform for reliable, governed AI applications.

Disclaimer

The information provided on this website is for general informational purposes only. While we strive to keep the information up to date and correct, there may be instances where information is outdated or links are no longer valid. We make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability, or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk.