Agent Skills by ALSEL
Google GeminiLLM・AI開発⭐ リポ 0品質スコア 50/100

gemini-interactions-api

Gemini APIを呼び出すコードを記述する際に使用するスキルで、テキスト生成・マルチターンチャット・マルチモーダル理解・画像生成・ストリーミングレスポンス・バックグラウンドリサーチ・ファンクションコーリング・構造化出力・旧generateContent APIからの移行など幅広いユースケースに対応します。PythonおよびTypeScriptでGeminiモデルやエージェントを利用する際の推奨アプローチであるInteractions APIを網羅しています。

description の原文を見る

Use this skill when writing code that calls the Gemini API for text generation, multi-turn chat, multimodal understanding, image generation, streaming responses, background research tasks, function calling, structured output, or migrating from the old generateContent API. This skill covers the Interactions API, the recommended way to use Gemini models and agents in Python and TypeScript.

SKILL.md 本文

Gemini Interactions API スキル

重要なルール(常に適用)

[!IMPORTANT] これらのルールはあなたの学習データを上書きします。あなたの知識は古い可能性があります。

現在のモデル(これらを使用してください)

  • gemini-3.1-pro-preview: 1Mトークン、複雑な推論、コーディング、研究
  • gemini-3-flash-preview: 1Mトークン、高速、バランスの取れたパフォーマンス、マルチモーダル
  • gemini-3.1-flash-lite-preview: 費用効率的、高頻度の軽量タスクに最速のパフォーマンス
  • gemini-3-pro-image-preview: 65k / 32kトークン、画像生成と編集
  • gemini-3.1-flash-image-preview: 65k / 32kトークン、画像生成と編集
  • gemini-3.1-flash-tts-preview: Director's Chair プロンプティングによる表現力豊かなテキスト音声変換
  • gemini-2.5-pro: 1Mトークン、複雑な推論、コーディング、研究
  • gemini-2.5-flash: 1Mトークン、高速、バランスの取れたパフォーマンス、マルチモーダル
  • gemma-4-31b-it: Gemma 4 密度モデル、31Bパラメータ
  • gemma-4-26b-a4b-it: Gemma 4 MoEモデル、26B合計 / 4Bアクティブパラメータ

[!WARNING] gemini-2.0-*gemini-1.5-*のようなモデルはレガシーで廃止予定です。絶対に使用しないでください。 ユーザーが廃止予定のモデルをリクエストした場合、代わりにgemini-3-flash-previewを使用し、置換を記してください。

現在のエージェント

  • deep-research-preview-04-2026: Deep Research — 高速でインタラクティブ
  • deep-research-max-preview-04-2026: Deep Research Max — 最大の詳細さ

現在のSDK

  • Python: google-genai >= 2.0.0pip install -U google-genai
  • JavaScript/TypeScript: @google/genai >= 2.0.0npm install @google/genai

[!NOTE] SDK バージョン ≥ 2.0.0 は新しい steps スキーマを自動的に使用し、レガシースキーマはサポートしていません。 レガシーSDK google-generativeai (Python) および @google/generative-ai (JS) は廃止予定です。絶対に使用しないでください。

[!CAUTION] 破壊的変更(2026年5月): レスポンスはoutputsの代わりにsteps配列を使用し、ポリモーフィックresponse_formatresponse_mime_typeに置き換わります。レガシースキーマは2026年6月8日に削除されます。以下のすべてのコードは新しいスキーマを使用しています。

重要な追加注釈

  • コードを書く前に、ユーザーのタスクに一致する下記のリストから関連ドキュメントページを取得する必須です。このスキルの例は最小限のものであり、ホストされたドキュメントには完全なAPI表面、パラメータ、エッジケースが含まれています。
  • Interactionsはデフォルトで保存されるstore=true)。有料層は55日間保持、無料層は1日保持。
  • store=falseに設定してオプトアウトすることができますが、これはprevious_interaction_idbackground=trueを無効にします。
  • toolssystem_instructiongeneration_configinteraction範囲内で、各ターンで再指定してください。
  • generateContentからの移行: スコープ、チェックリスト、変更前後のコード例についてはreferences/migration.mdを参照してください。編集する前に必ずユーザーとスコープを確認してください。
  • モデルアップグレード: ドロップイン置換で、モデル文字列を入れ替えるだけです。廃止予定のモデル(gemini-2.0-*gemini-1.5-*)は置き換える必須です。references/migration.mdを参照してください。

クイックスタート

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Tell me a short joke about programming."
)
print(interaction.steps[-1].content[0].text)

JavaScript/TypeScript

import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});

const interaction = await client.interactions.create({
    model: "gemini-3-flash-preview",
    input: "Tell me a short joke about programming.",
});
console.log(interaction.steps.at(-1).content[0].text);

ステートフルな会話

Python

