module pixeltable.functions.gemini
Pixeltable UDFs that wrap various endpoints from the Google Gemini API. In order to use them, you must firstpip install google-genai and configure your Gemini credentials, as described in
the Working with Gemini tutorial.
func invoke_tools()
Signature
tools._invoke().
udf generate_content()
Signature
gemini.rate_limits; use the model id as the key). If no rate
limit is configured, uses a default of 600 RPM.
Requirements:
pip install google-genai
contents(pxt.String): The input content to generate from.model(pxt.String): The name of the model to use.config(pxt.Json | None): Configuration for generation, corresponding to keyword arguments ofgenai.types.GenerateContentConfig. For details on the parameters, see: https://googleapis.github.io/python-genai/genai.html#module-genai.typestools(pxt.Json | None): An optional list of Pixeltable tools to use. It is also possible to specify tools manually via theconfig['tools']parameter, but at most one ofconfig['tools']ortoolsmay be used.
pxt.Json: A dictionary containing the response and other metadata.
gemini-2.0-flash to an existing Pixeltable column tbl.prompt of the table tbl:
udf generate_images()
Signature
imagen.rate_limits; use the model id as the key). If no rate
limit is configured, uses a default of 600 RPM.
Requirements:
pip install google-genai
prompt(pxt.String): A text description of the images to generate.model(pxt.String): The model to use.config(pxt.Json | None): Configuration for generation, corresponding to keyword arguments ofgenai.types.GenerateImagesConfig. For details on the parameters, see: https://googleapis.github.io/python-genai/genai.html#module-genai.types
pxt.Image: The generated image.
imagen-4.0-generate-001 to an existing Pixeltable column tbl.prompt of the table tbl:
udf generate_videos()
Signature
veo.rate_limits; use the model id as the key). If no rate
limit is configured, uses a default of 600 RPM.
Requirements:
pip install google-genai
prompt(pxt.String | None): A text description of the videos to generate.image(pxt.Image | None): An optional image to use as the first frame of the video. At least one ofpromptorimagemust be provided. (It is ok to specify both.)model(pxt.String): The model to use.config(pxt.Json | None): Configuration for generation, corresponding to keyword arguments ofgenai.types.GenerateVideosConfig. For details on the parameters, see: https://googleapis.github.io/python-genai/genai.html#module-genai.types
pxt.Video: The generated video.
veo-2.0-generate-001 to an existing Pixeltable column tbl.prompt of the table tbl: