Interactions API: माइग्रेशन गाइड में बड़े बदलाव (मई 2026)

v1beta इंटरैक्शन एपीआई में, ऐसे बड़े बदलाव किए जा रहे हैं जिनसे एपीआई का स्ट्रक्चर बदल जाएगा. इससे, आने वाली सुविधाएं काम कर पाएंगी. जैसे, फ़्लाइट के दौरान स्टीयरिंग और टूल कॉल एसिंक्रोनस तरीके से करना. इस पेज पर, किए जा रहे बदलावों के बारे में बताया गया है. साथ ही, माइग्रेट करने में आपकी मदद करने के लिए, कोड के पहले और बाद के उदाहरण दिए गए हैं. बदलावों को दो कैटगरी में बांटा गया है:

  1. स्टेप स्कीमा: outputs कलेक्शन की जगह, नया steps कलेक्शन इस्तेमाल किया जाएगा. इससे, हर इंटरैक्शन टर्न की स्ट्रक्चर्ड टाइमलाइन मिलेगी.
  2. आउटपुट फ़ॉर्मैट कॉन्फ़िगरेशन: नया पॉलीमॉर्फिक response_format आउटपुट फ़ॉर्मैट के सभी कंट्रोल को एक साथ लाता है. साथ ही, response_mime_type को हटाता है.

अपने इंटिग्रेशन को अपडेट करने के लिए, नए स्कीमा पर माइग्रेट करने का तरीका में दिए गए निर्देशों का पालन करें.

मुख्य बदलाव: outputs की जगह steps का इस्तेमाल

नए स्कीमा में, outputs कलेक्शन की जगह steps कलेक्शन का इस्तेमाल किया जाएगा.

  • लेगसी: जवाबों में, फ़्लैट outputs कलेक्शन मिलता था. इसमें सिर्फ़ मॉडल से जनरेट किया गया कॉन्टेंट होता था.
  • नया स्कीमा: जवाबों में, steps कलेक्शन मिलता है. इसमें, उपयोगकर्ता के इनपुट और मॉडल के आउटपुट, दोनों शामिल होते हैं. इससे, इंटरैक्शन टर्न की पूरी टाइमलाइन मिलती है.

यूनरी (नॉन-स्ट्रीमिंग) जवाबों में, आपके इनपुट को steps कलेक्शन में पहले स्टेप के तौर पर दोहराया जाता है. स्ट्रीमिंग जवाबों में, इनपुट स्टेप को छोड़ दिया जाता है. साथ ही, सिर्फ़ जनरेट किए गए कॉन्टेंट के डेल्टा दिखाए जाते हैं.

सामान्य इनपुट/आउटपुट (यूनरी)

पहले (लेगसी)

Python

# Request
interaction = client.interactions.create(
    model="gemini-3-flash-preview", input="Tell me a joke."
)

# Response access
print(interaction.outputs[0].text)

JavaScript

// Request
const interaction = await client.interactions.create({
    model: 'gemini-3-flash-preview',
    input: 'Tell me a joke.'
});

// Response access
console.log(interaction.outputs[0].text);

REST

// Request: POST /v1beta/interactions
{
  "model": "gemini-3-flash-preview",
  "input": "Tell me a joke."
}

// Response
{
  "id": "int_123",
  "role": "model",
  "outputs": [
    {
      "type": "text",
      "text": "Why did the chicken cross the road?"
    }
  ]
}

बाद में (नया स्कीमा)

Python

# Request
interaction = client.interactions.create(
    model="gemini-3-flash-preview", input="Tell me a joke."
)

# Response access
print(interaction.steps[-1].content[0].text)  # CHANGED: steps instead of outputs

JavaScript

// Request
const interaction = await client.interactions.create({
    model: 'gemini-3-flash-preview',
    input: 'Tell me a joke.'
});

// Response access
console.log(interaction.steps.at(-1).content[0].text);

REST

// Request: POST /v1beta/interactions
{
  "model": "gemini-3-flash-preview",
  "input": "Tell me a joke."
}

