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.
1. Hybrid Search (Cortex Search)
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 ahybrid_fusionparameter 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'}}
);sqlConclusion
Cortex is moving up the stack. It’s not just a wrapper around an LLM; it’s a platform for reliable, governed AI applications.