Skip to content

Commit 0a13ef7

Browse files
authored
Revert "[Azure OpenAI] Responses API updates"
1 parent 606f7f6 commit 0a13ef7

File tree

1 file changed

+21
-94
lines changed

1 file changed

+21
-94
lines changed

articles/ai-services/openai/how-to/responses.md

Lines changed: 21 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description: Learn how to use Azure OpenAI's new stateful Responses API.
55
manager: nitinme
66
ms.service: azure-ai-openai
77
ms.topic: include
8-
ms.date: 04/23/2025
8+
ms.date: 03/21/2025
99
author: mrbullwinkle
1010
ms.author: mbullwin
1111
ms.custom: references_regions
@@ -56,9 +56,9 @@ Not every model is available in the regions supported by the responses API. Chec
5656
> - Structured outputs
5757
> - tool_choice
5858
> - image_url pointing to an internet address
59-
> - The web search tool is also not supported, and isn't part of the `2025-03-01-preview` API.
59+
> - The web search tool is also not supported, and is not part of the `2025-03-01-preview` API.
6060
>
61-
> There's also a known issue with vision performance when using the Responses API, particularly with OCR tasks. As a temporary workaround set image detail to `high`. This article will be updated once this issue is resolved and as any additional feature support is added.
61+
> There is also a known issue with vision performance when using the Responses API, particularly with OCR tasks. As a temporary workaround set image detail to `high`. This article will be updated once this issue is resolved and as any additional feature support is added.
6262
6363

6464
### Reference documentation
@@ -96,16 +96,6 @@ response = client.responses.create(
9696
input="This is a test."
9797
#truncation="auto" required when using computer-use-preview model.
9898

99-
response_id = response.id
100-
response_status = response.status
101-
102-
103-
print(f"\n Response ID: {response_id}")
104-
print(f"\n Response Status: {response_status}\n")
105-
106-
print(response.model_dump_json(indent=2))
107-
108-
10999
)
110100
```
111101

@@ -128,15 +118,6 @@ response = client.responses.create(
128118
input="This is a test."
129119
#truncation="auto" required when using computer-use-preview model.
130120

131-
response_id = response.id
132-
response_status = response.status
133-
134-
135-
print(f"\n Response ID: {response_id}")
136-
print(f"\n Response Status: {response_status}\n")
137-
138-
print(response.model_dump_json(indent=2))
139-
140121
)
141122
```
142123

@@ -171,111 +152,57 @@ curl -X POST https://YOUR-RESOURCE-NAME.openai.azure.com/openai/responses?api-ve
171152
**Output:**
172153

173154
```json
174-
Response ID: resp_680915b58140819085f4c55454402f3600400b1e6ec996fc
175-
176-
Response Status: completed
177-
178155
{
179-
"id": "resp_680915b58140819085f4c55454402f3600400b1e6ec996fc",
180-
"created_at": 1745425845.0,
156+
"id": "resp_67cb32528d6881909eb2859a55e18a85",
157+
"created_at": 1741369938.0,
181158
"error": null,
182159
"incomplete_details": null,
183160
"instructions": null,
184161
"metadata": {},
185-
"model": "gpt-4o",
162+
"model": "gpt-4o-2024-08-06",
186163
"object": "response",
187164
"output": [
188165
{
189-
"id": "msg_680915b5c8dc8190b21a72a55830fea900400b1e6ec996fc",
166+
"id": "msg_67cb3252cfac8190865744873aada798",
190167
"content": [
191168
{
192169
"annotations": [],
193-
"text": "It looks like you're testing out how this works! How can I assist you today?",
170+
"text": "Great! How can I help you today?",
194171
"type": "output_text"
195172
}
196173
],
197174
"role": "assistant",
198-
"status": "completed",
175+
"status": null,
199176
"type": "message"
200177
}
201178
],
202-
"parallel_tool_calls": true,
179+
"output_text": "Great! How can I help you today?",
180+
"parallel_tool_calls": null,
203181
"temperature": 1.0,
204-
"tool_choice": "auto",
182+
"tool_choice": null,
205183
"tools": [],
206184
"top_p": 1.0,
207185
"max_output_tokens": null,
208186
"previous_response_id": null,
209-
"reasoning": {
210-
"effort": null,
211-
"generate_summary": null,
212-
"summary": null
213-
},
214-
"service_tier": null,
187+
"reasoning": null,
215188
"status": "completed",
216-
"text": {
217-
"format": {
218-
"type": "text"
219-
}
220-
},
221-
"truncation": "disabled",
189+
"text": null,
190+
"truncation": null,
222191
"usage": {
223-
"input_tokens": 12,
224-
"input_tokens_details": {
225-
"cached_tokens": 0
226-
},
227-
"output_tokens": 18,
192+
"input_tokens": 20,
193+
"output_tokens": 11,
228194
"output_tokens_details": {
229195
"reasoning_tokens": 0
230196
},
231-
"total_tokens": 30
197+
"total_tokens": 31
232198
},
233199
"user": null,
234-
"store": true
200+
"reasoning_effort": null
235201
}
236202
```
237203

