|
11 | 11 | ) |
12 | 12 | from openai.types.responses.response_function_tool_call import ResponseFunctionToolCall |
13 | 13 | from openai.types.responses.response_function_tool_call_param import ResponseFunctionToolCallParam |
14 | | -from openai.types.responses.response_function_web_search import ResponseFunctionWebSearch |
| 14 | +from openai.types.responses.response_function_web_search import ( |
| 15 | + ActionSearch, |
| 16 | + ResponseFunctionWebSearch, |
| 17 | +) |
15 | 18 | from openai.types.responses.response_function_web_search_param import ResponseFunctionWebSearchParam |
16 | 19 | from openai.types.responses.response_output_message import ResponseOutputMessage |
17 | 20 | from openai.types.responses.response_output_message_param import ResponseOutputMessageParam |
@@ -225,14 +228,20 @@ def test_to_input_items_for_file_search_call() -> None: |
225 | 228 |
|
226 | 229 | def test_to_input_items_for_web_search_call() -> None: |
227 | 230 | """A web search tool call output should produce the same dict as a web search input.""" |
228 | | - ws_call = ResponseFunctionWebSearch(id="w1", status="completed", type="web_search_call") |
| 231 | + ws_call = ResponseFunctionWebSearch( |
| 232 | + id="w1", |
| 233 | + action=ActionSearch(type="search", query="query"), |
| 234 | + status="completed", |
| 235 | + type="web_search_call", |
| 236 | + ) |
229 | 237 | resp = ModelResponse(output=[ws_call], usage=Usage(), response_id=None) |
230 | 238 | input_items = resp.to_input_items() |
231 | 239 | assert isinstance(input_items, list) and len(input_items) == 1 |
232 | 240 | expected: ResponseFunctionWebSearchParam = { |
233 | 241 | "id": "w1", |
234 | 242 | "status": "completed", |
235 | 243 | "type": "web_search_call", |
| 244 | + "action": {"type": "search", "query": "query"}, |
236 | 245 | } |
237 | 246 | assert input_items[0] == expected |
238 | 247 |
|
|
0 commit comments