Home/Insights/Data Engineering
AI IN FINANCE
In short: Snowflake Cortex Analyst answered the portfolio question "How much Volvo shares do we own?" in less than 1 minute, using a free Snowflake account.
Snowflake Cortex Analyst lets business users query SQL tables in plain language, and the hard part is not building the agent. The make-or-break component is the semantic view: a YAML file that explains to the LLM what every column in your tables actually means, demonstrated here on a compliance database with three tables: breaches, holdings, and rules.
Snowflake Intelligence sits on top as a chatbot, like ChatGPT but grounded in your Snowflake data, and underneath it the Cortex Agent plans, reasons, and orchestrates. The agent routes each question to Cortex Analyst for structured SQL tables or to Cortex Search for documents, and the semantic view sits between the chat layer and the tables, so the LLM checks it first to find the right columns.
A semantic view translates cryptic column names into business meaning, including synonyms the LLM can match against user phrasing. A column called weight_pct is described as "percentage of total portfolio" with synonyms like weight and allocation, and value_million_sek becomes "market value in million SEK" with synonyms value, worth, and size. When a user asks "How much Volvo do we own?", the LLM reads those descriptions to pick the right column instead of guessing between weight_pct, value_million_sek, and current_pct.
| Component | Role |
|---|---|
| Snowflake Intelligence | Chat interface grounded in your Snowflake data |
| Cortex Agent | Plans, reasons, and routes questions to the right tool |
| Cortex Analyst | Generates SQL against structured tables |
| Cortex Search | Retrieves answers from documents |
| Semantic view (YAML) | Explains column meanings and synonyms to the LLM |
In Snowsight, go to AI and ML, open AI Studio, choose Cortex Analyst, click Try, then Create New. Snowflake offers three options: create a new semantic view (the recommended path, saved directly under your schema), create a semantic model (a legacy YAML file you upload to a stage), or upload your own YAML. From there you pick the database and schema, select the tables the agent may use, select the columns, and click Create and Save; generation takes a couple of seconds.
Most of the work is editing the generated YAML: adding descriptions, synonyms, named filters, metrics such as sum, average, and count, and verified questions your team actually asks. Snowflake auto-classifies columns into dimensions (descriptive), time dimensions (date types), and facts (numeric), but that file is only a starting point. Ani Björkström, a Stockholm-based tech consultant, calls this editing stage the part that makes or breaks the agent.
No. A free Snowflake account includes $400 in credits valid for 1 month, which is enough to build and test a Cortex Analyst on your own tables.
The LLMs behind Cortex are only available in certain regions, so your Snowflake account must be hosted where they run. The demo account used West Europe.
Verified questions are expected user questions stored with a reviewed SQL query. You can run the SQL, confirm the result is correct, and save it so future identical questions get validated answers.
Chapters: 0:00 Instant Snowflake Cortex Analyst Demo (Volvo shares in under a minute) · 0:12 What You’ll Build: Cortex Analyst + the One File That Makes or Breaks It · 0:33 Architecture Overview: Snowflake Intelligence, Cortex Agent, Analyst & Search · 1:10 Semantic View (YAML) Explained: Teaching the LLM Your Columns & Synonyms · 2:29 Quick Quiz: Semantic View vs Tools + What Generates SQL? · 3:13 Set Up Snowsight & AI Studio (Free Account, Region/LLM Availability) · 4:14 Create a New Semantic View: Database/Schema, Tables, Columns · 6:37 Inside the Semantic View: Dimensions, Time, Facts, Filters & Metrics · 8:04 Improve Accuracy: Relationships, Verified Questions, and Editing YAML · 9:11 Example of a Fully Enriched Semantic View (Synonyms, Comments) · 10:05 Wrap-Up: Why Semantics Is the Hard Part + Next Tutorial
0:01 Look at this. I asked Snowflake how much Volvo shares do we own? And I got an answer in less than 1 minute. Hi, my name is Annie. I'm a tech consultant based in Stockholm. In this tutorial, I will show you how to create Snowflake Cortex analyst step-by-step and understand [music] all the features behind this tool. But here is the thing, creating the agent is not the hard part. There is one file that makes the tool make or break, and I will show you exactly how to make it right. Let's get started. Before we build anything, let's look into the architecture and understand how all of those pieces work together. So, on the top level, we have Snowflake intelligence. This is a chatbot like ChatGPT, but it's based on your Snowflake data.
0:46 Underneath this exists [music] Cortex agent, which is the brain. It plans, reasons, and orchestrates. It is connected to an LLM model. Underneath that, we have Cortex analyst and Cortex search. Cortex analyst is used to get data from structured data like SQL tables, and Cortex search is used to get data [music] from documents. One thing that is extremely important in this case is semantic view, which is a YAML file. It is between Snowflake intelligence chart and your SQL tables. So, for example, if we have a table with columns weight, PCT, value, million SEK, and current PCT, when the user asks questions, for example, how much Volvo do we own, the AI will not know exactly from which column to get this information.
1:37 So, that is why we are creating a model, and in this model, we are explaining for AI that weight PCT is percentage of total portfolio, and we are even specifying synonyms like weight allocation, and then the same thing we do for all columns. For example, for value million SEK, we write that it is equal to market value in million SEK, and the synonym to value million SEK will be value, worth, size. And when user asks how much Volvo do we own, then the AI or LLM knows from which tables it needs to get information because the LLM will first look into this semantic model to understand from which tables to get this information from. That is [music] why creating a very detailed semantic model makes the difference if your AI agent works well or not.
2:30 Now, before we create an actual Cortex analyst, I have a quick quiz for you. The first question is, what file tells the AI what your data means in Snowflake Cortex? You have the option SQL worksheet, semantic view, JSON config, or Cortex agent. Yes, the answer is semantic view. Next question. Which Cortex tool generates SQL queries for structured data? Cortex search, Cortex agent, Cortex analyst, or Snowflake intelligence? Correct, the answer is Cortex analyst. Now, we will log in into Snowsight, and by the way, I'm using Snowflake's free account.
3:19 If you don't have a Snowflake account, just go ahead and create a free account. You will get $400 free credits to use in 1 month. Another important thing is that if you want to test AI features, you need to make sure that your Snowflake account is hosted in a region where those LLMs are available, and in my case, I'm using West Europe. Then from there, we can go to AI and ML, and from here, you can choose AI studio. In AI studio, you can see all the AI tools. Under agents, we have Cortex analyst, Cortex search, and Cortex agent. As we saw in the presentation, Cortex agent is combining Cortex search and Cortex analyst, and it is clever enough to define, based on the user questions, whether to use Cortex analyst or Cortex search.
4:11 For this tutorial, we will look into Cortex analyst, so we will click on try button. And from there, we will click create new. And here, you can see that we have [music] drop-down list, and we have different options. The first option is create new semantic view, and the second option is create new semantic model, which is a legacy, and the last one is upload your YAML file. So, the difference between the first and the second one is that if you click on the first one, you create the actual view, and it will pop up under your schema. However, if you want to create semantic model, then you will first need to create YAML files separately on your local computer, then you need to upload it to the stage in Snowflake.
4:56 We will go with Snowflake recommendation and will create new semantic view instead of the model. And then we need to create a location to store, and that will be a database. In my case, I will choose compliance demo database, and then we need to choose a schema where this view will be saved, and it will be found. Then we need to create a name for this semantic view, so I will create compliance. Okay, you can even create a description, but I will go ahead. So, I clicked on the next button, and in here, you can see that you can specify [music] SQL queries, Tableau files, but I will just skip this step.
5:45 And in here, we will select the tables. So, this is very important because the tables that we select at this stage will be used to answer to user questions. So, it is very important to define which tables should be included in the semantic view. In my case, I will open compliance demo, and then under found, I will choose all three tables. You can see that I have breaches, holdings, and rules. Then I will click on the next button. So, in here, we need to choose the columns, and I want to choose all the columns from all the tables, so I will click on the table name in order to select all the columns. Once that is done, I will click on create and save. You can see generating semantic view. It can take couple of seconds.
6:35 Okay, it is done. And in here, we can see that under custom instructions, we have logical tables, and then we have breaches, holdings, and rules, and those are the names of our tables. And underneath the tables, we have dimensions, time dimension, facts, name filters, and metrics. And let's try to understand what are dimensions. The dimensions are the actual columns from and all the columns that have descriptive information are called dimensions. Then there is another category that is called time dimensions, and those are the columns that have data type date. Then underneath that, we have facts, and those are the columns that have numerical information that can be summarized or used for numeric operations.
7:24 And then underneath that, we have named filters, and we can [music] see that there is no defined name filters, and there are metrics as well. Name filters, if we click on the plus button, we can see that those are the filters that we can create on different columns. And the same thing also goes for the metrics. Those are different types of metrics, for example, sum or average or count that we can create for some of the columns, and in this way, we will help the agent to answer questions connected to those metrics. For example, if a user asks a question about the sum, this metric will be used to define the answer. Then we have the exactly same thing for holdings and rules as well. On the right side, we can see some suggestions. It is suggesting us to connect breaches to rules.
8:09 So, we will click on review, and then add. Then we have add verified questions. This is a question basically that Snowflake think users will ask, which countries have the highest total investment weights? And I think this sounds legit as well. When we click on the review button, we can see the question that users might ask, and then we even see the SQL query, and we can run the SQL query. We can see if we are getting correct information, and if we are satisfied with this, we can say save and continue. And now, in order to make your semantic model a lot better, you can click on edit YAML, and in here, you can review every single column and create a description synonyms as well, and add even more questions.
8:56 For example, if you already know what are the most queried questions by your compliance team, then you can add all of those questions in here to make sure that later on, when users are asking the same questions, they are getting the correct answers. I have another model that I have updated, so I will show that model for you to understand exactly how to update the model. If you go to database explorer, from there, you will choose [clears throat] your database. In our case, it was compliance demo, and then the schema was found, and under that schema, we have semantic views. Underneath that, you can see two views. The compliance one is the one that we have just created, and then we have compliance semantic view that I created before this tutorial. And in here, if we expand the semantic view, we can open it in workspace.
9:48 You can see that I added a lot more information. For example, under dimensions, we have the name of the column, and then I created scene on him. The same thing also with comments. So, this is basically what you will do to make sure that your agent can answer the questions as accurate as possible. And honestly, this is the part where you will spend most time and this is one thing that will make your AI agent make or break. If you want to get the semantic view, just comment semantic view down below and I will share it with you. In the next tutorial, we will look into Cortex Search and Cortex Agent. If you like this tutorial, please give me thumbs up and see you in the next one. Bye.
Want this working inside your finance team?