Skip to content

Commit 3b7855a

Browse files
committed
fix native tools
1 parent 43e90db commit 3b7855a

2 files changed

Lines changed: 5 additions & 4 deletions

File tree

src/utils/pydantic_ai.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
{
2222
"conversation",
2323
"max_infer_iters",
24-
"tools",
2524
"tool_choice",
2625
"include",
2726
"text",
@@ -68,6 +67,8 @@ def _model_settings_from_responses_params(
6867
if responses_params.extra_headers:
6968
settings_dict["extra_headers"] = dict(responses_params.extra_headers)
7069
settings_dict["openai_store"] = responses_params.store
70+
if responses_params.tools is not None:
71+
settings_dict["openai_native_tools"] = responses_params.tools
7172
if responses_params.previous_response_id is not None:
7273
settings_dict["openai_previous_response_id"] = (
7374
responses_params.previous_response_id

tests/unit/utils/test_pydantic_ai.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def minimal_params_fixture(self, mocker: MockerFixture) -> object:
8282
params.parallel_tool_calls = None
8383
params.extra_headers = None
8484
params.store = False
85+
params.tools = None
8586
params.previous_response_id = None
8687
return params
8788

@@ -138,7 +139,6 @@ def test_extra_body_from_lls_fields(self, mocker: MockerFixture) -> None:
138139
"model": "test/model",
139140
"conversation": "conv-123",
140141
"max_infer_iters": 5,
141-
"tools": [{"type": "function"}],
142142
"tool_choice": "auto",
143143
}
144144
params.max_output_tokens = None
@@ -147,14 +147,15 @@ def test_extra_body_from_lls_fields(self, mocker: MockerFixture) -> None:
147147
params.extra_headers = None
148148
params.store = False
149149
params.previous_response_id = None
150+
params.tools = [{"type": "function"}]
150151

151152
settings = _model_settings_from_responses_params(params)
152153

153154
assert "extra_body" in settings
154155
assert settings["extra_body"]["conversation"] == "conv-123"
155156
assert settings["extra_body"]["max_infer_iters"] == 5
156-
assert settings["extra_body"]["tools"] == [{"type": "function"}]
157157
assert settings["extra_body"]["tool_choice"] == "auto"
158+
assert settings["openai_native_tools"] == [{"type": "function"}]
158159

159160
def test_extra_body_only_includes_known_fields(self, mocker: MockerFixture) -> None:
160161
"""Test that extra_body only includes fields in _LLS_RESPONSES_EXTRA_FIELDS."""
@@ -189,7 +190,6 @@ def test_contains_expected_fields(self) -> None:
189190
expected = {
190191
"conversation",
191192
"max_infer_iters",
192-
"tools",
193193
"tool_choice",
194194
"include",
195195
"text",

0 commit comments

Comments
 (0)