API การโต้ตอบ: คู่มือการย้ายข้อมูลการเปลี่ยนแปลงที่ไม่รองรับการทำงานย้อนหลัง (พฤษภาคม 2026)

v1beta Interactions API จะมีการเปลี่ยนแปลงที่ส่งผลกับส่วนอื่นในระบบซึ่งจะปรับโครงสร้างรูปร่างของ API เพื่อรองรับความสามารถในอนาคต เช่น การควบคุมกลางคันและการเรียกใช้เครื่องมือแบบอะซิงโครนัส หน้านี้อธิบายสิ่งที่กำลังจะเปลี่ยนแปลงและแสดงตัวอย่างโค้ดก่อนและหลังการเปลี่ยนแปลงเพื่อช่วยคุณย้ายข้อมูล การเปลี่ยนแปลงมี 2 หมวดหมู่ ดังนี้

  1. สคีมาขั้นตอน: อาร์เรย์ steps ใหม่จะแทนที่อาร์เรย์ outputs เพื่อให้ไทม์ไลน์ที่มีโครงสร้างของการโต้ตอบแต่ละรอบ
  2. การกำหนดค่ารูปแบบเอาต์พุต: Polymorphic 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 การเปลี่ยนแปลง

API ที่อัปเดตจะรวมการควบคุมรูปแบบเอาต์พุตทั้งหมดไว้ในresponse_formatฟิลด์แบบหลายรูปแบบที่รวมเป็นหนึ่งเดียว ซึ่งจะรวมการกำหนดค่าเอาต์พุตไว้ที่ระดับบนสุดและช่วยให้ generation_config มุ่งเน้นไปที่ลักษณะการทำงานของโมเดล (เช่น อุณหภูมิ, top_p และการคิด)

การเปลี่ยนแปลงที่สำคัญ

  • API จะนำ response_mime_type ออก ตอนนี้คุณระบุประเภท MIME ต่อรายการรูปแบบภายใน response_format ได้แล้ว
  • ตอนนี้ response_format เป็นออบเจ็กต์ (หรืออาร์เรย์) แบบ Polymorphic แล้ว แต่ละรายการมีตัวแยกแยะ 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-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" }
      }
    }
  }
}

การกำหนดค่ารูปภาพ

สคีมาใหม่จะนำ image_config ออกจาก generation_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 แทนที่จะส่งออบเจ็กต์เดียว

วิธีย้ายข้อมูลไปยังสคีมาใหม่

ผู้ใช้ SDK

อัปเกรดเป็น SDK เวอร์ชันล่าสุด (Python ≥1.76.0, JavaScript ≥1.53.0) SDK จะเลือกใช้สคีมาใหม่ให้คุณโดยอัตโนมัติ โดยไม่ต้องเปลี่ยนแปลงโค้ดใดๆ นอกเหนือจาก การอัปเดตวิธีอ่านการตอบกลับ (ดูตัวอย่างด้านบน) โปรดทราบว่า SDK เวอร์ชันเหล่านี้รองรับเฉพาะสคีมาใหม่ เท่านั้น SDK เวอร์ชันเก่า (Python ≤1.73.1, JavaScript ≤1.50.1) จะยังคงใช้งานได้จนกว่าจะนำสคีมาเดิม ออกในวันที่ 6 มิถุนายน 2026

ผู้ใช้ REST API

เพิ่มส่วนหัว Api-Revision: 2026-05-20 ลงในคำขอเพื่อเลือกใช้สคีมาใหม่ตอนนี้ หลังจากวันที่ 20 พฤษภาคม สคีมาใหม่จะกลายเป็นค่าเริ่มต้นสำหรับคำขอทั้งหมด คุณเลือกไม่ใช้ชั่วคราวได้ด้วย Api-Revision: 2026-05-06 จนถึงวันที่ 6 มิถุนายน ซึ่งเป็นวันที่ API จะนำสคีมาเดิมออกอย่างถาวร

ไทม์ไลน์

วันที่ ระยะ ผู้ใช้ SDK ผู้ใช้ REST API
6 พฤษภาคม เลือกเข้าร่วม มี SDK เวอร์ชันหลักใหม่ (Python ≥2.0.0, JS ≥2.0.0) อัปเกรดเพื่อรับสคีมาใหม่โดยอัตโนมัติ เพิ่มส่วนหัว Api-Revision: 2026-05-20 เพื่อเลือกใช้ ค่าเริ่มต้นยังคงเป็นเวอร์ชันเดิม
20 พฤษภาคม การพลิกเริ่มต้น คุณไม่ต้องดำเนินการใดๆ หากอัปเกรดแล้ว SDK รุ่นเก่า (Python 1.x.x, JS 1.x.x) ยังคงใช้งานได้ แต่จะแสดงการตอบกลับแบบเดิม ตอนนี้สคีมาใหม่เป็นค่าเริ่มต้นแล้ว ส่งส่วนหัว Api-Revision: 2026-05-06 เพื่อเลือกไม่ใช้
6 มิถุนายน พระอาทิตย์ตก SDK เวอร์ชัน 1.x.x สำหรับ Python และ JS จะหยุดทำงานสำหรับการเรียกใช้ 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 ดูตัวอย่าง
  • ห่อหุ้มresponse_formatสคีมา JSON ที่มีอยู่ภายในออบเจ็กต์ {"type": "text", "schema": ...} ดูตัวอย่าง
  • (การสร้างรูปภาพ) ย้าย image_config จาก generation_config ไปยังรายการ {"type": "image", ...} ใน response_format ดูตัวอย่าง
  • (มัลติโมดัล) แปลง response_format จากออบเจ็กต์เดียวเป็นอาร์เรย์เมื่อขอเอาต์พุตหลายรูปแบบ