Advanced options when creating AI models

Office Data gives you office 365 database with full contact details. If you like to buy the office database then you can discuss it here.
Post Reply
jahid12
Posts: 198
Joined: Thu May 22, 2025 5:14 am

Advanced options when creating AI models

Post by jahid12 »

If you read Google's documentation, you'll see that canada phone number list there are many more options for creating AI models than those discussed in this post. These are dedicated to fine-tuning: Creating the model pre-trained with data so that the AI ​​becomes more of a predictive function than a generative one. We can also enable Grounding from there (calling Google data before giving a response). These are all advanced options that we'll cover in future posts. In this one, we only cover generation with pure AI, so we don't discuss all of these options.

Learning more about the ML.GENERATE_TEXT() function
The ML.GENERATE_TEXT function is what allows us to generate text from a generative AI model. It's important to note that GENERATE_TEXT is a table function (FROM), not a scalar function. This means it applies to all rows in a table and returns a table as a result. Therefore, we can't use it directly in the SELECT statement; instead, we must use it in the FROM statement, giving it an entire table of data as input (yes, even when we only want to generate a single record, we must create a table with that single record).

The resulting table from GENERATE_TEXT includes the same columns we inserted into the function, plus several new ones. We'd particularly like to highlight these:

ml_generate_text_result: A JSON cell containing the response from the language model, including the generated texts, model version, usage information, etc.
ml_generate_text_status: A JSON cell containing information about the status of the request, such as whether there were any errors or if the request completed successfully.
To extract the relevant information from the JSON ml_generate_text_result, we need to use the JSON_VALUEand functions JSON_QUERY.

What? JSON and then JSON functions?
Yes, yes, I had promised you that this was very simple and then it turns out that you just want data generated with AI and the BigQuery functions return structured and organized data in a very technical way.

This is true, but there's a solution. To do this, we just need to know how to find what we were looking for. What am I going to do? Well, I'll give you a ready-made query that does that work for you. Below, I'll show you a query that extracts the generated text, the reason why the model stopped generating text, the model version, the number of input tokens, and the number of output tokens. Use this query as a basis to build your own, and you'll see how everything is simplified.
Post Reply