Properties2
TypePractice
Note createdMar 20, 2025

The code below is a simple instance on how to create a remote LLM instance (in this case, Google Gemini) in BigQuery.

CREATE OR REPLACE MODEL
  `cartodb-on-gcp-datascience.dvicente.gemini-2-model`
REMOTE WITH CONNECTION
  `cartodb-on-gcp-datascience.us.genai-connection`
OPTIONS(
  ENDPOINT = 'gemini-2.0-flash-001'
);
 
SELECT *
FROM
  ML.GENERATE_TEXT(
    MODEL `cartodb-on-gcp-datascience.dvicente.gemini-2-model`,
    (
      -- Prompt query, could also be a TABLE input
      SELECT 'What is this model?' AS prompt
    ),
    -- Additional options
    STRUCT(
      .05 AS TEMPERATURE,
      TRUE AS flatten_json_output
    )
  );