AI Generated Summary

Learn how to add AI-Generated Summaries useing Codatum's Text Panel feature and Vertex AI.

The text summary accompanying the dashboard helps users understand the data. However, summaries written by humans cannot reflect user actions such as parameter specifications.

This article introduces how to use Vertex AI via BigQuery to generate summaries based on data specified by users using parameters. This can also be achieved by using AI functions that support connections other than BigQuery.

Codatum has a Text Panel for displaying text in Markdown notation, so here we will use the Text Panel to display the chart.

How to Set up

  • Setting up Vertex AI

  • Model creation

  • Transferring aggregated data to AI models

  • Select the Text Panel chart and display the data

Following the above steps, you can add summaries that change each time the user modifies the parameters and executes the query.

Implementation Example

  • Use the Chicago Taxi Trip public data from BigQuery

  • Generate a summary each time the data target is changed via parameters, and create a summary corresponding to the displayed data

Model Creation

  • This task can also be performed using the BigQuery query editor

CREATE OR REPLACE MODEL `codatum-example.example.vertex_ai`
REMOTE WITH CONNECTION `us.vertex_ai_test`
OPTIONS(
  ENDPOINT = 'gemini-2.0-flash'
)

After completing the above query, the vertex_ai model will be added to the example dataset in BigQuery.

Data Aggregation

  • Aggregate the number of rides, ride time, ride distance, and ride fare by company and payment method on a monthly basis

    • Set company name and payment method to be changeable in parameters

Transferring data to AI models

Codatum allows you to reference the results of other SQL blocks, so you can manage SQL blocks that aggregate data and SQL blocks that transfer data separately.

  • Convert aggregated data to JSON format

  • Combine JSON data for each row into a single JSON object

  • Pass the combined JSON data to the AI model

    • Combine the prompt and JSON data and pass them to the created model

  • The stability of the summary varies depending on the content of the prompt given to the model, so please try different approaches.

Adding a Text Panel chart

  • Select Text Panel from the chart type selection and add it

    • The text panel displays the value in the first row, so if there are multiple text data, only one will be displayed

Notes

  • If Markdown is enclosed, it cannot be expanded properly in the text panel, so please ensure that the AI output does not enclose Markdown

Last updated

Was this helpful?