All skills
davila7 avatar

/gemini-api-agent-platform

@82b0fb3

Guides the usage of the Gemini API on Agent Platform with the Google Gen AI SDK for enterprise AI applications. Covers SDK usage (Python, JS/TS, Go, Java, C#), capabilities like Live API, tools, multimedia generation, caching, and batch prediction.

Use this Skill: https://skilld.dev/gh/davila7/claude-code-templates/gemini-api-agent-platform

This session only. Nothing lands on disk.

referencesbounding_box.md

≈467 tokens on demand. Your agent reads this file only when SKILL.md points to it.

Bounding Box Detection

Detect and localize objects within images or videos using bounding boxes. The model returns coordinates in the format [y_min, x_min, y_max, x_max], normalized from 0 to 1000.

Implementation (Python)

To ensure structured output, define a BoundingBox class and provide it as the response_schema.

from google import genai
from google.genai.types import (
    GenerateContentConfig,
    Part,
)
from pydantic import BaseModel

# Define the schema for the bounding box
class BoundingBox(BaseModel):
    box_2d: list[int]
    label: str

client = genai.Client()

config = GenerateContentConfig(
    system_instruction="""
    Return bounding boxes as an array with labels.
    Never return masks. Limit to 25 objects.
    """,
    response_mime_type="application/json",
    response_schema=list[BoundingBox],
)

image_uri = "gs://cloud-samples-data/generative-ai/image/socks.jpg"

response = client.models.generate_content(
    model="gemini-3-flash-preview",
    contents=[
        Part.from_uri(file_uri=image_uri, mime_type="image/jpeg"),
        "Detect the socks in the image and provide bounding boxes.",
    ],
    config=config,
)

# Access the detected boxes
for bbox in response.parsed:
    print(f"Label: {bbox.label}, Box: {bbox.box_2d}")

Coordinate System

  • Format: [y_min, x_min, y_max, x_max]
  • Normalization: Coordinates are integers from 0 to 1000.
  • Origin: [0, 0] is the top-left corner of the image.

Visualization Helper

To visualize the results, scale the normalized coordinates back to the original image dimensions.

def scale_box(box_2d, width, height):
    y_min, x_min, y_max, x_max = box_2d
    return [
        int(y_min / 1000 * height),
        int(x_min / 1000 * width),
        int(y_max / 1000 * height),
        int(x_max / 1000 * width)
    ]

Source: SKILL.md on GitHub

1 alert2mo3 checks · Risk SAFE
  • Gen Agent Trust Hub2mo

    This skill provides comprehensive documentation and code examples for using the Google Gen AI SDK across multiple programming languages. The code samples demonstrate legitimate API usage for text, multimodal, and advanced AI features using Google's official libraries and established best practices.

  • Socket2mo

    No alerts

  • Snyk2mo

    Risk: CRITICAL · 3 issues

Signed by skilld at 82b0fb3. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 19 hours ago.

Activeupdated 5 months ago
compatibility
Requires active Google Cloud credentials and Agent Platform API enabled.
source
google/skills (Apache 2.0)

README badge

README badge for davila7/claude-code-templates/gemini-api-agent-platform