// Response
{
  "id": "int_123",
  "steps": [
    {
      "type": "user_input",
      "status": "done",
      "content": [
        {
          "type": "text",
          "text": "Tell me a joke."
        }
      ]
    },
    {
      "type": "model_output",
      "status": "done",
      "content": [
        {
          "type": "text",
          "text": "Why did the chicken cross the road?"
        }
      ]
    }
  ]
}

फ़ंक्शन कॉल करना

अनुरोध का स्ट्रक्चर पहले जैसा ही रहेगा. हालांकि, जवाब में फ़्लैट outputs कॉन्टेंट की जगह, स्ट्रक्चर्ड स्टेप दिखेंगे.

पहले (लेगसी)

Python

# Accessing function call in legacy schema
for output in interaction.outputs:
    if output.type == "function_call":
        print(f"Calling {output.name} with {output.arguments}")

JavaScript

// Accessing function call in legacy schema
for (const output of interaction.outputs) {
    if (output.type === 'function_call') {
        console.log(`Calling {output.name} with {JSON.stringify(output.arguments)}`);
    }
}

REST

// Response
{
  "id": "int_001",
  "role": "model",
  "status": "requires_action",
  "outputs": [
    {
      "type": "thought",
      "signature": "abc123..."
    },
    {
      "type": "function_call",
      "id": "fc_1",
      "name": "get_weather",
      "arguments": { "location": "Boston, MA" }
    }
  ]
}

बाद में (नया स्कीमा)

Python

# Accessing function call in new steps schema
for step in interaction.steps:
    if step.type == "function_call":
        print(f"Calling {step.name} with {step.arguments}")

JavaScript

// Accessing function call in new steps schema
for (const step of interaction.steps) {
    if (step.type === 'function_call') {
        console.log(`Calling {step.name} with {JSON.stringify(step.arguments)}`);
    }
}

REST

// Response
{
  "id": "int_001",
  "status": "requires_action",
  "steps": [
    {
      "type": "user_input",
      "status": "done",
      "content": [
        { "type": "text", "text": "What's the weather in Boston?" }
      ]
    },
    {
      "type": "thought",
      "status": "done",
      "signature": "abc123..."
    },
    {
      "type": "function_call",
      "status": "waiting",
      "id": "fc_1",
      "name": "get_weather",
      "arguments": { "location": "Boston, MA" }
    }
  ]
}

सर्वर-साइड टूल

सर्वर-साइड टूल (जैसे, Google Search या कोड एक्ज़ीक्यूशन) अब steps कलेक्शन में, खास तरह के स्टेप दिखाते हैं. लेगसी स्कीमा में, इन कार्रवाइयों को outputs कलेक्शन में खास तरह के कॉन्टेंट के तौर पर दिखाया जाता था. हालांकि, नए स्कीमा में इन्हें steps कलेक्शन में दिखाया जाएगा. यहां दिए गए उदाहरणों में, Google Search का इस्तेमाल किया गया है.

पहले (लेगसी)

Python

# Accessing search results in legacy schema
for output in interaction.outputs:
    if output.type == "google_search_call":
        print(f"Searched for: {output.arguments.queries}")
    elif output.type == "google_search_result":
        print(f"Found results: {output.result.rendered_content}")

JavaScript

// Accessing search results in legacy schema
for (const output of interaction.outputs) {
    if (output.type === 'google_search_call') {
        console.log(`Searched for: {output.arguments.queries}`);
    } else if (output.type === 'google_search_result') {
        console.log(`Found results: {output.result.renderedContent}`);
    }
}

REST

// Request: POST /v1beta/interactions
{
  "model": "gemini-3-flash-preview",
  "input": "Who won the last Super Bowl?",
  "tools": [
    { "type": "google_search" }
  ]
}

// Response
{
  "id": "int_456",
  "outputs": [
    {
      "type": "google_search_call",
      "id": "gs_1",
      "arguments": { "queries": ["last Super Bowl winner"] }
    },
    {
      "type": "google_search_result",
      "call_id": "gs_1",
      "result": {
        "rendered_content": "<div>...</div>",
        "url": "https://www.nfl.com/super-bowl"
      }
    },
    {
      "type": "text",
      "text": "The Kansas City Chiefs won the last Super Bowl.",
      "annotations": [
        {
          "start_index": 4,
          "end_index": 22,
          "source": "https://www.nfl.com/super-bowl"
        }
      ]
    }
  ],
  "status": "completed"
}

