Behind the Cloud: Using Generative AI in the GCP

In this episode of Behind the Cloud, Matt delves into the world of generative AI in the Google Cloud Platform, highlighting how Google has integrated generative AI features into its various services. Matt explores the ways generative AI can be used within BigQuery, such as generating SQL queries and Python notebooks!

Watch below 👇 or head over to our YouTube channel

Transcript

Introduction to Generative AI in Google Cloud

[00:00:00] Matt: Hello and welcome to another episode of Behind the Cloud. Uh, today we’re going to cover generative AI. So unless you’ve been living under a bit of a rock for the past, uh, You will probably have heard of generative AI. What you may not realise is quite how much time, effort and resource Google is putting into introducing generative AI into the Google cloud platform.

[00:00:28] Matt: It seems like their entire roadmap since. Gemini was released or Bard back in the day has been focused on adding generative AI features to pretty much every service across the GCP. So I thought today would be a really good opportunity for us to dive into a couple of those instances primarily around BigQuery because that’s where we live.

Generative AI in BigQuery

[00:00:47] Matt: There’s quite a few different places within BigQuery where you’re going to find generative AI hidden away. First and foremost just within a Query window, there’s going to be a couple of ways you can interact with it in order to generate SQL. In the top right hand corner here on the top bar, you’ll see this little pencil with the, what has become the universal symbol for AI, the little diamond, and inside of there, you’ll see all of the settings, things you can toggle off for SQL generation and Python notebook generation when it comes to generative AI.

Interactive SQL Generation

[00:01:18] Matt: So right now I’ve got everything turned on because obviously we are demonstrating it. Within the query. I can do a couple of things. So let me just randomly pick out a table. If I start a comment and say all data from the films table in the Magda test data set. Now if I hit return, it starts to whir up here and think for a second.

[00:01:44] Matt: Then it will suggest a SQL query. for you. It’ll suggest something that it thinks is what you want. I have a lot of data, a lot of data sets in here and a lot of tables, so it doesn’t look right to me. These are things you need to check. Generative AI isn’t foolproof. It’s not going to always give you the right thing, particularly if you’re not as specific as you perhaps should be.

[00:02:05] Matt: Maybe there I should have you know specified the table and the data set in the format that it would use within the From block, but I didn’t but if you wanted to accept that query you can push press tab And then it’ll pull that query in for you So let’s try that again But this time i’m going to click the sql generation pencil on the left hand side click that And that’s going to bring up this preview window here and I can ask a very similar question and this is slightly different than The previous one The just automatically generated thing, cause you can start to refine things a little bit.

[00:02:36] Matt: You can keep feeding back to it back and forth. Actually, can we do this? Can we do that? Can we change the table name? This will actually also give you summaries of what it thinks it will take to run, whether it thinks it’s valid or not, it’ll give you a little tick box. If this is a valid query, you can edit the table sources with a little bit more ease in here.

Explaining Queries with Generative AI

[00:02:55] Matt: So this is much more sort of interactive than I can insert that and then I can run that no problem What I can also do is say I’ve come into a big query instance and there’s a load of Scheduled queries or there’s a load of say queries and then I don’t understand what the hell is going on I can highlight sections of that Code and you’ll notice that that little icon on the left hand side has changed from a pencil to the little three stars I can now ask it to explain this query to me and this will open up the Gemini window on the right hand side And it will do its best to try and explain exactly what we’re seeing here.

[00:03:28] Matt: You can see it’s select all this means It’s grabbing everything. It’s from the specific table. So it’s giving me a good explanation of things So you can break that down into smaller pieces of code if you want explanations of exactly what’s happening What you can also do with this is you can transform.

[00:03:42] Matt: So this would be to alter that SQL query that we’ve already written using the generative AI window that we already showed before. So you can change our tables, alter things in different ways. So it’s another little tool to be able to manipulate existing SQL. Something else that’s relatively new, If I click into a table, you’ll notice two big previews up here.

Generating Insights from Tables

[00:04:02] Matt: The one I’m interested in here is the insights preview. So if I click into insights and ask it to generate insights, what it’s going to do is it’s going to use generative AI, look into the table, and it’s going to suggest loads of potential queries I could ask, questions I could ask of that data. And it’s going to provide me with the SQL.

[00:04:21] Matt: to ask those questions. Now we can see that it’s generated a load of insights for us. So this has got lots of different questions that it thinks we could ask. This genre is the highest average star rating of films of less than 90 minutes and it has created a SQL query that we can copy and go and answer that question.

Data Canvas and Natural Language Queries

[00:04:38] Matt: So another thing to show is the data canvas. A data canvas is going to be a subject all of its own for a future video, but for right now there are some natural language ways of interacting with your BigQuery data in this data canvas. So I’ve been able to just sort of naturally write a table I want to find.

[00:04:54] Matt: So again, I’ve tried to find the films table in the magnet test dataset. And there it is at the top. So I can click actor canvas. Now I have this table available to me within my canvas. If I click query, it’s the suggested one. But if I want to, we can look at, we can preview the data to see what’s in there.

[00:05:11] Matt: So let’s say only. Films with a star rating over five. So SQL query with films that are a star rating of over five. Let me run that. There’s our data. Now, if I click visualise into, let’s say a pie chart, again, we’ve got generative AI pieces within the visualisation component so that we can start to manipulate visualisations.

[00:05:38] Matt: I’ll just ask the follow up question to limit. To the top 10 films there, and it has redone my chart in that way. And you can manipulate and keep trying with this, playing with it till you get what you want. Next thing to show is the sidebar. So throughout GCP now, you’re going to have this Gemini AI chat at the top.

Gemini AI Chat Sidebar

[00:05:57] Matt: Within here, you can ask, Any general question about the GCP so I could ask what his secret manager one of his suggested questions Obviously this is trained on a lot of documentation around its GCP So if you’re in a particular location if you’re struggling if you need to ask and figure something out Maybe a good place to start would be to look into this Sidebar, it also suggests for you documentation that you can go off and read.

Conclusion and Future Updates

[00:06:21] Matt: So I hope you enjoyed that There’s lots of new features coming online all the time But a lot of these things are in beta a lot of these things need accessing via turning on APIs and signing up to beta programs. Keep a lookout behind the cloud for our blogs, for LinkedIn posts, because we’re always exploring this technology and we’re really interested in it.[00:06:39] Matt: As always, like and subscribe to keep up to date when these new videos come out and we’ll see you on the next one. Thanks.

Share:
Written by

Matthew is Head of Engineering and Technology at Measurelab and loves solving complex problems with code, cloud technology and data. Outside of analytics, he enjoys playing computer games, woodworking and spending time with his young family.

Subscribe to our newsletter: