docs/integrations/ai-engines/google_gemini.mdx
This documentation describes the integration of MindsDB with Google Gemini, a generative artificial intelligence model developed by Google. The integration allows for the deployment of Google Gemini models within MindsDB, providing the models with access to data from various data sources.
Before proceeding, ensure the following prerequisites are met:
Create an AI engine from the Google Gemini handler.
CREATE ML_ENGINE google_gemini_engine
FROM google_gemini
USING
api_key = 'api-key-value';
Create a model using google_gemini_engine as an engine.
CREATE MODEL google_gemini_model
PREDICT target_column
USING
engine = 'google_gemini_engine', -- engine name as created via CREATE ML_ENGINE
question_column = 'input_column', -- column name that stores user input
model_name = 'gemini-2.0-flash'; -- model name to be used
The following usage examples utilize google_gemini_engine to create a model with the CREATE MODEL statement.
Create a model to generate text completions with the Gemini Pro model for your existing text data.
CREATE MODEL google_gemini_model
PREDICT answer
USING
engine = 'google_gemini_engine',
question_column = 'question',
model_name = 'gemini-2.0-flash';
Query the model to get predictions.
SELECT question, answer
FROM google_gemini_model
WHERE question = 'How are you?';
Alternatively, you can query for batch predictions:
SELECT t.question, m.answer
FROM google_gemini_model AS m
JOIN data_table AS t;
Go to the Use Cases section to see more examples. </Tip>