बाद में (नया स्कीमा)

Python

# Accessing search results in new steps schema
for step in interaction.steps:
    if step.type == "google_search_call":
        print(f"Searched for: {step.arguments.queries}")
    elif step.type == "google_search_result":
        print(f"Found results: {step.result.search_suggestions}")

JavaScript

// Accessing search results in new steps schema
for (const step of interaction.steps) {
    if (step.type === 'google_search_call') {
        console.log(`Searched for: {step.arguments.queries}`);
    } else if (step.type === 'google_search_result') {
        console.log(`Found results: {step.result.searchSuggestions}`);
    }
}

REST

// Request: POST /v1beta/interactions
{
  "model": "gemini-3-flash-preview",
  "input": "Who won the last Super Bowl?",
  "tools": [
    { "type": "google_search" }
  ]
}

// Response
{
  "id": "int_456",
  "steps": [
    {
      "type": "user_input",
      "status": "done",
      "content": [
        { "type": "text", "text": "Who won the last Super Bowl?" }
      ]
    },
    {
      "type": "google_search_call",
      "status": "done",
      "id": "gs_1",
      "arguments": { "queries": ["last Super Bowl winner"] },
      "signature": "abc123..."
    },
    {
      "type": "google_search_result",
      "status": "done",
      "call_id": "gs_1",
      "result": {
        "search_suggestions": "<div>...</div>"
      },
      "signature": "abc123..."
    },
    {
      "type": "model_output",
      "status": "done",
      "content": [
        {
          "type": "text",
          "text": "The Kansas City Chiefs won the last Super Bowl.",
          "annotations": [
            {
              "type": "url_citation",
              "url": "https://www.nfl.com/super-bowl",
              "title": "NFL.com",
              "start_index": 4,
              "end_index": 22
            }
          ]
        }
      ]
    }
  ],
  "status": "completed"
}

स्ट्रीमिंग

स्ट्रीमिंग में, इवेंट के नए टाइप दिखते हैं:

इवेंट के नए टाइप

  • interaction.created
  • interaction.status_update — अब इसमें लाइफ़साइकल की सभी स्थितियां शामिल हैं. जैसे, पूरा होना और गड़बड़ियां (नीचे दिए गए स्टेटस देखें)
  • step.start
  • step.delta
  • step.stop
interaction.status_update के स्टेटस
  • in_progress
  • active
  • completed
  • interrupted
  • requires_action
  • error

इवेंट के पुराने टाइप

लेगसी स्कीमा में, इवेंट के इन टाइप की जगह ऊपर बताए गए नए इवेंट टाइप इस्तेमाल किए जाएंगे:

  • interaction.startinteraction.created
  • content.startstep.start
  • content.deltastep.delta
  • content.stopstep.stop
  • interaction.completeinteraction.status_update के साथ status: "completed"
  • errorinteraction.status_update के साथ status: "error"
  • interaction.status_updateinteraction.status_update (इसमें कोई बदलाव नहीं किया गया है. हालांकि, अब इसमें ज़्यादा स्थितियां शामिल हैं)

स्ट्रीमिंग फ़ंक्शन कॉल: फ़ंक्शन कॉल करने के लिए स्ट्रीमिंग का इस्तेमाल करने पर, step.start इवेंट में फ़ंक्शन का नाम दिखता है. वहीं, step.delta इवेंट में आर्ग्युमेंट, JSON स्ट्रिंग के तौर पर स्ट्रीम होते हैं. इसके लिए, arguments_delta का इस्तेमाल किया जाता है. पूरे आर्ग्युमेंट पाने के लिए, आपको इन डेल्टा को इकट्ठा करना होगा. यह यूनरी कॉल से अलग है. यूनरी कॉल में, आपको फ़ंक्शन कॉल का पूरा ऑब्जेक्ट एक साथ मिलता है.

