Skip to main content

module  pixeltable.functions.vlmrun

Pixeltable UDFs that wrap the VLM Run Orion agent API. In order to use them, you must first pip install vlmrun and configure your VLM Run API key, by setting the VLMRUN_API_KEY environment variable or vlmrun.api_key in the Pixeltable config file.

udf  annotate_image()

Signature
Draws bounding boxes, keypoints or segmentation masks on an image, using VLM Run’s viz toolset. For additional details, see: https://docs.vlm.run/ Requirements:
  • pip install vlmrun
Parameters:
  • prompt (pxt.String): Text prompt describing what to annotate, such as 'Draw bounding boxes around all people'.
  • image (pxt.Image): The image to annotate.
  • model (pxt.String): The model to use, such as 'vlmrun-orion-2:auto'.
  • model_kwargs (pxt.Json | None): Additional parameters for the VLM Run chat completions API. This function sets response_format and toolsets itself, so they cannot be passed.
Returns:
  • pxt.Image: The annotated image.
Examples: Annotate objects in an image column img:

udf  chat_completions()

Signature
Creates a model response for the given chat conversation. Equivalent to the VLM Run chat completions API endpoint. For additional details, see: https://docs.vlm.run/agents/agent-chat-completions Message content items can reference Pixeltable media columns directly: image columns via {'type': 'image_url', 'image_url': tbl.img}, video columns via {'type': 'video_url', 'video_url': tbl.video}, and document columns via {'type': 'file_url', 'file_url': tbl.doc}. Referenced media is uploaded to VLM Run for each call, and deleted from VLM Run when the call ends. A string in video_url or file_url that is not a URL is read as a local file path and uploaded, so don’t put untrusted strings there. Request throttling: Applies the rate limit set in the config (section vlmrun, key rate_limit). If no rate limit is configured, uses a default of 600 RPM. Requirements:
  • pip install vlmrun
Parameters:
  • messages (pxt.Json[(Json): A list of messages for the chat conversation. Media content items can reference Pixeltable columns directly (see above).
  • model (Any): The model to use, such as 'vlmrun-orion-2:fast', 'vlmrun-orion-2:auto' or 'vlmrun-orion-2:pro'. For the full list, see https://docs.vlm.run/.
  • model_kwargs (Any): Additional parameters for the VLM Run chat completions API, such as response_format for structured JSON output or toolsets to select the agent’s tools.
Returns:
  • pxt.Json: A dictionary containing the API response.
Examples: Describe an image column img of the table tbl:
Ask for the invoice number and total of a document column doc as a JSON string:

udf  generate_document()

Signature
Transforms a document, for example by redacting it, using VLM Run’s document toolset. For additional details, see: https://docs.vlm.run/ Requirements:
  • pip install vlmrun
Parameters:
  • prompt (pxt.String): Text prompt describing the transformation, such as 'Redact all personally identifiable information'.
  • document (pxt.Document): The document to transform: a PDF, DOC or DOCX file.
  • model (pxt.String): The model to use, such as 'vlmrun-orion-2:auto'.
  • model_kwargs (pxt.Json | None): Additional parameters for the VLM Run chat completions API. This function sets response_format and toolsets itself, so they cannot be passed.
Returns:
  • pxt.Document: The transformed document, as a PDF.
Examples: Redact PII from a document column doc:

udf  generate_image()

Signature
Generates an image from a text prompt, or edits an image, using VLM Run’s image-gen toolset. For additional details, see: https://docs.vlm.run/ Requirements:
  • pip install vlmrun
Parameters:
  • prompt (pxt.String): Text prompt describing the image to generate or the edit to apply.
  • image (pxt.Image | None): The image to edit. If it is omitted, or null in a row, the image is generated from the prompt alone.
  • model (pxt.String): The model to use, such as 'vlmrun-orion-2:auto'.
  • model_kwargs (pxt.Json | None): Additional parameters for the VLM Run chat completions API. This function sets response_format and toolsets itself, so they cannot be passed.
Returns:
  • pxt.Image: The generated or edited image.
Examples: Generate an image from text:
Edit an existing image column img:

udf  generate_video()

Signature
Generates a video from a text prompt, using VLM Run’s video toolset. For additional details, see: https://docs.vlm.run/ Requirements:
  • pip install vlmrun
Parameters:
  • prompt (pxt.String): Text prompt describing the video to generate.
  • image (pxt.Image | None): An image to start the video from.
  • video (pxt.Video | None): A video to start from. If both image and video are omitted, or null in a row, the video is generated from the prompt alone.
  • model (pxt.String): The model to use, such as 'vlmrun-orion-2:auto'.
  • model_kwargs (pxt.Json | None): Additional parameters for the VLM Run chat completions API. This function sets response_format and toolsets itself, so they cannot be passed.
Returns:
  • pxt.Video: The generated video.
Examples: Generate videos from text prompts:
Last modified on November 7, 2026