Files
genai-toolbox/docs/en/resources/tools/bigquery/bigquery-forecast.md
Huan Chen 88bac7e36f feat(tool/bigquery-forecast)!: add allowed datasets support to forecast (#1412)
## Description
---

This introduces a breaking change. The bigquery-forecast tool will now
enforce the allowed datasets setting from its BigQuery source
configuration. Previously, this setting had no effect on the tool.

## PR Checklist

---
> Thank you for opening a Pull Request! Before submitting your PR, there
are a
> few things you can do to make sure it goes smoothly:

- [ ] Make sure you reviewed

[CONTRIBUTING.md](https://github.com/googleapis/genai-toolbox/blob/main/CONTRIBUTING.md)
- [ ] Make sure to open an issue as a

[bug/issue](https://github.com/googleapis/genai-toolbox/issues/new/choose)
before writing your code! That way we can discuss the change, evaluate
  designs, and agree on the general idea
- [ ] Ensure the tests and linter pass
- [ ] Code coverage does not decrease (if any source code was changed)
- [ ] Appropriate docs were updated (if necessary)
- [ ] Make sure to add `!` if this involve a breaking change

🛠️ Fixes #<issue_number_goes_here>

---------

Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
2025-09-24 23:59:00 +00:00

2.9 KiB

title, type, weight, description, aliases
title type weight description aliases
bigquery-forecast docs 1 A "bigquery-forecast" tool forecasts time series data in BigQuery.
/resources/tools/bigquery-forecast

About

A bigquery-forecast tool forecasts time series data in BigQuery. It's compatible with the following sources:

bigquery-forecast constructs and executes a SELECT * FROM AI.FORECAST(...) query based on the provided parameters:

  • history_data (string, required): This specifies the source of the historical time series data. It can be either a fully qualified BigQuery table ID (e.g., my-project.my_dataset.my_table) or a SQL query that returns the data.
  • timestamp_col (string, required): The name of the column in your history_data that contains the timestamps.
  • data_col (string, required): The name of the column in your history_data that contains the numeric values to be forecasted.
  • id_cols (array of strings, optional): If you are forecasting multiple time series at once (e.g., sales for different products), this parameter takes an array of column names that uniquely identify each series. It defaults to an empty array if not provided.
  • horizon (integer, optional): The number of future time steps you want to predict. It defaults to 10 if not specified.

The tool's behavior regarding these parameters is influenced by the allowedDatasets restriction on the bigquery source:

  • Without allowedDatasets restriction: The tool can use any table or query for the history_data parameter.
  • With allowedDatasets restriction: The tool verifies that the history_data parameter only accesses tables within the allowed datasets. If history_data is a table ID, the tool checks if the table's dataset is in the allowed list. If history_data is a query, the tool performs a dry run to analyze the query and rejects it if it accesses any table outside the allowed list.

Example

tools:
 forecast_tool:
    kind: bigquery-forecast
    source: my-bigquery-source
    description: Use this tool to forecast time series data in BigQuery.

Sample Prompt

You can use the following sample prompts to call this tool:

  • Can you forecast the history time series data in bigquery table bqml_tutorial.google_analytic? Use project_id myproject.
  • What are the future total_visits in bigquery table bqml_tutorial.google_analytic?

Reference

field type required description
kind string true Must be "bigquery-forecast".
source string true Name of the source the forecast tool should execute on.
description string true Description of the tool that is passed to the LLM.