उदाहरण

पहले (लेगसी)

Python

# Legacy streaming used content.delta
stream = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Explain quantum entanglement in simple terms.",
    stream=True,
)

for chunk in stream:
    if chunk.event_type == "content.delta":
        if chunk.delta.type == "text":
            print(chunk.delta.text, end="", flush=True)

JavaScript

// Legacy streaming used content.delta
const stream = await client.interactions.create({
    model: 'gemini-3-flash-preview',
    input: 'Explain quantum entanglement in simple terms.',
    stream: true,
});

for await (const chunk of stream) {
    if (chunk.event_type === 'content.delta') {
        if (chunk.delta.type === 'text') {
            process.stdout.write(chunk.delta.text);
        }
    }
}

REST

// Request: POST /v1beta/interactions
{
  "model": "gemini-3-flash-preview",
  "input": "Explain quantum entanglement in simple terms.",
  "stream": true
}

// Response (SSE Lines)
// event: interaction.start
// data: {"id": "int_123", "status": "in_progress"}
//
// event: content.start
// data: {"index": 0, "type": "text"}
//
// event: content.delta
// data: {"delta": {"type": "text", "text": "Quantum entanglement is..."}}
//
// event: content.stop
// data: {"index": 0}
//
// event: interaction.complete
// data: {"id": "int_123", "status": "done", "usage": {"total_tokens": 42}}
बाद में (नया स्कीमा)

Python

# Consuming stream and handling new event types
for event in client.interactions.create(
    model="gemini-3-flash-preview",
    input="Tell me a story.",
    stream=True,
):
    if event.type == "step.delta":  # CHANGED: step.delta instead of content.delta
        if event.delta.type == "text":
            print(event.delta.text, end="")

JavaScript

// Consuming stream and handling new event types
const stream = await client.interactions.create({
    model: 'gemini-3-flash-preview',
    input: 'Tell me a story.',
    stream: true,
});

for await (const event of stream) {
    if (event.type === 'step.delta') {  // CHANGED: step.delta instead of content.delta
        if (event.delta.type === 'text') {
            process.stdout.write(event.delta.text);
        }
    }
}

REST

 // Request: POST /v1beta/interactions
 // Accept: text/event-stream
 {
   "model": "gemini-3-flash-preview",
   "input": "Tell me a story."
 }

 // Response (SSE Lines)
 // event: interaction.created
 // data: {"type": "interaction.created", "interaction": {"id": "int_xyz", "status": "created"}} // CHANGED: 'type' instead of 'event_type'
 //
 // event: interaction.status_update
 // data: {"type": "interaction.status_update", "status": "in_progress"} // NEW: Lifecycle status updates in stream (postpone until Sessions launch dependency)
 //
 // event: step.start
 // data: {"type": "step.start", "index": 0, "step": {"type": "thought"}} // NEW: Replaces content.start, 'step' instead of 'content'
 //
 // event: step.delta
 // data: {"type": "step.delta", "index": 0, "delta": {"type": "thought", "text": "User wants an explanation."}} // NEW: Delta type matches step type
 //
 // event: step.stop
 // data: {"type": "step.stop", "index": 0, "status": "done"} // NEW: Includes status
 //
 // event: step.start
 // data: {"type": "step.start", "index": 1, "step": {"type": "model_output"}} // NEW: Step wrapper for output
 //
 // event: step.delta
 // data: {"type": "step.delta", "index": 1, "delta": {"type": "text", "text": "Hello"}}
 //
 // event: step.stop
 // data: {"type": "step.stop", "index": 1, "status": "done"}
 //
 // event: interaction.complete
 // data: {"type": "interaction.complete", "interaction": {"id": "int_xyz", "status": "completed", "usage": {"prompt_tokens": 10, "completion_tokens": 5, "total_tokens": 15}}} // NEW: End of stream event with interaction details

स्टेटलेस बातचीत का इतिहास

