Skip to content

Commit 8326dd9

Browse files
authoredMar 11, 2025
Merge pull request #32 from openai/rm/sdk_bump
Bump open AI sdk version pin to openai 1.66.2, update tests make computer use example less verbose
2 parents 96dd792 + 37577d3 commit 8326dd9

10 files changed

+33
-28
lines changed
 

‎examples/tools/computer_use.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import asyncio
22
import base64
3-
import logging
43
from typing import Literal, Union
54

65
from playwright.async_api import Browser, Page, Playwright, async_playwright
@@ -16,8 +15,10 @@
1615
trace,
1716
)
1817

19-
logging.getLogger("openai.agents").setLevel(logging.DEBUG)
20-
logging.getLogger("openai.agents").addHandler(logging.StreamHandler())
18+
# Uncomment to see very verbose logs
19+
# import logging
20+
# logging.getLogger("openai.agents").setLevel(logging.DEBUG)
21+
# logging.getLogger("openai.agents").addHandler(logging.StreamHandler())
2122

2223

2324
async def main():

‎pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "openai-agents"
3-
version = "0.0.2"
3+
version = "0.0.3"
44
description = "OpenAI Agents SDK"
55
readme = "README.md"
66
requires-python = ">=3.9"
@@ -9,7 +9,7 @@ authors = [
99
{ name = "OpenAI", email = "support@openai.com" },
1010
]
1111
dependencies = [
12-
"openai>=1.66.0",
12+
"openai>=1.66.2",
1313
"pydantic>=2.10, <3",
1414
"griffe>=1.5.6, <2",
1515
"typing-extensions>=4.12.2, <5",

‎src/agents/_run_impl.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
ActionWait,
2424
)
2525
from openai.types.responses.response_input_param import ComputerCallOutput
26-
from openai.types.responses.response_output_item import Reasoning
26+
from openai.types.responses.response_reasoning_item import ResponseReasoningItem
2727

2828
from . import _utils
2929
from .agent import Agent
@@ -288,7 +288,7 @@ def process_model_response(
288288
items.append(ToolCallItem(raw_item=output, agent=agent))
289289
elif isinstance(output, ResponseFunctionWebSearch):
290290
items.append(ToolCallItem(raw_item=output, agent=agent))
291-
elif isinstance(output, Reasoning):
291+
elif isinstance(output, ResponseReasoningItem):
292292
items.append(ReasoningItem(raw_item=output, agent=agent))
293293
elif isinstance(output, ResponseComputerToolCall):
294294
items.append(ToolCallItem(raw_item=output, agent=agent))

‎src/agents/items.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
ResponseStreamEvent,
2020
)
2121
from openai.types.responses.response_input_item_param import ComputerCallOutput, FunctionCallOutput
22-
from openai.types.responses.response_output_item import Reasoning
22+
from openai.types.responses.response_reasoning_item import ResponseReasoningItem
2323
from pydantic import BaseModel
2424
from typing_extensions import TypeAlias
2525

