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.Json): The input content to generate from. Can be a prompt, or a list containing images and text prompts, as described in: https://ai.google.dev/gemini-api/docs/text-generationmodel(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#genai.types.GenerateContentConfigtools(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.5-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#genai.types.GenerateImagesConfig
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
prompt or image must be provided.
Request throttling:
Applies the rate limit set in the config (section 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 image to use as the first frame of the video.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#genai.types.GenerateVideosConfig
pxt.Video: The generated video.
veo-3.0-generate-001 to an existing Pixeltable column tbl.prompt of the table tbl: