Skip to content

Commit b084d04

Browse files
authored
Python: (foundry): stop emitting [TOOLBOXES] warning for every FoundryChatClient call (#5440)
* Python: Foundry: make response tool sanitizer internal, drop TOOLBOXES warning sanitize_foundry_response_tool runs on every tool passed to the Foundry Responses API, so its @experimental(TOOLBOXES) decorator was emitting a [TOOLBOXES] ExperimentalWarning for any FoundryChatClient call, even when no toolbox was involved. The function isn't in __all__ and has no external callers. Rename to _sanitize_foundry_response_tool and drop the decorator; the actual toolbox-facing public helpers remain gated. * Python: Foundry: silence pyright on intentional cross-module private import
1 parent 5fe8941 commit b084d04

3 files changed

Lines changed: 5 additions & 6 deletions

File tree

python/packages/foundry/agent_framework_foundry/_agent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from azure.core.credentials import TokenCredential
3535
from azure.core.credentials_async import AsyncTokenCredential
3636

37-
from ._tools import sanitize_foundry_response_tool
37+
from ._tools import _sanitize_foundry_response_tool # pyright: ignore[reportPrivateUsage]
3838

3939
if sys.version_info >= (3, 13):
4040
from typing import TypeVar # type: ignore # pragma: no cover
@@ -321,7 +321,7 @@ def _prepare_tools_for_openai(
321321
surface.
322322
"""
323323
response_tools = super()._prepare_tools_for_openai(tools)
324-
return [sanitize_foundry_response_tool(tool_item) for tool_item in response_tools]
324+
return [_sanitize_foundry_response_tool(tool_item) for tool_item in response_tools]
325325

326326
def _prepare_messages_for_azure_ai(self, messages: Sequence[Message]) -> tuple[list[Message], str | None]:
327327
"""Extract system/developer messages as instructions for Azure AI.

python/packages/foundry/agent_framework_foundry/_chat_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
from azure.core.credentials import TokenCredential
3434
from azure.core.credentials_async import AsyncTokenCredential
3535

36-
from ._tools import fetch_toolbox, sanitize_foundry_response_tool
36+
from ._tools import _sanitize_foundry_response_tool, fetch_toolbox # pyright: ignore[reportPrivateUsage]
3737

3838
if sys.version_info >= (3, 13):
3939
from typing import TypeVar # type: ignore # pragma: no cover
@@ -235,7 +235,7 @@ def _prepare_tools_for_openai(
235235
them downstream.
236236
"""
237237
response_tools = super()._prepare_tools_for_openai(tools)
238-
return [sanitize_foundry_response_tool(tool_item) for tool_item in response_tools]
238+
return [_sanitize_foundry_response_tool(tool_item) for tool_item in response_tools]
239239

240240
async def configure_azure_monitor(
241241
self,

python/packages/foundry/agent_framework_foundry/_tools.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,7 @@ def _validate_hosted_tool_payload(sanitized: Mapping[str, Any]) -> None:
155155
)
156156

157157

158-
@experimental(feature_id=ExperimentalFeature.TOOLBOXES)
159-
def sanitize_foundry_response_tool(tool_item: Any) -> Any:
158+
def _sanitize_foundry_response_tool(tool_item: Any) -> Any: # pyright: ignore[reportUnusedFunction]
160159
"""Return a Responses-API-safe tool payload for Foundry hosted tools.
161160
162161
Reconciles known mismatches between toolbox reads and the Responses API:

0 commit comments

Comments
 (0)