Skip to content

Commit d76d88d

Browse files
committed
updating samples
1 parent c2a12b7 commit d76d88d

File tree

1 file changed

+55
-29
lines changed

1 file changed

+55
-29
lines changed

articles/ai-services/openai/how-to/computer-use.md

Lines changed: 55 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,10 @@ response = client.responses.create(
7777
input=[
7878
{
7979
"role": "user",
80-
"content": "Check the latest OpenAI news on bing.com."
80+
"content": "Check the latest AI news on bing.com."
8181
}
82-
]
82+
],
83+
truncation="auto"
8384
)
8485

8586
print(response.output)
@@ -90,11 +91,11 @@ print(response.output)
9091
```console
9192
[
9293
ResponseComputerToolCall(
93-
id='comp_xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
94+
id='cu_67d841873c1081908bfc88b90a8555e0',
9495
action=ActionScreenshot(type='screenshot'),
95-
call_id=None,
96-
pending_safety_checks=None,
97-
status=None,
96+
call_id='call_wwEnfFDqQr1Z4Edk62Fyo7Nh',
97+
pending_safety_checks=[],
98+
status='completed',
9899
type='computer_call'
99100
)
100101
]
@@ -112,58 +113,81 @@ curl ${MY_ENDPOINT}/openai/responses?api-version=2025-03-01-preview \
112113
{
113114
"type": "message",
114115
"role": "user",
115-
"content": "Search Bing for the latest news in AI."
116-
},
117-
"tools": [{
116+
"content": "Check the latest AI news on bing.com."
117+
}
118+
],
119+
"tools": [{
118120
"type": "computer-preview",
119121
"display_width": 1024,
120122
"display_height": 768,
121-
"environment": "browser" # other possible values: "mac", "windows", "ubuntu"
122-
}]
123-
]
123+
"environment": "browser"
124+
}],
125+
"truncation":"auto"
124126
}'
125127
```
126128

127129
### Output
128130

129131
```json
130132
{
131-
"id": "resp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
133+
"id": "resp_xxxxxxxxxxxxxxxxxxxxxxxx",
132134
"object": "response",
133-
"created_at": 1741716005,
135+
"created_at": 1742227653,
134136
"status": "completed",
135-
"model": "computer-use-preview-2025-02-11",
136-
"previous_response_id": null,
137+
"error": null,
138+
"incomplete_details": null,
139+
"instructions": null,
140+
"max_output_tokens": null,
141+
"model": "computer-use-preview",
137142
"output": [
138143
{
139144
"type": "computer_call",
140-
"id": "comp_xxxxxxxxxxxxxxxxxxxx",
145+
"id": "cu_xxxxxxxxxxxxxxxxxxxxxxxxxx",
146+
"call_id": "call_xxxxxxxxxxxxxxxxxxxxxxx",
141147
"action": {
142148
"type": "screenshot"
143-
}
149+
},
150+
"pending_safety_checks": [],
151+
"status": "completed"
144152
}
145153
],
146-
"error": null,
154+
"parallel_tool_calls": true,
155+
"previous_response_id": null,
156+
"reasoning": {
157+
"effort": "medium",
158+
"generate_summary": null
159+
},
160+
"store": true,
161+
"temperature": 1.0,
162+
"text": {
163+
"format": {
164+
"type": "text"
165+
}
166+
},
147167
"tools": [
148168
{
149-
"type": "computer-preview",
150-
"environment": "browser",
169+
"type": "computer_use_preview",
170+
"display_height": 768,
151171
"display_width": 1024,
152-
"display_height": 768
172+
"environment": "browser"
153173
}
154174
],
155175
"top_p": 1.0,
156-
"temperature": 1.0,
157-
"reasoning_effort": null,
176+
"truncation": "auto",
158177
"usage": {
159-
"input_tokens": 510,
178+
"input_tokens": 519,
179+
"input_tokens_details": {
180+
"cached_tokens": 0
181+
},
160182
"output_tokens": 7,
161-
"total_tokens": 517,
162183
"output_tokens_details": {
163184
"reasoning_tokens": 0
164-
}
185+
},
186+
"total_tokens": 526
165187
},
188+
"user": null,
166189
"metadata": {}
190+
}
167191
```
168192

169193
---
@@ -207,7 +231,8 @@ response_2 = client.responses.create(
207231
"image_url": f"data:image/png;base64,{<base64_string>}"
208232
}
209233
}
210-
]
234+
],
235+
truncation="auto"
211236
)
212237
```
213238

@@ -235,7 +260,8 @@ curl ${MY_ENDPOINT}/openai/responses?api-version=2025-03-01-preview \
235260
"image_url": "<base64_string>"
236261
}
237262
}
238-
]
263+
],
264+
"truncation":"auto"
239265
}'
240266
```
241267

0 commit comments

Comments
 (0)