अगर क्लाइंट साइड पर, बातचीत के इतिहास को मैन्युअल तरीके से मैनेज किया जाता है (स्टेटलेस इस्तेमाल का तरीका), तो आपको पिछले टर्न को एक साथ लाने के तरीके को अपडेट करना होगा.

  • लेगसी: डेवलपर अक्सर जवाबों से outputs कलेक्शन इकट्ठा करते थे और अगले टर्न में, उन्हें input फ़ील्ड में वापस भेजते थे.
  • नया स्कीमा: अब आपको जवाब से steps कलेक्शन इकट्ठा करना चाहिए और अगले अनुरोध के input फ़ील्ड में इसे पास करना चाहिए. साथ ही, अपने नए उपयोगकर्ता टर्न को user_input स्टेप के तौर पर जोड़ना चाहिए.

आउटपुट फ़ॉर्मैट कॉन्फ़िगरेशन: response_format में बदलाव

अपडेट किए गए एपीआई में, आउटपुट फ़ॉर्मैट के सभी कंट्रोल को एक ही पॉलीमॉर्फिक response_format फ़ील्ड में शामिल किया गया है. इससे, आउटपुट कॉन्फ़िगरेशन को टॉप लेवल पर केंद्रीकृत किया जाता है. साथ ही, generation_config को मॉडल के व्यवहार (जैसे, तापमान, top_p, और थिंकिंग) पर फ़ोकस किया जाता है.

मुख्य बदलाव

  • एपीआई से response_mime_type हटा दिया गया है. अब आपको response_format में, हर फ़ॉर्मैट की एंट्री के लिए MIME टाइप तय करना होगा.
  • response_format अब पॉलीमॉर्फिक ऑब्जेक्ट (या कलेक्शन) है. हर एंट्री में, type डिस्क्रिमिटर (text, audio, image) और टाइप के हिसाब से फ़ील्ड होते हैं. आउटपुट के कई तरीके का अनुरोध करने के लिए, फ़ॉर्मैट की एंट्री का कलेक्शन पास करें.
  • image_config को generation_config से हटाकर, response_format में शामिल किया गया है. अब आपको response_format में, "type": "image" के साथ एंट्री में, इमेज आउटपुट की सेटिंग तय करनी होंगी. जैसे, aspect_ratio और image_size .

स्ट्रक्चर्ड आउटपुट (JSON)

नए स्कीमा में, response_mime_type फ़ील्ड हटा दिया गया है. इसके बजाय, response_format ऑब्जेक्ट में, MIME टाइप और JSON स्कीमा तय करें "type": "text".

पहले (लेगसी)

Python

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Summarize this article.",
    response_mime_type="application/json",
    response_format={
        "type": "object",
        "properties": {
            "summary": {"type": "string"}
        }
    },
)

print(interaction.outputs[0].text)

JavaScript

const interaction = await client.interactions.create({
    model: 'gemini-3-flash-preview',
    input: 'Summarize this article.',
    responseMimeType: 'application/json',
    responseFormat: {
        type: 'object',
        properties: {
            summary: { type: 'string' }
        }
    },
});

console.log(interaction.outputs[0].text);

REST

// Request: POST /v1beta/interactions
{
  "model": "gemini-3-flash-preview",
  "input": "Summarize this article.",
  "response_mime_type": "application/json",
  "response_format": {
    "type": "object",
    "properties": {
      "summary": { "type": "string" }
    }
  }
}

बाद में (नया स्कीमा)

Python

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Summarize this article.",
    # response_mime_type is removed — specify mime_type inside response_format
    response_format={
        "type": "text",
        "mime_type": "application/json",
        "schema": {
            "type": "object",
            "properties": {
                "summary": {"type": "string"}
            }
        }
    },
)

print(interaction.steps[-1].content[0].text)

JavaScript

const interaction = await client.interactions.create({
    model: 'gemini-3-flash-preview',
    input: 'Summarize this article.',
    // responseMimeType is removed — specify mimeType inside responseFormat
    responseFormat: {
        type: 'text',
        mimeType: 'application/json',
        schema: {
            type: 'object',
            properties: {
                summary: { type: 'string' }
            }
        }
    },
});

console.log(interaction.steps.at(-1).content[0].text);

REST