@@ -136,10 +136,10 @@ class ToolCallOutputItem(RunItemBase[Union[FunctionCallOutput, ComputerCallOutpu
136136

137137

138138
@dataclass
139-
class ReasoningItem(RunItemBase[Reasoning]):
139+
class ReasoningItem(RunItemBase[ResponseReasoningItem]):
140140
"""Represents a reasoning item."""
141141

142-
raw_item: Reasoning
142+
raw_item: ResponseReasoningItem
143143
"""The raw reasoning item."""
144144

145145
type: Literal["reasoning_item"] = "reasoning_item"

‎src/agents/models/openai_responses.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ def _convert_tool(cls, tool: Tool) -> tuple[ToolParam, IncludeLiteral | None]:
361361
includes = "file_search_call.results" if tool.include_search_results else None
362362
elif isinstance(tool, ComputerTool):
363363
converted_tool = {
364-
"type": "computer-preview",
364+
"type": "computer_use_preview",
365365
"environment": tool.computer.environment,
366366
"display_width": tool.computer.dimensions[0],
367367
"display_height": tool.computer.dimensions[1],

‎src/agents/tool.py

+2
Original file line numberDiff line numberDiff line change
@@ -284,3 +284,5 @@ def decorator(real_func: ToolFunction[...]) -> FunctionTool:
284284
return _create_function_tool(real_func)
285285

286286
return decorator
287+
return decorator
288+
return decorator

‎tests/test_items_helpers.py

+9-7
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
from openai.types.responses.response_function_tool_call_param import ResponseFunctionToolCallParam
1414
from openai.types.responses.response_function_web_search import ResponseFunctionWebSearch
1515
from openai.types.responses.response_function_web_search_param import ResponseFunctionWebSearchParam
16-
from openai.types.responses.response_input_item_param import Reasoning as ReasoningInputParam
17-
from openai.types.responses.response_output_item import Reasoning, ReasoningContent
1816
from openai.types.responses.response_output_message import ResponseOutputMessage
1917
from openai.types.responses.response_output_message_param import ResponseOutputMessageParam
2018
from openai.types.responses.response_output_refusal import ResponseOutputRefusal
2119
from openai.types.responses.response_output_text import ResponseOutputText
20+
from openai.types.responses.response_reasoning_item import ResponseReasoningItem, Summary
21+
from openai.types.responses.response_reasoning_item_param import ResponseReasoningItemParam
2222

2323
from agents import (
2424
Agent,
@@ -129,7 +129,7 @@ def test_text_message_outputs_across_list_of_runitems() -> None:
129129
item1: RunItem = MessageOutputItem(agent=Agent(name="test"), raw_item=message1)
130130
item2: RunItem = MessageOutputItem(agent=Agent(name="test"), raw_item=message2)
131131
# Create a non-message run item of a different type, e.g., a reasoning trace.
132-
reasoning = Reasoning(id="rid", content=[], type="reasoning")
132+
reasoning = ResponseReasoningItem(id="rid", summary=[], type="reasoning")
133133
non_message_item: RunItem = ReasoningItem(agent=Agent(name="test"), raw_item=reasoning)
134134
# Confirm only the message outputs are concatenated.
135135
assert ItemHelpers.text_message_outputs([item1, non_message_item, item2]) == "foobar"
@@ -266,16 +266,18 @@ def test_to_input_items_for_computer_call_click() -> None:
266266

267267
def test_to_input_items_for_reasoning() -> None:
268268
"""A reasoning output should produce the same dict as a reasoning input item."""
269-
rc = ReasoningContent(text="why", type="reasoning_summary")
270-
reasoning = Reasoning(id="rid1", content=[rc], type="reasoning")
269+
rc = Summary(text="why", type="summary_text")
270+
reasoning = ResponseReasoningItem(id="rid1", summary=[rc], type="reasoning")
271271
resp = ModelResponse(output=[reasoning], usage=Usage(), referenceable_id=None)
272272
input_items = resp.to_input_items()
273273
assert isinstance(input_items, list) and len(input_items) == 1
274274
converted_dict = input_items[0]
275275

276-
expected: ReasoningInputParam = {
276+
expected: ResponseReasoningItemParam = {
277277
"id": "rid1",
278-
"content": [{"text": "why", "type": "reasoning_summary"}],
278+
"summary": [{"text": "why", "type": "summary_text"}],
279279
"type": "reasoning",
280280
}
281+
print(converted_dict)
282+
print(expected)
281283
assert converted_dict == expected

‎tests/test_openai_responses_converter.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def drag(self, path: list[tuple[int, int]]) -> None:
163163
assert "function" in types
164164
assert "file_search" in types
165165
assert "web_search_preview" in types
166-
assert "computer-preview" in types
166+
assert "computer_use_preview" in types
167167
# Verify file search tool contains max_num_results and vector_store_ids
168168
file_params = next(ct for ct in converted.tools if ct["type"] == "file_search")
169169
assert file_params.get("max_num_results") == file_tool.max_num_results
@@ -173,7 +173,7 @@ def drag(self, path: list[tuple[int, int]]) -> None:
173173
assert web_params.get("user_location") == web_tool.user_location
174174
assert web_params.get("search_context_size") == web_tool.search_context_size
175175
# Verify computer tool contains environment and computed dimensions
176-
comp_params = next(ct for ct in converted.tools if ct["type"] == "computer-preview")
176+
comp_params = next(ct for ct in converted.tools if ct["type"] == "computer_use_preview")
177177
assert comp_params.get("environment") == "mac"
178178
assert comp_params.get("display_width") == 800
179179
assert comp_params.get("display_height") == 600

‎tests/test_run_step_processing.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
ResponseFunctionWebSearch,
88
)
99
from openai.types.responses.response_computer_tool_call import ActionClick
10-
from openai.types.responses.response_output_item import Reasoning, ReasoningContent
10+
from openai.types.responses.response_reasoning_item import ResponseReasoningItem, Summary
1111
from pydantic import BaseModel
1212

1313
from agents import (
@@ -287,8 +287,8 @@ def test_function_web_search_tool_call_parsed_correctly():
287287
def test_reasoning_item_parsed_correctly():
288288
# Verify that a Reasoning output item is converted into a ReasoningItem.
289289

290-
reasoning = Reasoning(
291-
id="r1", type="reasoning", content=[ReasoningContent(text="why", type="reasoning_summary")]
290+
reasoning = ResponseReasoningItem(
291+
id="r1", type="reasoning", summary=[Summary(text="why", type="summary_text")]
292292
)
293293
response = ModelResponse(
294294
output=[reasoning],

‎uv.lock

+5-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)