Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 69 additions & 1 deletion dataset/dspy_task/task8563/feature2/tests.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
70 changes: 69 additions & 1 deletion dataset/dspy_task/task8563/feature3/tests.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
]


Expand Down
70 changes: 69 additions & 1 deletion dataset/dspy_task/task8563/feature4/tests.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
70 changes: 69 additions & 1 deletion dataset/dspy_task/task8563/feature5/tests.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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"


Expand Down
70 changes: 69 additions & 1 deletion dataset/dspy_task/task8563/feature6/tests.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
Loading