BaşlayınÜcretsiz Başlayın

Role-Based Inputs

Using the input and instructions arguments to provide string inputs has gotten you a long way, but sometimes, a role-based approach can better suit your application.

Here, you've been provided with a complete Responses API request, and your job is to update it to use role-based messages, keeping the prompts the same. This will set your application up for success when you begin to integrate image inputs.

Bu egzersiz

Working with the OpenAI Responses API

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Convert the input/instruction Responses request into the role-based messages format.

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Convert this request to use role-based messages
response = client.responses.create(
    model="gpt-5-mini",
    instructions="You are a product cataloging expert who provides concise descriptions.",
    input="A mustard-yellow colored winter jacket."
)

print(response.output_text)
Kodu Düzenle ve Çalıştır