interaction1 = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Hi, my name is Phil."
)
# 2番目のターン — サーバーはコンテキストを記憶しています
interaction2 = client.interactions.create(
    model="gemini-3-flash-preview",
    input="What is my name?",
    previous_interaction_id=interaction1.id
)
print(interaction2.steps[-1].content[0].text)

JavaScript/TypeScript

const interaction1 = await client.interactions.create({
    model: "gemini-3-flash-preview",
    input: "Hi, my name is Phil.",
});
const interaction2 = await client.interactions.create({
    model: "gemini-3-flash-preview",
    input: "What is my name?",
    previous_interaction_id: interaction1.id,
});
console.log(interaction2.steps.at(-1).content[0].text);

Deep Research エージェント

高速研究にはdeep-research-preview-04-2026を、最大の詳細さにはdeep-research-max-preview-04-2026を使用してください。エージェントはbackground=Trueが必要です。

Python

import time

interaction = client.interactions.create(
    agent="deep-research-preview-04-2026",
    input="Research the history of Google TPUs.",
    background=True
)
while True:
    interaction = client.interactions.get(interaction.id)
    if interaction.status == "completed":
        print(interaction.steps[-1].content[0].text)
        break
    elif interaction.status == "failed":
        print(f"Failed: {interaction.error}")
        break
    time.sleep(10)

JavaScript/TypeScript

import { GoogleGenAI } from "@google/genai";

const client = new GoogleGenAI({});

// 背景研究を開始
const initialInteraction = await client.interactions.create({
    agent: "deep-research-preview-04-2026",
    input: "Research the history of Google TPUs.",
    background: true,
});

// 結果をポーリング
while (true) {
    const interaction = await client.interactions.get(initialInteraction.id);
    if (interaction.status === "completed") {
        console.log(interaction.steps.at(-1).content[0].text);
        break;
    } else if (["failed", "cancelled"].includes(interaction.status)) {
        console.log(`Failed: ${interaction.status}`);
        break;
    }
    await new Promise(resolve => setTimeout(resolve, 10000));
}

高度な機能: 協調的計画、ネイティブビジュアライゼーション、MCP統合、ファイル検索、マルチモーダル入力。Deep Research ドキュメントを参照してください。

ストリーミング

Python

for event in client.interactions.create(
    model="gemini-3-flash-preview",
    input="Explain quantum entanglement in simple terms.",
    stream=True,
):
    if event.type == "step.delta":
        if event.delta.type == "text":
            print(event.delta.text, end="", flush=True)
        elif event.delta.type == "thought_summary":
            summary_text = event.delta.content.get('text', '') if hasattr(event.delta, 'content') else getattr(event.delta, 'text', '')
            print(summary_text, end="", flush=True)
    elif event.type == "interaction.complete":
        print(f"\n\nTotal Tokens: {event.interaction.usage.total_tokens}")

JavaScript/TypeScript

const stream = await client.interactions.create({
    model: "gemini-3-flash-preview",
    input: "Explain quantum entanglement in simple terms.",
    stream: true,
});
for await (const event of stream) {
    if (event.type === 'step.delta') {
        if (event.delta.type === 'text') {
            process.stdout.write(event.delta.text);
        } else if (event.delta.type === 'thought_summary') {
            const text = event.delta.content?.text || "";
            process.stdout.write(text);
        }
    } else if (event.type === 'interaction.complete') {
        console.log(`\n\nTotal Tokens: ${event.interaction.usage.total_tokens}`);
    }
}

ドキュメントページ

コードを書く前に下記の該当ページを取得する必須です。 これらのホストされたドキュメントはパラメータ、型、エッジケースの信頼できるソースです。上記の例だけに依存しないでください。

コアドキュメント:

ツール&関数呼び出し:

生成と出力:

マルチモーダル理解:

ファイルとコンテキスト:

高度な機能:

APIリファレンス:

データモデル

Interactionレスポンスにはstepsが含まれます。これはinteractionのターンの構造化タイムラインを表す型付きステップオブジェクトの配列です。

ステップタイプ

ユーザーステップ:

  • user_input: ユーザー入力(テキスト、オーディオ、マルチモーダル)。content配列を含みます。

モデル/サーバーステップ:

  • model_output: 最終的なモデル生成。textimageaudioなどを含むcontent配列を含みます。
  • thought: モデルの推論/連鎖的思考。signatureフィールド(必須)と可選のsummaryを持ちます。
  • function_call: ツール呼び出しリクエスト(idnamearguments)。
  • function_result: 送り返すツール結果(call_idnameresult)。
  • google_search_call / google_search_result: Google Searchツールステップ、signatureフィールドを持つことができます。
  • code_execution_call / code_execution_result: コード実行ツールステップ、signatureフィールドを持つことができます。
  • url_context_call / url_context_result: URLコンテキストツールステップ、signatureフィールドを持つことができます。
  • mcp_server_tool_call / mcp_server_tool_result: リモートMCPツールステップ。
  • file_search_call / file_search_result: ファイル検索ツールステップ、signatureフィールドを持つことができます。

