For some reason suddenly stops with:
Raw response:
{"candidates":[{"content":{},"finish_message":"Malformed function call: query = \"\"\"\nSELECT column_name\nFROM `wr_dataset.INFORMATION_SCHEMA.COLUMNS`\nWHERE table_name = 'order_items'\n\"\"\"\nresults = run_bigquery_query(query)\nprint(results)\n","finish_reason":"MALFORMED_FUNCTION_CALL"}],"create_time":"2025-04-09T21:36:06.627984Z","response_id":"Ruj2Z5CqJuGCqsMPxdPYoAY","model_version":"gemini-2.0-flash-exp","usage_metadata":{"prompt_token_count":4250,"prompt_tokens_details":[{"modality":"TEXT","token_count":4250}],"total_token_count":4250,"traffic_type":"ON_DEMAND"},"automatic_function_calling_history":[]}
the query is okay, but for some reason doesn't call the tool
even the log doesn't list the tool it failed
tools=[get_bigquery_table_ddl, run_bigquery_query, get_bigquery_view_ddl],
def get_bigquery_table_ddl(dataset_id: str, table_id: str) -> dict:
"""Retrieves the create table statement of a specified BigQuery table.
Args:
dataset_id: The ID of the BigQuery dataset.
table_id: The ID of the BigQuery table.
tool_context: ToolContext,
Returns:
A dictionary containing the DDL statement for the table, or an error message if the table is not found. The dictionary will have a "ddl" key if successful or an "error" key if not.
"""
try:
from google.cloud import bigquery
client = bigquery.Client()
ddl_query = f"""
SELECT ddl
FROM `{client.project}.{dataset_id}.INFORMATION_SCHEMA.TABLES`
WHERE table_name = '{table_id}'
"""
print(ddl_query)
ddl_result = client.query(ddl_query).result()
ddl_rows = list(ddl_result)
if ddl_rows:
ddl = ddl_rows[0].ddl
return {"ddl": ddl}
else:
return {"error": f"Table '{table_id}' not found in dataset '{dataset_id}'."}
except Exception as e:
return {"error": f"Error fetching table DDL: {str(e)}"}
For some reason suddenly stops with:
Raw response:
{"candidates":[{"content":{},"finish_message":"Malformed function call: query = \"\"\"\nSELECT column_name\nFROM `wr_dataset.INFORMATION_SCHEMA.COLUMNS`\nWHERE table_name = 'order_items'\n\"\"\"\nresults = run_bigquery_query(query)\nprint(results)\n","finish_reason":"MALFORMED_FUNCTION_CALL"}],"create_time":"2025-04-09T21:36:06.627984Z","response_id":"Ruj2Z5CqJuGCqsMPxdPYoAY","model_version":"gemini-2.0-flash-exp","usage_metadata":{"prompt_token_count":4250,"prompt_tokens_details":[{"modality":"TEXT","token_count":4250}],"total_token_count":4250,"traffic_type":"ON_DEMAND"},"automatic_function_calling_history":[]}the query is okay, but for some reason doesn't call the tool
even the log doesn't list the tool it failed
tools=[get_bigquery_table_ddl, run_bigquery_query, get_bigquery_view_ddl],