diff --git a/python/packages/foundry/agent_framework_foundry/_chat_client.py b/python/packages/foundry/agent_framework_foundry/_chat_client.py index 19dddfbe76..135cf1fe42 100644 --- a/python/packages/foundry/agent_framework_foundry/_chat_client.py +++ b/python/packages/foundry/agent_framework_foundry/_chat_client.py @@ -29,6 +29,7 @@ from agent_framework import ( ) from agent_framework._clients import ai_function_to_json_schema_spec from agent_framework.exceptions import ServiceInitializationError +from agent_framework.telemetry import use_telemetry from azure.ai.agents.models import ( AgentsNamedToolChoice, AgentsNamedToolChoiceType, @@ -90,6 +91,7 @@ class FoundrySettings(AFBaseSettings): agent_name: str | None = "UnnamedAgent" +@use_telemetry @use_tool_calling class FoundryChatClient(ChatClientBase): """Azure AI Foundry Chat client.""" diff --git a/python/packages/main/agent_framework/openai/_responses_client.py b/python/packages/main/agent_framework/openai/_responses_client.py index a469ffd0b2..8b678a213a 100644 --- a/python/packages/main/agent_framework/openai/_responses_client.py +++ b/python/packages/main/agent_framework/openai/_responses_client.py @@ -4,12 +4,7 @@ import sys from collections.abc import AsyncIterable, Callable, Mapping, MutableMapping, MutableSequence, Sequence from datetime import datetime from itertools import chain -from typing import Any, Literal - -if sys.version_info >= (3, 12): - from typing import override # type: ignore -else: - from typing_extensions import override # type: ignore[import] +from typing import Any, ClassVar, Literal from openai import AsyncOpenAI, AsyncStream from openai.types.responses.response import Response as OpenAIResponse @@ -44,17 +39,26 @@ from .._types import ( UsageDetails, ) from ..exceptions import ServiceInitializationError, ServiceInvalidResponseError +from ..telemetry import use_telemetry from ._shared import OpenAIConfigBase, OpenAIHandler, OpenAIModelTypes, OpenAISettings +if sys.version_info >= (3, 12): + from typing import override # type: ignore # pragma: no cover +else: + from typing_extensions import override # type: ignore[import] # pragma: no cover + __all__ = ["OpenAIResponsesClient"] # region ResponsesClient +@use_telemetry @use_tool_calling class OpenAIResponsesClient(OpenAIConfigBase, ChatClientBase, OpenAIHandler): """OpenAI Responses client class.""" + MODEL_PROVIDER_NAME: ClassVar[str] = "openai" # type: ignore[reportIncompatibleVariableOverride, misc] + def __init__( self, ai_model_id: str | None = None,