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.

referencestext_generation.md

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

Text Generation & Configuration

Basic Generation

response = client.models.generate_content(
    model='gemini-3-flash-preview',
    contents='Why is the sky blue?',
)
print(response.text)

Streaming

Reduces time-to-first-token.

response = client.models.generate_content_stream(
    model='gemini-3-flash-preview',
    contents='Write a long story about a space pirate.'
)
for chunk in response:
    print(chunk.text, end='')

Configuration (GenerateContentConfig)

Control generation parameters, system instructions, and safety.

System Instructions

config = types.GenerateContentConfig(
    system_instruction='You are a pirate. Speak like one.',
)

Hyperparameters

Note: For Gemini 3 models, keep temperature at 1.0 (default) for optimal reasoning.

config = types.GenerateContentConfig(
    temperature=1.0,
    max_output_tokens=500,
    top_p=0.95,
)

Safety Settings

Avoid setting these unless explicitly requested.

config = types.GenerateContentConfig(
    safety_settings=[
        types.SafetySetting(
            category=types.HarmCategory.HARM_CATEGORY_HATE_SPEECH,
            threshold=types.HarmBlockThreshold.BLOCK_LOW_AND_ABOVE,
        ),
    ]
)

Content & Part Hierarchy

For complex requests (e.g., specific roles), use Content and Part objects explicitly.

contents=[
    types.Content(
        role='user',
        parts=[types.Part.from_text(text='Hello')]
    )
]

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