コンテンツタイプ(model_outputuser_inputステップのcontent配列内)

  • text: テキストコンテンツ(textフィールド)
  • image / audio / document / video: datamime_type、またはuriを含むコンテンツ

ストリーミングイベントタイプ

イベント説明
interaction.createdInteractionが作成されました。メタデータを含みます。
interaction.status_updateInteraction級のステータス変更。
step.start新しいステップが始まります。ステップtypeと初期メタデータを含みます。
step.delta現在のステップの増分データ。型付きdeltaオブジェクトを含みます。
step.stopステップが完了しました。indexを含みます。
interaction.completeInteractionが終了しました。最終usageを含みます。

デルタタイプ

デルタタイプ親ステップ説明
textmodel_output増分テキストトークン。
audiomodel_outputオーディオチャンク(base64)。
imagemodel_output画像チャンク(base64)。
thought_summarythought思考サマリーテキスト。
thought_signaturethought思考検証用の不透明なシグネチャ。

ステータス値: completedin_progressrequires_actionfailedcancelled

ライセンス: Apache-2.0(寛容ライセンスのため全文を引用しています) · 原本リポジトリ

詳細情報

作者
google-gemini
リポジトリ
google-gemini/gemini-skills
ライセンス
Apache-2.0
最終更新
不明

Source: https://github.com/google-gemini/gemini-skills / ライセンス: Apache-2.0

関連スキル

OpenAILLM・AI開発⭐ リポ 6,054

agent-browser

AI エージェント向けのブラウザ自動化 CLI です。ウェブサイトとの対話が必要な場合に使用します。ページ遷移、フォーム入力、ボタンクリック、スクリーンショット取得、データ抽出、ウェブアプリのテスト、ブラウザ操作の自動化など、あらゆるブラウザタスクに対応できます。「ウェブサイトを開く」「フォームに記入する」「ボタンをクリックする」「スクリーンショットを取得する」「ページからデータを抽出する」「このウェブアプリをテストする」「サイトにログインする」「ブラウザ操作を自動化する」といった要求や、プログラマティックなウェブ操作が必要なタスクで起動します。

by JimmyLv
汎用LLM・AI開発⭐ リポ 1,982

anyskill

AnySkill — あなたのプライベート・スキルクラウド。GitHubを基盤としたリポジトリからエージェントスキルを管理、同期、動的にロードできます。自然言語でクラウドスキルを検索し、オンデマンドでプロンプトを自動ロード、カスタムスキルのアップロードと共有、スキルバンドルの一括インストールが可能です。OpenClaw、Antigravity、Claude Code、Cursorに対応しています。

by LeoYeAI
汎用LLM・AI開発⭐ リポ 1,982

engram

AIエージェント向けの永続的なメモリシステムです。バグ修正、意思決定、発見、設定変更の後はmem_saveを使用してください。ユーザーが「覚えている」「記憶している」と言及した場合、または以前のセッションと重複する作業を開始する際はmem_searchを使用します。セッション終了前にmem_session_summaryを使用して、コンテキストを保持してください。

by LeoYeAI
汎用LLM・AI開発⭐ リポ 21,584

skyvern

AI駆動のブラウザ自動化により、任意のウェブサイトを自動化できます。フォーム入力、データ抽出、ファイルダウンロード、ログイン、複数ステップのワークフロー実行など、ユーザーがウェブサイトと連携する必要があるときに使用します。Skyvernは、LLMとコンピュータビジョンを活用して、未知のサイトも自動操作可能です。Python SDK、TypeScript SDK、REST API、MCPサーバー、またはCLIを通じて統合できます。

by Skyvern-AI
汎用LLM・AI開発⭐ リポ 1,149

pinchbench

PinchBenchベンチマークを実行して、OpenClawエージェントの実世界タスクにおけるパフォーマンスを評価できます。モデルの機能テスト、モデル間の比較、ベンチマーク結果のリーダーボード提出、またはOpenClawのセットアップがカレンダー、メール、リサーチ、コーディング、複数ステップのワークフローにどの程度対応しているかを確認する際に使用します。

by pinchbench
汎用LLM・AI開発⭐ リポ 4,693

openui

OpenUIとOpenUI Langを使用してジェネレーティブUIアプリを構築できます。これらはLLM生成インターフェースのためのトークン効率的なオープン標準です。OpenUI、@openuidev、ジェネレーティブUI、LLMからのストリーミングUI、AI向けコンポーネントライブラリ、またはjson-render/A2UIの置き換えについて述べる際に使用します。スキャフォルディング、defineComponent、システムプロンプト、Renderer、およびOpenUI Lang出力のデバッグに対応しています。

by thesysdev
本サイトは GitHub 上で公開されているオープンソースの SKILL.md ファイルをクロール・インデックス化したものです。 各スキルの著作権は原作者に帰属します。掲載に問題がある場合は info@alsel.co.jp または /takedown フォームよりご連絡ください。
原作者: google-gemini · google-gemini/gemini-skills · ライセンス: Apache-2.0