واجهة برمجة التطبيقات Interactions API: دليل نقل التغييرات غير المتوافقة (مايو 2026)

تتضمّن واجهة v1beta Interactions API تغييرات قد تؤدي إلى عطل، وهي تعيد هيكلة شكل الواجهة لإتاحة إمكانات مستقبلية، مثل التوجيه أثناء التنفيذ واستدعاءات الأدوات غير المتزامنة. توضّح هذه الصفحة التغييرات وتقدّم أمثلة على الرموز البرمجية قبل التغيير وبعده لمساعدتك في نقل البيانات. هناك فئتان من التغييرات:

  1. مخطط الخطوات: يحلّ مصفوفة steps جديدة محل مصفوفة outputs، ما يوفّر مخططًا زمنيًا منظّمًا لكل دور تفاعل.
  2. إعدادات تنسيق الناتج: يجمع حقل response_format الجديد المتعدد الأشكال جميع عناصر التحكّم في تنسيق الناتج ويزيل response_mime_type.

اتّبِع الخطوات الواردة في مقالة كيفية نقل البيانات إلى المخطط الجديد لتحديث عملية الدمج.

التغيير الأساسي: من outputs إلى steps

يستبدل المخطّط الجديد مصفوفة outputs بمصفوفة steps.

  • القديم: تعرض الردود مصفوفة outputs مسطّحة تحتوي فقط على المحتوى الذي أنشأه النموذج.
  • مخطّط جديد: تعرض الردود مصفوفة steps تحتوي على خطوات منظَّمة مع أدوات تمييز النوع.

تعرض السمة POST /interactions خطوات الإخراج فقط. تعرض GET /interactions/{id} المخطط الزمني الكامل للخطوات، بما في ذلك الخطوة الأولية user_input.

الإدخال/الإخراج الأساسي (أحادي)

قبل (الإصدار القديم)

Python

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

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

JavaScript

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

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

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.8-flash",
    "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.8-flash", input="Tell me a joke."
)

# Response access (Recommended sugar)
print(interaction.output_text)

JavaScript

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

// Response access (Recommended sugar)
console.log(interaction.output_text);

[sdk-convenience]: /gemini-api/docs/interactions-overview#sdk-sugar

REST

# Opt-in needed before May 26th
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Api-Revision: 2026-05-20" \
  -d '{
    "model": "gemini-3.8-flash",
    "input": "Tell me a joke."
  }'
// POST Response
{
  "id": "int_123",
  "steps": [
    {
      "type": "model_output",
      "content": [
        {
          "type": "text",
          "text": "Why did the chicken cross the road?"
        }
      ]
    }
  ]
}

// GET /v1beta/interactions/int_123 (returns full timeline including input)
{
  "id": "int_123",
  "steps": [
    {
      "type": "user_input",
      "content": [
        { "type": "text", "text": "Tell me a joke." }
      ]
    },
    {
      "type": "model_output",
      "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

// POST Response
{
  "id": "int_001",
  "status": "requires_action",
  "steps": [
    {
      "type": "thought",
      "summary": [{
        "type": "text",
        "text": "I need to check the weather in Boston..."
      }],
      "signature": "abc123..."
    },
    {
      "type": "function_call",
      "id": "fc_1",
      "name": "get_weather",
      "arguments": { "location": "Boston, MA" }
    }
  ]
}

أدوات من جهة الخادم

توفّر الأدوات من جهة الخادم (مثل "بحث Google" أو "تنفيذ الرموز البرمجية") الآن أنواع خطوات معيّنة في مصفوفة steps. في حين أنّ المخطط القديم كان يعرض هذه العمليات كأنواع محتوى محدّدة ضمن الصفيف outputs، ينقلها المخطط الجديد إلى الصفيف steps. تستخدِم الأمثلة التالية "بحث Google".

قبل (قديم)

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

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.8-flash",
    "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[0].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[0].search_suggestions}`);
    }
}

REST

# Opt-in needed before May 26th
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Api-Revision: 2026-05-20" \
  -d '{
    "model": "gemini-3.8-flash",
    "input": "Who won the last Super Bowl?",
    "tools": [
      { "type": "google_search" }
    ]
  }'