238204
---
239205

240-
Unlike the chat completions API, the responses API is asynchronous. More complex requests may not be completed by the time that an initial response is returned by the API. This is similar to how the Assistants API handles [thread/run status](/azure/ai-services/openai/how-to/assistant#retrieve-thread-status).
241-
242-
Note in the response output that the response object contains a `status` which can be monitored to determine when the response is finally complete. `status` can contain a value of `completed`, `failed`, `in_progress`, or `incomplete`.
243-
244-
### Retrieve an individual response status
245-
246-
In the previous Python examples we created a variable `response_id` and set it equal to the `response.id` of our `client.response.create()` call. We can then pass client.response.retrieve() to pull the current status of our response.
247-
248-
```python
249-
250-
retrieve_response = client.responses.retrieve(response_id)
251-
print(retrieve_response.status)
252-
```
253-
254-
### Monitor response status
255-
256-
Depending on the complexity of your request it isn't uncommon to have an initial response with a status of `in_progress` with message output not yet generated. In that case you can create a loop to monitor the status of the response with code. The example below is for demonstration purposes only and is intended to be run in a Jupyter notebook. This code assumes you have already run the two previous Python examples and the Azure OpenAI client as well as `retrieve_response` have already been defined:
257-
258-
```python
259-
import time
260-
from IPython.display import clear_output
261-
262-
start_time = time.time()
263-
264-
status = retrieve_response.status
265-
266-
while status not in ["completed", "failed", "incomplete"]:
267-
time.sleep(5)
268-
retrieve_response = client.responses.retrieve(response_id)
269-
print("Elapsed time: {} minutes {} seconds".format(int((time.time() - start_time) // 60), int((time.time() - start_time) % 60)))
270-
status = retrieve_response.status
271-
print(f'Status: {status}')
272-
clear_output(wait=True)
273-
274-
print(f'Status: {status}')
275-
print("Elapsed time: {} minutes {} seconds".format(int((time.time() - start_time) // 60), int((time.time() - start_time) % 60)))
276-
print(retrieve_response.model_dump_json(indent=2))
277-
```
278-
279206
## Retrieve a response
280207

281208
To retrieve a response from a previous call to the responses API.
@@ -678,7 +605,7 @@ print(response.model_dump_json(indent=2))
678605

679606
## Image input
680607

681-
There's a known issue with image url based image input. Currently only base64 encoded images are supported.
608+
There is a known issue with image url based image input. Currently only base64 encoded images are supported.
682609

683610
### Image url
684611

@@ -958,7 +885,7 @@ async def take_screenshot(page):
958885
return last_successful_screenshot
959886
```
960887

961-
This function captures the current browser state as an image and returns it as a base64-encoded string, ready to be sent to the model. We'll constantly do this in a loop after each step allowing the model to see if the command it tried to execute was successful or not, which then allows it to adjust based on the contents of the screenshot. We could let the model decide if it needs to take a screenshot, but for simplicity we'll force a screenshot to be taken for each iteration.
888+
This function captures the current browser state as an image and returns it as a base64-encoded string, ready to be sent to the model. We'll constantly do this in a loop after each step allowing the model to see if the command it tried to execute was successful or not, which then allows it to adjust based on the contents of the screenshot. We could let the model decide if it needs to take a screenshot, but for simplicity we will force a screenshot to be taken for each iteration.
962889

963890
### Model response processing
964891

0 commit comments

Comments
 (0)