All skills
cnemri avatar

/google-genai-sdk-python

@8caf714

Expert guidance for writing Python code using the official Google GenAI SDK (google-genai) for Gemini API and Vertex AI. Use for text generation, multimodal inputs, reasoning, tools, and media generation.

Use this Skill: https://skilld.dev/gh/cnemri/google-genai-skills/google-genai-sdk-python

This session only. Nothing lands on disk.

referencesstructured_output.md

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

Structured Output

Enforce specific response structures using response_schema.

Pydantic Models (Recommended)

from pydantic import BaseModel

class Recipe(BaseModel):
    name: str
    ingredients: list[str]

response = client.models.generate_content(
    model='gemini-3-flash-preview',
    contents='Cookie recipe',
    config=types.GenerateContentConfig(
        response_mime_type='application/json',
        response_schema=Recipe,
    ),
)
# Access parsed object directly
print(response.parsed)

JSON Schema (Dict)

schema = {
    "type": "OBJECT",
    "properties": {
        "name": {"type": "STRING"},
        "age": {"type": "INTEGER"}
    }
}
response = client.models.generate_content(
    ...,
    config=types.GenerateContentConfig(
        response_mime_type='application/json',
        response_schema=schema
    )
)

Enums

You can also restrict output to a specific enum.

import enum
class Grade(enum.Enum):
    A = "A"
    B = "B"

config=types.GenerateContentConfig(
    response_mime_type='text/x.enum',
    response_schema=Grade
)

Source: SKILL.md on GitHub

1 warning16d4 checks · Risk SAFE
  • Gen Agent Trust Hub16d

    The Google GenAI Python SDK Skill is a documentation and code-reference skill designed to assist in developing Python applications using the Gemini API. It contains comprehensive setup guides, code examples for text/multimodal generation, chat interfaces, and tool usage. All external references are to official Google-owned GitHub repositories, which are recognized as trusted sources. No malicious patterns, unauthorized command execution, or data exfiltration behaviors were detected.

  • Socket16d

    No alerts

  • Snyk16d

    Risk: LOW · No issues

  • Runlayer7mo

    11/11 files flagged

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

Last checked against GitHub 2 months ago.

Dormantupdated 8 months ago

README badge

README badge for cnemri/google-genai-skills/google-genai-sdk-python