|
13 | 13 | from openai.types.responses.response_function_tool_call_param import ResponseFunctionToolCallParam
|
14 | 14 | from openai.types.responses.response_function_web_search import ResponseFunctionWebSearch
|
15 | 15 | 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 |
18 | 16 | from openai.types.responses.response_output_message import ResponseOutputMessage
|
19 | 17 | from openai.types.responses.response_output_message_param import ResponseOutputMessageParam
|
20 | 18 | from openai.types.responses.response_output_refusal import ResponseOutputRefusal
|
21 | 19 | 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 |
22 | 22 |
|
23 | 23 | from agents import (
|
24 | 24 | Agent,
|
@@ -129,7 +129,7 @@ def test_text_message_outputs_across_list_of_runitems() -> None:
|
129 | 129 | item1: RunItem = MessageOutputItem(agent=Agent(name="test"), raw_item=message1)
|
130 | 130 | item2: RunItem = MessageOutputItem(agent=Agent(name="test"), raw_item=message2)
|
131 | 131 | # 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") |
133 | 133 | non_message_item: RunItem = ReasoningItem(agent=Agent(name="test"), raw_item=reasoning)
|
134 | 134 | # Confirm only the message outputs are concatenated.
|
135 | 135 | 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:
|
266 | 266 |
|
267 | 267 | def test_to_input_items_for_reasoning() -> None:
|
268 | 268 | """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") |
271 | 271 | resp = ModelResponse(output=[reasoning], usage=Usage(), referenceable_id=None)
|
272 | 272 | input_items = resp.to_input_items()
|
273 | 273 | assert isinstance(input_items, list) and len(input_items) == 1
|
274 | 274 | converted_dict = input_items[0]
|
275 | 275 |
|
276 |
| - expected: ReasoningInputParam = { |
| 276 | + expected: ResponseReasoningItemParam = { |
277 | 277 | "id": "rid1",
|
278 |
| - "content": [{"text": "why", "type": "reasoning_summary"}], |
| 278 | + "summary": [{"text": "why", "type": "summary_text"}], |
279 | 279 | "type": "reasoning",
|
280 | 280 | }
|
| 281 | + print(converted_dict) |
| 282 | + print(expected) |
281 | 283 | assert converted_dict == expected
|
0 commit comments