// Request: POST /v1beta/interactions
{
  "model": "gemini-3-flash-preview",
  "input": "Summarize this article.",
  // response_mime_type is removed
  "response_format": {
    "type": "text",                          // NEW: type discriminator
    "mime_type": "application/json",          // MOVED: from response_mime_type
    "schema": {                              // RENAMED: was response_format directly
      "type": "object",
      "properties": {
        "summary": { "type": "string" }
      }
    }
  }
}

इमेज कॉन्फ़िगरेशन

नए स्कीमा में, generation_config से image_config हटा दिया गया है. अब आपको इमेज आउटपुट की सेटिंग response_format एंट्री में "type": "image" के साथ तय करनी होंगी.

पहले (लेगसी)

Python

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Generate an image of a sunset over the ocean.",
    generation_config={
        "image_config": {
            "aspect_ratio": "1:1",
            "image_size": "1K"
        }
    },
)

JavaScript

const interaction = await client.interactions.create({
    model: 'gemini-3-flash-preview',
    input: 'Generate an image of a sunset over the ocean.',
    generationConfig: {
        imageConfig: {
            aspectRatio: '1:1',
            imageSize: '1K'
        }
    },
});

REST

// Request: POST /v1beta/interactions
{
  "model": "gemini-3-flash-preview",
  "input": "Generate an image of a sunset over the ocean.",
  "generation_config": {
    "image_config": {
      "aspect_ratio": "1:1",
      "image_size": "1K"
    }
  }
}

बाद में (नया स्कीमा)

Python

interaction = client.interactions.create(
    model="gemini-3-flash-preview",
    input="Generate an image of a sunset over the ocean.",
    # image_config is removed from generation_config — use response_format
    response_format={
        "type": "image",
        "mime_type": "image/jpeg",
        "delivery": "inline",
        "aspect_ratio": "1:1",
        "image_size": "1K"
    },
)

JavaScript

const interaction = await client.interactions.create({
    model: 'gemini-3-flash-preview',
    input: 'Generate an image of a sunset over the ocean.',
    // imageConfig is removed from generationConfig — use responseFormat
    responseFormat: {
        type: 'image',
        mimeType: 'image/jpeg',
        delivery: 'inline',
        aspectRatio: '1:1',
        imageSize: '1K'
    },
});

REST

// Request: POST /v1beta/interactions
{
  "model": "gemini-3-flash-preview",
  "input": "Generate an image of a sunset over the ocean.",
  // image_config removed from generation_config
  "response_format": {
    "type": "image",                         // NEW: type discriminator
    "mime_type": "image/jpeg",
    "delivery": "inline",
    "aspect_ratio": "1:1",                   // MOVED: from generation_config.image_config
    "image_size": "1K"                       // MOVED: from generation_config.image_config
  }
}

आउटपुट के कई तरीके का अनुरोध करने के लिए (उदाहरण के लिए, टेक्स्ट और ऑडियो एक साथ), response_format में एक ऑब्जेक्ट के बजाय, फ़ॉर्मैट की एंट्री का कलेक्शन पास करें.

नए स्कीमा पर माइग्रेट करने का तरीका

एसडीके का इस्तेमाल करने वाले लोग

एसडीके के नए वर्शन (Python ≥1.76.0, JavaScript ≥1.53.0) पर अपग्रेड करें. एसडीके, आपको नए स्कीमा में अपने-आप ऑप्ट-इन कर लेता है. इसके लिए, कोड में किसी तरह के बदलाव की ज़रूरत नहीं होती. आपको सिर्फ़ जवाब पढ़ने के तरीके को अपडेट करना होगा (ऊपर दिए गए उदाहरण देखें). ध्यान दें कि एसडीके के इन वर्शन में, सिर्फ़ नया स्कीमा काम करता है. एसडीके के पुराने वर्शन (Python ≤1.73.1, JavaScript ≤1.50.1), लेगसी स्कीमा को 6 जून, 2026 को हटाए जाने तक काम करते रहेंगे.

REST API का इस्तेमाल करने वाले लोग