// POST Response
{
  "id": "int_456",
  "steps": [
    {
      "type": "google_search_call",
      "id": "gs_1",
      "arguments": { "queries": ["last Super Bowl winner"] },
      "signature": "abc123..."
    },
    {
      "type": "google_search_result",
      "call_id": "gs_1",
      "result": {
        "search_suggestions": "<div>...</div>"
      },
      "signature": "abc123..."
    },
    {
      "type": "model_output",
      "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.completed
  • interaction.in_progress
  • interaction.requires_action
  • step.start
  • step.delta
  • step.stop

أنواع الأحداث المتوقّفة نهائيًا

يتم استبدال أنواع الأحداث القديمة التالية بالأحداث الجديدة المذكورة أعلاه:

  • interaction.start ‏← interaction.created
  • content.start ‏← step.start
  • content.delta ‏← step.delta
  • content.stop ‏← step.stop
  • interaction.complete ‏← interaction.completed
  • interaction.status_update → تم استبداله بـ interaction.in_progress وinteraction.requires_action وما إلى ذلك

استدعاء الدوال أثناء البث: عند استخدام البث مع استدعاء الدوال، يقدّم حدث step.start اسم الدالة، وتبث أحداث step.delta الوسيطات كسلاسل JSON جزئية (باستخدام arguments_delta). يجب تجميع هذه التغييرات للحصول على الوسيطات الكاملة. ويختلف ذلك عن المكالمات الأحادية التي تتلقّى فيها كائن استدعاء الدالة الكامل في وقت واحد.

أمثلة

قبل (الإصدار القديم)

Python

# Legacy streaming used content.delta
stream = client.interactions.create(
    model="gemini-3.8-flash",
    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.8-flash',
    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

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.8-flash",
    "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.8-flash",
    input="Tell me a story.",
    stream=True,
):
    if event.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.8-flash',
    input: 'Tell me a story.',
    stream: true,
});

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

REST

 # Opt-in needed before May 26th
 curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
   -H "Content-Type: application/json" \
   -H "Accept: text/event-stream" \
   -H "Api-Revision: 2026-05-20" \
   -d '{
     "model": "gemini-3.8-flash",
     "input": "Tell me a story.",
     "stream": true
   }'
 // Response (SSE Lines)
 // event: interaction.created
 // data: {"interaction": {"id": "int_xyz", "status": "in_progress", "object": "interaction", "model": "gemini-3.8-flash"}, "event_type": "interaction.created"}
 //
 // event: interaction.in_progress
 // data: {"interaction_id": "int_xyz", "event_type": "interaction.in_progress"}
 //
 // event: step.start
 // data: {"index": 0, "step": {"type": "thought", "signature": "abc123..."}, "event_type": "step.start"}
 //
 // event: step.stop
 // data: {"index": 0, "event_type": "step.stop"}
 //
 // event: step.start
 // data: {"index": 1, "step": {"content": [{"text": "Once upon", "type": "text"}], "type": "model_output"}, "event_type": "step.start"}
 //
 // event: step.delta
 // data: {"index": 1, "delta": {"text": " a time...", "type": "text"}, "event_type": "step.delta"}
 //
 // event: step.stop
 // data: {"type": "step.stop", "index": 1, "status": "done"}
 //
 // event: interaction.completed
 // data: {"type": "interaction.completed", "interaction": {"id": "int_xyz", "status": "completed", "usage": {"prompt_tokens": 10, "completion_tokens": 5, "total_tokens": 15}}} // NEW: Dedicated completion event

سجلّ المحادثات بدون حالة

إذا كنت تدير سجلّ المحادثات يدويًا من جهة العميل (حالة استخدام بدون حالة)، عليك تعديل طريقة ربط الجولات السابقة.

  • الإصدار القديم: كان المطوّرون غالبًا يجمعون مصفوفة outputs من الردود ويرسلونها في الحقل input في الجولة التالية.
  • المخطط الجديد: عليك الآن جمع مصفوفة steps من الردّ وإرسالها في حقل input للطلب التالي، مع إلحاق دور المستخدم الجديد كخطوة user_input.

تغييرات في إعدادات تنسيق الإخراج: response_format

تدمج واجهة برمجة التطبيقات المعدَّلة جميع عناصر التحكّم في تنسيق الإخراج في حقل response_format موحّد ومتعدّد الأشكال. يؤدي ذلك إلى تركيز إعدادات المخرجات في المستوى الأعلى، ويسمح لـ generation_config بالتركيز على سلوك النموذج (مثل درجة العشوائية وtop_p والتفكير).

أهم التغييرات

  • تزيل واجهة برمجة التطبيقات response_mime_type. يمكنك الآن تحديد نوع MIME لكل إدخال تنسيق داخل response_format.
  • أصبح response_format الآن كائنًا (أو مصفوفة) متعدد الأشكال. يحتوي كل إدخال على مُميِّز type (text أو audio أو image) وحقول خاصة بالنوع. لطلب وسائط إخراج متعددة، مرِّر مصفوفة من إدخالات التنسيق.
  • يتم نقل "image_config" من "generation_config" إلى "response_format". يمكنك الآن تحديد إعدادات إخراج الصور، مثل aspect_ratio وimage_size، في إدخال response_format باستخدام "type": "image".

