From 854e4e2bcf53cddd7e4b6880394964d632bee285 Mon Sep 17 00:00:00 2001 From: Kevin Li Date: Sun, 15 Mar 2026 17:04:49 -0700 Subject: [PATCH] Fix dspy task 8563: update TOOL_CALL_TEST_CASES in features 2-6 test patches The combined.patch changes ToolCalls.format() return type from list to dict when no metadata is present. Feature 1's test patch correctly updates TOOL_CALL_TEST_CASES and format_from_dict_list assertions, but features 2-6 test patches do not. Since each feature's tests run against the full merged implementation (which includes the format() change), features 2-6 tests fail on the pre-existing test_tool_calls_format_basic[tool_calls_data0-expected0]. Add the same expectation updates (import fix, TOOL_CALL_TEST_CASES dict format, format_from_dict_list assertions) to all 5 remaining feature test patches. --- .../dspy_task/task8563/feature2/tests.patch | 70 ++++++++++++++++++- .../dspy_task/task8563/feature3/tests.patch | 70 ++++++++++++++++++- .../dspy_task/task8563/feature4/tests.patch | 70 ++++++++++++++++++- .../dspy_task/task8563/feature5/tests.patch | 70 ++++++++++++++++++- .../dspy_task/task8563/feature6/tests.patch | 70 ++++++++++++++++++- 5 files changed, 345 insertions(+), 5 deletions(-) diff --git a/dataset/dspy_task/task8563/feature2/tests.patch b/dataset/dspy_task/task8563/feature2/tests.patch index 313b075..3f18a63 100644 --- a/dataset/dspy_task/task8563/feature2/tests.patch +++ b/dataset/dspy_task/task8563/feature2/tests.patch @@ -2,7 +2,75 @@ diff --git a/tests/adapters/test_tool.py b/tests/adapters/test_tool.py index 18571453..8b16200b 100644 --- a/tests/adapters/test_tool.py +++ b/tests/adapters/test_tool.py -@@ -444,6 +444,81 @@ def test_tool_calls_format_basic(tool_calls_data, expected): +@@ -5,7 +5,7 @@ import pytest + from pydantic import BaseModel + + import dspy +-from dspy.adapters.types.tool import Tool, ToolCalls ++from dspy.adapters.types.tool import Tool, ToolCalls, convert_input_schema_to_tool_args + + + # Test fixtures +@@ -394,42 +394,33 @@ def test_async_tool_call_in_sync_mode(): + + + TOOL_CALL_TEST_CASES = [ +- ([], [{"type": "tool_calls", "tool_calls": []}]), ++ ([], {"tool_calls": []}), + ( + [{"name": "search", "args": {"query": "hello"}}], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [{"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}], +- } +- ], ++ { ++ "tool_calls": [{"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}], ++ }, + ), + ( + [ + {"name": "search", "args": {"query": "hello"}}, + {"name": "translate", "args": {"text": "world", "lang": "fr"}}, + ], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [ +- {"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}, +- { +- "type": "function", +- "function": {"name": "translate", "arguments": {"text": "world", "lang": "fr"}}, +- }, +- ], +- } +- ], ++ { ++ "tool_calls": [ ++ {"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}, ++ { ++ "type": "function", ++ "function": {"name": "translate", "arguments": {"text": "world", "lang": "fr"}}, ++ }, ++ ], ++ }, + ), + ( + [{"name": "get_time", "args": {}}], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [{"type": "function", "function": {"name": "get_time", "arguments": {}}}], +- } +- ], ++ { ++ "tool_calls": [{"type": "function", "function": {"name": "get_time", "arguments": {}}}], ++ }, + ), + ] + +@@ -444,6 +435,81 @@ def test_tool_calls_format_basic(tool_calls_data, expected): assert result == expected diff --git a/dataset/dspy_task/task8563/feature3/tests.patch b/dataset/dspy_task/task8563/feature3/tests.patch index 2bfaac6..836270e 100644 --- a/dataset/dspy_task/task8563/feature3/tests.patch +++ b/dataset/dspy_task/task8563/feature3/tests.patch @@ -2,7 +2,75 @@ diff --git a/tests/adapters/test_tool.py b/tests/adapters/test_tool.py index 18571453..26eb0028 100644 --- a/tests/adapters/test_tool.py +++ b/tests/adapters/test_tool.py -@@ -434,6 +434,117 @@ TOOL_CALL_TEST_CASES = [ +@@ -5,7 +5,7 @@ import pytest + from pydantic import BaseModel + + import dspy +-from dspy.adapters.types.tool import Tool, ToolCalls ++from dspy.adapters.types.tool import Tool, ToolCalls, convert_input_schema_to_tool_args + + + # Test fixtures +@@ -394,42 +394,33 @@ def test_async_tool_call_in_sync_mode(): + + + TOOL_CALL_TEST_CASES = [ +- ([], [{"type": "tool_calls", "tool_calls": []}]), ++ ([], {"tool_calls": []}), + ( + [{"name": "search", "args": {"query": "hello"}}], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [{"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}], +- } +- ], ++ { ++ "tool_calls": [{"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}], ++ }, + ), + ( + [ + {"name": "search", "args": {"query": "hello"}}, + {"name": "translate", "args": {"text": "world", "lang": "fr"}}, + ], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [ +- {"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}, +- { +- "type": "function", +- "function": {"name": "translate", "arguments": {"text": "world", "lang": "fr"}}, +- }, +- ], +- } +- ], ++ { ++ "tool_calls": [ ++ {"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}, ++ { ++ "type": "function", ++ "function": {"name": "translate", "arguments": {"text": "world", "lang": "fr"}}, ++ }, ++ ], ++ }, + ), + ( + [{"name": "get_time", "args": {}}], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [{"type": "function", "function": {"name": "get_time", "arguments": {}}}], +- } +- ], ++ { ++ "tool_calls": [{"type": "function", "function": {"name": "get_time", "arguments": {}}}], ++ }, + ), + ] + +@@ -434,6 +425,117 @@ TOOL_CALL_TEST_CASES = [ ] diff --git a/dataset/dspy_task/task8563/feature4/tests.patch b/dataset/dspy_task/task8563/feature4/tests.patch index 7636c21..d5bbef8 100644 --- a/dataset/dspy_task/task8563/feature4/tests.patch +++ b/dataset/dspy_task/task8563/feature4/tests.patch @@ -2,7 +2,75 @@ diff --git a/tests/adapters/test_tool.py b/tests/adapters/test_tool.py index 18571453..183f8725 100644 --- a/tests/adapters/test_tool.py +++ b/tests/adapters/test_tool.py -@@ -170,6 +170,155 @@ def test_tool_from_function_with_pydantic(): +@@ -5,7 +5,7 @@ import pytest + from pydantic import BaseModel + + import dspy +-from dspy.adapters.types.tool import Tool, ToolCalls ++from dspy.adapters.types.tool import Tool, ToolCalls, convert_input_schema_to_tool_args + + + # Test fixtures +@@ -394,42 +394,33 @@ def test_async_tool_call_in_sync_mode(): + + + TOOL_CALL_TEST_CASES = [ +- ([], [{"type": "tool_calls", "tool_calls": []}]), ++ ([], {"tool_calls": []}), + ( + [{"name": "search", "args": {"query": "hello"}}], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [{"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}], +- } +- ], ++ { ++ "tool_calls": [{"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}], ++ }, + ), + ( + [ + {"name": "search", "args": {"query": "hello"}}, + {"name": "translate", "args": {"text": "world", "lang": "fr"}}, + ], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [ +- {"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}, +- { +- "type": "function", +- "function": {"name": "translate", "arguments": {"text": "world", "lang": "fr"}}, +- }, +- ], +- } +- ], ++ { ++ "tool_calls": [ ++ {"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}, ++ { ++ "type": "function", ++ "function": {"name": "translate", "arguments": {"text": "world", "lang": "fr"}}, ++ }, ++ ], ++ }, + ), + ( + [{"name": "get_time", "args": {}}], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [{"type": "function", "function": {"name": "get_time", "arguments": {}}}], +- } +- ], ++ { ++ "tool_calls": [{"type": "function", "function": {"name": "get_time", "arguments": {}}}], ++ }, + ), + ] + +@@ -170,6 +161,155 @@ def test_tool_from_function_with_pydantic(): assert tool.args["model"]["properties"]["field1"]["default"] == "hello" diff --git a/dataset/dspy_task/task8563/feature5/tests.patch b/dataset/dspy_task/task8563/feature5/tests.patch index 8924fbd..b5a2d84 100644 --- a/dataset/dspy_task/task8563/feature5/tests.patch +++ b/dataset/dspy_task/task8563/feature5/tests.patch @@ -2,7 +2,75 @@ diff --git a/tests/adapters/test_tool.py b/tests/adapters/test_tool.py index 18571453..4a34c5e8 100644 --- a/tests/adapters/test_tool.py +++ b/tests/adapters/test_tool.py -@@ -217,6 +217,262 @@ def test_parameter_desc(): +@@ -5,7 +5,7 @@ import pytest + from pydantic import BaseModel + + import dspy +-from dspy.adapters.types.tool import Tool, ToolCalls ++from dspy.adapters.types.tool import Tool, ToolCalls, convert_input_schema_to_tool_args + + + # Test fixtures +@@ -394,42 +394,33 @@ def test_async_tool_call_in_sync_mode(): + + + TOOL_CALL_TEST_CASES = [ +- ([], [{"type": "tool_calls", "tool_calls": []}]), ++ ([], {"tool_calls": []}), + ( + [{"name": "search", "args": {"query": "hello"}}], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [{"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}], +- } +- ], ++ { ++ "tool_calls": [{"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}], ++ }, + ), + ( + [ + {"name": "search", "args": {"query": "hello"}}, + {"name": "translate", "args": {"text": "world", "lang": "fr"}}, + ], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [ +- {"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}, +- { +- "type": "function", +- "function": {"name": "translate", "arguments": {"text": "world", "lang": "fr"}}, +- }, +- ], +- } +- ], ++ { ++ "tool_calls": [ ++ {"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}, ++ { ++ "type": "function", ++ "function": {"name": "translate", "arguments": {"text": "world", "lang": "fr"}}, ++ }, ++ ], ++ }, + ), + ( + [{"name": "get_time", "args": {}}], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [{"type": "function", "function": {"name": "get_time", "arguments": {}}}], +- } +- ], ++ { ++ "tool_calls": [{"type": "function", "function": {"name": "get_time", "arguments": {}}}], ++ }, + ), + ] + +@@ -217,6 +208,262 @@ def test_parameter_desc(): assert tool.args["x"]["description"] == "The x parameter" diff --git a/dataset/dspy_task/task8563/feature6/tests.patch b/dataset/dspy_task/task8563/feature6/tests.patch index c2a0c4b..c013d27 100644 --- a/dataset/dspy_task/task8563/feature6/tests.patch +++ b/dataset/dspy_task/task8563/feature6/tests.patch @@ -2,7 +2,75 @@ diff --git a/tests/adapters/test_tool.py b/tests/adapters/test_tool.py index 18571453..f3823a50 100644 --- a/tests/adapters/test_tool.py +++ b/tests/adapters/test_tool.py -@@ -55,6 +55,129 @@ class Note(BaseModel): +@@ -5,7 +5,7 @@ import pytest + from pydantic import BaseModel + + import dspy +-from dspy.adapters.types.tool import Tool, ToolCalls ++from dspy.adapters.types.tool import Tool, ToolCalls, convert_input_schema_to_tool_args + + + # Test fixtures +@@ -394,42 +394,33 @@ def test_async_tool_call_in_sync_mode(): + + + TOOL_CALL_TEST_CASES = [ +- ([], [{"type": "tool_calls", "tool_calls": []}]), ++ ([], {"tool_calls": []}), + ( + [{"name": "search", "args": {"query": "hello"}}], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [{"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}], +- } +- ], ++ { ++ "tool_calls": [{"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}], ++ }, + ), + ( + [ + {"name": "search", "args": {"query": "hello"}}, + {"name": "translate", "args": {"text": "world", "lang": "fr"}}, + ], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [ +- {"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}, +- { +- "type": "function", +- "function": {"name": "translate", "arguments": {"text": "world", "lang": "fr"}}, +- }, +- ], +- } +- ], ++ { ++ "tool_calls": [ ++ {"type": "function", "function": {"name": "search", "arguments": {"query": "hello"}}}, ++ { ++ "type": "function", ++ "function": {"name": "translate", "arguments": {"text": "world", "lang": "fr"}}, ++ }, ++ ], ++ }, + ), + ( + [{"name": "get_time", "args": {}}], +- [ +- { +- "type": "tool_calls", +- "tool_calls": [{"type": "function", "function": {"name": "get_time", "arguments": {}}}], +- } +- ], ++ { ++ "tool_calls": [{"type": "function", "function": {"name": "get_time", "arguments": {}}}], ++ }, + ), + ] + +@@ -55,6 +46,129 @@ class Note(BaseModel): author: str