नए स्कीमा में अभी ऑप्ट-इन करने के लिए, अपने अनुरोधों में Api-Revision: 2026-05-20 हेडर जोड़ें. 20 मई के बाद, नया स्कीमा सभी अनुरोधों के लिए डिफ़ॉल्ट स्कीमा बन जाएगा. **6 जून** तक, Api-Revision: 2026-05-06 का इस्तेमाल करके, अस्थायी तौर पर ऑप्ट-आउट किया जा सकता है. इसके बाद, एपीआई लेगसी स्कीमा को हमेशा के लिए हटा देगा.

टाइमलाइन

तारीख फ़ेज़ (चरण) एसडीके का इस्तेमाल करने वाले लोग REST API का इस्तेमाल करने वाले लोग
6 मई ऑप्ट-इन करें एसडीके का नया मुख्य वर्शन उपलब्ध है (Python ≥2.0.0, JS ≥2.0.0). नए स्कीमा को अपने-आप पाने के लिए, अपग्रेड करें. ऑप्ट-इन करने के लिए, Api-Revision: 2026-05-20 हेडर जोड़ें. डिफ़ॉल्ट स्कीमा, लेगसी ही रहेगा.
20 मई डिफ़ॉल्ट स्कीमा में बदलाव अगर पहले ही अपग्रेड कर लिया गया है, तो कुछ करने की ज़रूरत नहीं है. एसडीके के पुराने वर्शन (Python 1.x.x, JS 1.x.x) अब भी काम करेंगे. हालांकि, इनसे लेगसी स्कीमा के जवाब मिलेंगे. नया स्कीमा अब डिफ़ॉल्ट स्कीमा है. ऑप्ट-आउट करने के लिए, Api-Revision: 2026-05-06 हेडर भेजें.
6 जून सूर्यास्त Python और JS के 1.x.x एसडीके वर्शन, इंटरैक्शन एपीआई कॉल के लिए काम नहीं करेंगे. इंटरैक्शन एपीआई के लिए, लेगसी स्कीमा हटा दिया गया है. Api-Revision हेडर को नज़रअंदाज़ किया जाएगा.

माइग्रेशन की चेकलिस्ट

स्टेप स्कीमा (steps)

  • जवाब का कॉन्टेंट पढ़ने के लिए, कोड को अपडेट करें. अब outputs के बजाय, steps कलेक्शन से कॉन्टेंट पढ़ा जाएगा. उदाहरण देखें..
  • पक्का करें कि आपका कोड, user_input और model_output, दोनों तरह के स्टेप को हैंडल करता हो. उदाहरण देखें..
  • (फ़ंक्शन कॉल करना) कोड को अपडेट करें, ताकि steps कलेक्शन में function_call स्टेप ढूंढे जा सकें. उदाहरण देखें..
  • (सर्वर-साइड टूल) टूल के हिसाब से स्टेप हैंडल करने के लिए, कोड को अपडेट करें. जैसे, google_search_call, google_search_result. उदाहरण देखें.
  • (स्टेटलेस इतिहास) इतिहास को मैनेज करने के तरीके को अपडेट करें, ताकि अगले अनुरोध के input फ़ील्ड में, steps कलेक्शन पास किया जा सके. जानकारी देखें.
  • (सिर्फ़ स्ट्रीमिंग) क्लाइंट को अपडेट करें, ताकि वह SSE इवेंट के नए टाइप (interaction.created, step.delta वगैरह) सुन सके. उदाहरण देखें.

आउटपुट फ़ॉर्मैट कॉन्फ़िगरेशन (response_format)

  • response_mime_type की जगह, response_format में mime_type फ़ील्ड का इस्तेमाल करें. उदाहरण देखें.
  • अपने मौजूदा response_format JSON स्कीमा को, {"type": "text", "schema": ...} ऑब्जेक्ट में रैप करें. उदाहरण देखें.
  • (इमेज जनरेट करना) generation_config से image_config को हटाकर, response_format में {"type": "image", ...} एंट्री में शामिल करें. उदाहरण देखें.
  • (मल्टीमॉडल) आउटपुट के कई तरीके का अनुरोध करने पर, response_format को एक ऑब्जेक्ट से कलेक्शन में बदलें..