الناتج المنظَّم (JSON)

يزيل المخطط الجديد الحقل response_mime_type. بدلاً من ذلك، حدِّد نوع MIME ومخطط JSON داخل عنصر response_format باستخدام "type": "text".

قبل (الإصدار القديم)

Python

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

print(interaction.outputs[-1].text)

JavaScript

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

console.log(interaction.outputs[-1].text);

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.8-flash",
    "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.8-flash",
    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 response
print(interaction.output_text)

JavaScript

const interaction = await client.interactions.create({
    model: 'gemini-3.8-flash',
    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 response
console.log(interaction.output_text);

REST

# Opt-in needed before May 26th
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Api-Revision: 2026-05-20" \
  -d '{
    "model": "gemini-3.8-flash",
    "input": "Summarize this article.",
    "response_format": {
      "type": "text",
      "mime_type": "application/json",
      "schema": {
        "type": "object",
        "properties": {
          "summary": { "type": "string" }
        }
      }
    }
  }'

إعدادات الصورة

يزيل المخطط الجديد image_config من generation_config. يمكنك الآن تحديد إعدادات إخراج الصور في إدخال response_format باستخدام "type": "image".

قبل (الإصدار القديم)

Python

interaction = client.interactions.create(
    model="gemini-3.8-flash",
    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.8-flash',
    input: 'Generate an image of a sunset over the ocean.',
    generation_config: {
        image_config: {
            aspect_ratio: '1:1',
            image_size: '1K'
        }
    },
});

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.8-flash",
    "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.8-flash",
    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",
        "aspect_ratio": "1:1",
        "image_size": "1K"
    },
)

JavaScript

const interaction = await client.interactions.create({
    model: 'gemini-3.8-flash',
    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',
        aspect_ratio: '1:1',
        image_size: '1K'
    },
});

REST

# Opt-in needed before May 26th
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Api-Revision: 2026-05-20" \
  -d '{
    "model": "gemini-3.8-flash",
    "input": "Generate an image of a sunset over the ocean.",
    "response_format": {
      "type": "image",
      "mime_type": "image/jpeg",
      "aspect_ratio": "1:1",
      "image_size": "1K"
    }
  }'

إعدادات الصوت

يستبدل المخطط الجديد response_modalities: ["audio"] بإدخال response_format بقيمة "type": "audio".

قبل (الإصدار القديم)

Python

interaction = client.interactions.create(
    model="gemini-3.1-flash-tts-preview",
    input="Say cheerfully: Have a wonderful day!",
    response_modalities=["audio"],
    generation_config={
        "speech_config": [
            {"voice": "Kore"}
        ]
    }
)

JavaScript

const interaction = await client.interactions.create({
    model: 'gemini-3.1-flash-tts-preview',
    input: 'Say cheerfully: Have a wonderful day!',
    response_modalities: ['audio'],
    generation_config: {
        speech_config: [
            { voice: 'Kore' }
        ]
    },
});

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-tts-preview",
    "input": "Say cheerfully: Have a wonderful day!",
    "response_modalities": ["audio"],
    "generation_config": {
      "speech_config": [
        { "voice": "Kore" }
      ]
    }
  }'

بعد (المخطط الجديد)

Python

interaction = client.interactions.create(
    model="gemini-3.1-flash-tts-preview",
    input="Say cheerfully: Have a wonderful day!",
    # response_modalities is removed — use response_format
    response_format={
        "type": "audio"
    },
    generation_config={
        "speech_config": [
            {"voice": "Kore"}
        ]
    }
)

JavaScript

const interaction = await client.interactions.create({
    model: 'gemini-3.1-flash-tts-preview',
    input: 'Say cheerfully: Have a wonderful day!',
    // response_modalities is removed — use response_format
    response_format: {
        type: 'audio'
    },
    generation_config: {
        speech_config: [
            { voice: 'Kore' }
        ]
    },
});

REST

# Opt-in needed before May 26th
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions?key=$GEMINI_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Api-Revision: 2026-05-20" \
  -d '{
    "model": "gemini-3.1-flash-tts-preview",
    "input": "Say cheerfully: Have a wonderful day!",
    "response_format": {
      "type": "audio"
    },
    "generation_config": {
      "speech_config": [
        { "voice": "Kore" }
      ]
    }
  }'

لطلب عدة أنواع من المخرجات (على سبيل المثال، نص وصوت معًا)، يجب تمرير مصفوفة من إدخالات التنسيق إلى response_format بدلاً من كائن واحد.

