Skip to content

Commit 2deeb25

Browse files
committed
Remove untestable deferred_tool_results parameter from adapter methods
1 parent 676530b commit 2deeb25

File tree

2 files changed

+1
-24
lines changed

2 files changed

+1
-24
lines changed

pydantic_ai_slim/pydantic_ai/ui/_adapter.py

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,6 @@ def run_stream_native(
215215
*,
216216
output_type: OutputSpec[Any] | None = None,
217217
message_history: Sequence[ModelMessage] | None = None,
218-
deferred_tool_results: DeferredToolResults | None = None,
219218
model: Model | KnownModelName | str | None = None,
220219
instructions: Instructions[AgentDepsT] = None,
221220
deps: AgentDepsT = None,
@@ -232,7 +231,6 @@ def run_stream_native(
232231
output_type: Custom output type to use for this run, `output_type` may only be used if the agent has no
233232
output validators since output validators would expect an argument that matches the agent's output type.
234233
message_history: History of the conversation so far.
235-
deferred_tool_results: Optional results for deferred tool calls in the message history.
236234
model: Optional model to use for this run, required if `model` was not set when creating the agent.
237235
instructions: Optional additional instructions to use for this run.
238236
deps: Optional dependencies to use for this run.
@@ -243,10 +241,6 @@ def run_stream_native(
243241
toolsets: Optional additional toolsets for this run.
244242
builtin_tools: Optional additional builtin tools to use for this run.
245243
"""
246-
# Use instance field as fallback if not explicitly passed
247-
if deferred_tool_results is None:
248-
deferred_tool_results = self.deferred_tool_results
249-
250244
message_history = [*(message_history or []), *self.messages]
251245

252246
toolset = self.toolset
@@ -272,7 +266,7 @@ def run_stream_native(
272266
return self.agent.run_stream_events(
273267
output_type=output_type,
274268
message_history=message_history,
275-
deferred_tool_results=deferred_tool_results,
269+
deferred_tool_results=self.deferred_tool_results,
276270
model=model,
277271
deps=deps,
278272
model_settings=model_settings,
@@ -289,7 +283,6 @@ def run_stream(
289283
*,
290284
output_type: OutputSpec[Any] | None = None,
291285
message_history: Sequence[ModelMessage] | None = None,
292-
deferred_tool_results: DeferredToolResults | None = None,
293286
model: Model | KnownModelName | str | None = None,
294287
instructions: Instructions[AgentDepsT] = None,
295288
deps: AgentDepsT = None,
@@ -307,7 +300,6 @@ def run_stream(
307300
output_type: Custom output type to use for this run, `output_type` may only be used if the agent has no
308301
output validators since output validators would expect an argument that matches the agent's output type.
309302
message_history: History of the conversation so far.
310-
deferred_tool_results: Optional results for deferred tool calls in the message history.
311303
model: Optional model to use for this run, required if `model` was not set when creating the agent.
312304
instructions: Optional additional instructions to use for this run.
313305
deps: Optional dependencies to use for this run.
@@ -324,7 +316,6 @@ def run_stream(
324316
self.run_stream_native(
325317
output_type=output_type,
326318
message_history=message_history,
327-
deferred_tool_results=deferred_tool_results,
328319
model=model,
329320
instructions=instructions,
330321
deps=deps,
@@ -345,7 +336,6 @@ async def dispatch_request(
345336
*,
346337
agent: AbstractAgent[DispatchDepsT, DispatchOutputDataT],
347338
message_history: Sequence[ModelMessage] | None = None,
348-
deferred_tool_results: DeferredToolResults | None = None,
349339
model: Model | KnownModelName | str | None = None,
350340
instructions: Instructions[DispatchDepsT] = None,
351341
deps: DispatchDepsT = None,
@@ -366,7 +356,6 @@ async def dispatch_request(
366356
output_type: Custom output type to use for this run, `output_type` may only be used if the agent has no
367357
output validators since output validators would expect an argument that matches the agent's output type.
368358
message_history: History of the conversation so far.
369-
deferred_tool_results: Optional results for deferred tool calls in the message history.
370359
model: Optional model to use for this run, required if `model` was not set when creating the agent.
371360
instructions: Optional additional instructions to use for this run.
372361
deps: Optional dependencies to use for this run.
@@ -406,7 +395,6 @@ async def dispatch_request(
406395
return adapter.streaming_response(
407396
adapter.run_stream(
408397
message_history=message_history,
409-
deferred_tool_results=deferred_tool_results,
410398
deps=deps,
411399
output_type=output_type,
412400
model=model,

tests/test_vercel_ai.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3163,14 +3163,3 @@ async def test_adapter_dump_messages_with_cache_point():
31633163
}
31643164
]
31653165
)
3166-
3167-
3168-
def starlette_import_successful() -> bool:
3169-
"""Check if starlette is installed."""
3170-
try:
3171-
from starlette.requests import Request
3172-
3173-
assert Request # Verify the import succeeded
3174-
return True
3175-
except ImportError:
3176-
return False

0 commit comments

Comments
 (0)