從一則訊息接續到下一則
現在輪到你把多個回應串接起來,讓不同請求之間能保留脈絡!這其實就是在建立對話歷史——對話中非常關鍵的一部分。
本練習屬於課程
使用 OpenAI Responses API
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Create the first request
response1 = client.____.____(
model="gpt-5.4-mini",
____="Draft a short LinkedIn post announcing that I'm learning about the OpenAI Responses API to upskill in AI engineering on DataCamp!",
reasoning={"effort": "none"}
)
# Extract the ID from response1
conversation_id = ____
print("Initial post:", response1.output_text)