
Snowflake Cortex columns (AI columns)
We show how to take advantage of Snowflake Cortex to enrich data in Omni using modern LLMs. We show several examples of enriching marketing data, even layering interactive UI for selecting…
Transcript
This transcript is auto-generated. Names and product terms may be wrong.
okay shall we get into demos now okay now I'll go let me my screens in order here uh so this was um this was actually inspired by some conversations that folks were having earlier this week around a bunch of the AI features um and so uh we wanted to play around with some of the snowflake cortex stuff um and just show youall what's possible um so the way it works is that snowflake actually has a bunch of fun that can just call llms on a row by row basis um and we can handle the modeling of them really really well so essentially what you're doing is you're creating these specialized functions um that can do things like classification um you can also just ask the
llm to complete things um and you can essentially just build these little functions for doing any sort of analysis um so I'll show you a couple examples uh this one we will look at uh States funus um I'm not again I have no idea how this actually works but uh it's going to go through row by row and do fness now the key here is you actually have to do the grouping before you hit the llm otherwise it's going to literally go through row by row and do it for the entire data set um so I think correctly Arkansas has been identified as other um most of the states are labeled as fun uh no real comment but the South did not do so well
in funest uh um the the other really nice aspect here though is that you can actually do some sort of completion um so uh we've got this one for uh State most famous person um and you can see here that uh it essentially is going to um create a function where we just say who is the most famous person from State um and uh we we spent some time looking through this Stephen and I and uh for whatever reason snowflakes model really likes the rock he's the most famous person in California and Florida uh no real comment there um but what's really nice here is that we can also use some of the dynamic aspects of the model to uh to actually make this you
know more interesting so you can actually pick the the um the llm that you're using and so we can actually map this to a dynamic filter and we can actually toggle between the different models so we set the default a snowflakes default model you can label them um but we can also use for example Claude um and you can see that it does a better job at um sort of identifying different folks here this is hitting the cach which is nice so we don't need to go rerun the query um but it it's it's pretty amazing the stuff that you can do here um and Ariel's going to pile on with some more stuff that she sort of figured out Colin do do you mind
going on screen again and just doing the drop down to Cortex again so I can send a screenshot to Sav while she's out on leave and just put a smile on her face yeah yeah so um I didn't I didn't shove them all in here but uh yeah they've got some small models some large models um it it it cost you know a penny per query so there's some cost here but it's actually quite low awesome so so I didn't maybe I just don't fully understand how all the things hook together so these are all like provided by snowflake the access to these models yeah so the way to think about it is that snowflake is providing a uh a UDF in SQL that on
a rowby row basis will ship something to an llm and pull back a cell and so we've written a query it uh you'll notice that I have to encode everything as a string to show it up but yeah like it it literally just passed back a Json response on a rowby row basis and um do stuff can you show us the fun query real quick the funest query yeah like how did you get fness uh oh yeah so uh I literally just said classify text and all it does is pass the state name in and then it classifies it as either a fun State and unfund State or other um I like I have literally no idea what it's doing but like you can kind
of pass anything into a classifier and it'll take the text that it has in this case it's literally just the state name can you ask it if it has good pizza yeah let's uh let's let's go State we can do it on the Fly state date Pizza quality I mean you could probably do this through the complete function but um State as good Pizza St has me pizza other not thinking too hard here okay refres remove this uh let's get this where State Pizza quality it's it's a lot of fun to play with um so if we had someone who were like doing say sentiment analysis on customer service data would we say probably do this in like a query View and then push it
to DVT so that it doesn't like con L rerun the AI every time you yes so you really want to be careful about the rows that you're passing in here so one thing you can see about how we have it set up and this is really just for a demo I'm grouping by state so I'm only grabbing the 50 states and then passing that in it will literally run row by row so if you pass it in even a even an ungrouped query like and put this in the grouping function it's it's going to run over every single row and it'll be incredibly slow so you got to be thoughtful about it um I'm let aial demo a little bit but we'll I I think
what we want to be able to do is pick these up turn these into Data push it back to the warehouse that you can actually work with it uh this is this is actually accurate I don't know about Pennsylvania but Connecticut New York legit I didn't know Indiana good pizza so I guess I'll have to go over there it's because they're so close to Illinois okay fair fair fair enough if we change the llm model maybe we'll get a different answer um so yeah call inspired me I was kind of playing with a few other things uh trying to come up with some other maybe more like uh examples that we would use in business so one thing I was trying to do is we
just Rel like last week I think we demoed summarization on a full data set I was trying I was kind of curious to see if I can get it to summarize row by row so I built that was like sales and orders uh for each year and kind of passed in all of that data on a row by row basis and got a little nice readout of like each year um not tooo much crazy stuff here but what's back that is again just a little summary function that just gives it a prompt so summarize these figures I gave it a little more context and then I did create kind of a compound field that took the whole row and conceded it together because I was
just trying to hack something together um that's one example um I was also kind of playing around this is more in line with what Colin was showing but uh we were kind of thinking about like maybe marketing enrichment use cases of like I have a list of leads or companies and uh like the only thing I Pro like in our data set or in a data set here is the company and then created just a bunch of columns of like just what's the I mean there's not perfect stuff I might want to parse this out or ask it slightly different but like basically just enrichment of data that I would want to write back like URL cool company description like even things like recent news
like if I'm you know uh like about to go call this company up what should I know about them who's the CEO and like LinkedIn information so that was kind of cool and then this morning uh on the product Channel somebody had an interesting thought around this that was like could you give users an end way of like asking those questions so uh similar to Colin's little parameter demo um we built a similar thing where I added one column and I'll show the model in a second uh but basically you can just pass in different questions so like who's the CEO and it's going to go pass that into the function and then dynamically change what is it in this column and again it takes
a little bit of time um but it's also cool cuz you can just ask new questions like who's the CTO um for each of these companies and voila um so some cool stuff and let's see just to show I guess what's backing this let's go look at the workbook and let's go look at the model so got a little table here um I I did some pre-aggregation to Colin's point and then I just threw in a filter only field with a couple suggestions but you could also just write anything in uh and it just passes that and now instead in this cortex function um I've got a per instead of a hard-coded question it's just going to take that input from the filter and so
make this pretty Flats those are the most of the ones I wanted to show but uh some interesting things so are you just pulling the information that's available to CLA the underlying model in that area like does is that like connected to LinkedIn or something because like the difference between like I asked in our workbook which states had good pizza I'm the only one that got go pizza was New York everyone else that's Bob Pizza apparently but I'm just trying to think of like the step difference for what's available in chat gbt today versus how people will actually use CeX in practice is it like live information versus static or it's I mean it's basically the equivalent to like if I was to go directly
to chat GPT and ask that question with like for each company or or give it a company and say what's or or a state and say who does Texas have good pizza um and you can choose the model you can either encode it into Omni like into that function I have and say I want to use explicitly uh like the latest claw model um or you could make it Dynamic like Colin had and he made it a switcher so you can pick but yes yeah the system prompt is going to be different between using Char gbt on your like browser or phone versus like you know using CLA through CeX like snowflake will have some like default system PRS that Force the model to classify
if you say classify or complete if you say complete um yeah and cloud is my opinion more intelligent than GPD 40 um so it might be like doing a little bit better there Ariel do you know is um are cortex's models capable of like making web requests to to pull more data or anything like that I'm guessing I don't know shaking his head I'm gonna I'm gonna trust his authority on this one yeah I think K is our uh is our leading Authority on these right now but it's I mean it's it's pretty magical the stuff that you can sort of lightly parameterize and I think that we could probably lean into building some use cases around these that are pretty valuable yeah this is
also just like marketing we can do without any product development required and content we can write um here here's just the the snowflake documentation so I was just playing around a lot with complete which is like a general purpose just ask some question Colin I think showed like classify but um you can see they have other things like sentiments uh summarize here's our here's our localization strategy I suppose um but yeah this is all just coming from from Snowflake yeah so on the sales side if we had everyone's if we pulled from Salesforce every single account that was in each rep's name and then on a rep by rep basis for all public companies so you have a good look at like the 10K and
the major initiatives that they have in each one of those and just list it out so you'd have a list of like everyone you should probably go focus on and Target so pretty cool um cool and not to take up too much other time for what it's worth this is snowflake specific I was trying to poke around this morning and see if like other databases support anything like this big query does have some I didn't get a chance to get hands on with it they have something called like vertex AI that I think can do something similar so there is a untested but possible chance that big query customers uh could be doing similar types of things