كيفية الانتقال إلى المخطّط الجديد

مستخدمو حزمة تطوير البرامج (SDK)

يُرجى الترقية إلى أحدث إصدار من حزمة تطوير البرامج (SDK) (الإصدار 2.0.0 أو أحدث من Python، والإصدار 2.0.0 أو أحدث من JavaScript). تتيح لك حزمة تطوير البرامج (SDK) استخدام المخطّط الجديد تلقائيًا، ولن تحتاج إلى إجراء أي تغييرات على الرمز البرمجي سوى تعديل طريقة قراءة الردود (راجِع الأمثلة أعلاه). يُرجى العِلم أنّه لا يتوفّر في إصدارات حزمة تطوير البرامج (SDK) هذه سوى المخطط الجديد. ستظل إصدارات حزمة تطوير البرامج (SDK) القديمة (Python 1.x.x وJavaScript 1.x.x) تعمل إلى أن تتم إزالة المخطط القديم في 8 يونيو 2026.

مستخدمو REST API

أضِف العنوان Api-Revision: 2026-05-20 إلى طلباتك للموافقة على المخطط الجديد الآن. بعد 26 مايو، سيصبح المخطط الجديد هو المخطط التلقائي لجميع الطلبات. يمكنك إيقاف هذه الميزة مؤقتًا باستخدام Api-Revision: 2026-05-07 حتى 8 يونيو، وهو التاريخ الذي ستزيل فيه واجهة برمجة التطبيقات المخطّط القديم نهائيًا.

المخطط الزمني

التاريخ المرحلة مستخدمو حِزم تطوير البرامج (SDK) مستخدمو REST API
‫7 مايو اشتراك يتوفّر إصدار جديد من حزمة تطوير البرامج (Python ≥2.0.0 وJS ≥2.0.0). يمكنك الترقية للحصول على المخطط الجديد تلقائيًا. أضِف العنوان Api-Revision: 2026-05-20 للموافقة على المشاركة. يبقى الإعداد التلقائي هو الإصدار القديم.
‫26 مايو الانعكاس التلقائي ليس عليك اتّخاذ أي إجراء إذا سبق لك الترقية. لا تزال حِزم SDK القديمة (Python 1.x.x وJS 1.x.x) تعمل، ولكنّها تعرض ردودًا قديمة. أصبح المخطّط الجديد هو المخطّط التلقائي الآن. أرسِل العنوان Api-Revision: 2026-05-07 لإيقاف المراسلة.
‫8 يونيو الغروب ستتوقف إصدارات حزمة تطوير البرامج (SDK) من Python 1.x.x وJS 1.x.x عن العمل عند طلب بيانات من واجهة برمجة التطبيقات Interactions API. تمت إزالة المخطط القديم لواجهة برمجة التطبيقات Interactions API. تم تجاهل العنوان Api-Revision.

قائمة التحقق من الترحيل

مخطّط الخطوات (steps)

  • عدِّل الرمز البرمجي لقراءة محتوى الردّ من مصفوفة steps بدلاً من outputs. الاطّلاع على أمثلة
  • تأكَّد من أنّ الرمز يعالج نوعَي الخطوات user_input وmodel_output. الاطّلاع على أمثلة
  • (استدعاء الدوال) عدِّل الرمز البرمجي للعثور على function_call خطوات في مصفوفة steps. الاطّلاع على أمثلة
  • (الأدوات من جهة الخادم) عدِّل الرمز البرمجي للتعامل مع الخطوات الخاصة بالأداة (مثل google_search_call وgoogle_search_result). الاطّلاع على الأمثلة
  • (سجلّ بدون حالة) عدِّل إدارة السجلّ لتمرير مصفوفة steps في حقل input للطلب التالي. الاطّلاع على التفاصيل
  • (البث فقط) تعديل العميل للاستماع إلى أنواع أحداث SSE الجديدة (interaction.created وstep.delta وما إلى ذلك) الاطّلاع على أمثلة

إعدادات تنسيق الردّ (response_format)

  • استبدِل response_mime_type بحقل mime_type داخل response_format. الاطّلاع على أمثلة
  • أدرِج مخطط JSON الحالي لـ response_format داخل عنصر {"type": "text", "schema": ...}. الاطّلاع على أمثلة
  • (Image Generation) Move image_config from generation_config to a {"type": "image", ...} entry in response_format. الاطّلاع على أمثلة
  • (Speech Generation) Replace response_modalities=["audio"] with a {"type": "audio"} entry in response_format. الاطّلاع على أمثلة
  • (متعدّد الوسائط) تحويل response_format من عنصر واحد إلى مصفوفة عند طلب وسائط إخراج متعدّدة