Responses Interaction Example
Responses Interaction Example
Section titled “Responses Interaction Example”Back to OpenAI Responses.
This compact example mirrors the detailed Chinese walkthrough. It shows why Responses is item-oriented: hosted tools, function calls, and assistant messages all appear as output items.
- 1
client requestClient sends `input`, a `function` tool, a hosted `web_search` tool, and `stream: true`.
- 2
response.createdThe stream starts a response resource with `status: in_progress`.
- 3
hosted tool events`response.web_search_call.*` events report hosted tool lifecycle by `item_id` and `output_index`.
- 4
function_call item`response.output_item.added` creates a function call item; argument deltas join by `item_id`.
- 5
function_call_outputThe next request sends the local tool result using the function call `call_id`.
- 6
final message itemThe final turn emits a message item, text deltas, `output_text.done`, and `response.completed`.
Join keys
Section titled “Join keys”| Entity | Stable key | Notes |
|---|---|---|
response | response.id | Can connect follow-up calls via previous_response_id. |
output item | item_id plus output_index | item_id is the primary join key for deltas. |
function result | call_id | The client returns tool output with function_call_output.call_id. |
content part | item_id + content_index | Text deltas and done events target one content part. |