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
8 changes: 4 additions & 4 deletions sdk/ai/azure-ai-projects/azure/ai/projects/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from ._configuration import AIProjectClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import AgentsOperations, ConnectionsOperations, DiagnosticsOperations, EvaluationsOperations
from .operations import AgentsOperations, ConnectionsOperations, EvaluationsOperations, TelemetryOperations

if TYPE_CHECKING:
from azure.core.credentials import TokenCredential
Expand All @@ -29,8 +29,8 @@ class AIProjectClient:
:vartype agents: azure.ai.projects.operations.AgentsOperations
:ivar connections: ConnectionsOperations operations
:vartype connections: azure.ai.projects.operations.ConnectionsOperations
:ivar diagnostics: DiagnosticsOperations operations
:vartype diagnostics: azure.ai.projects.operations.DiagnosticsOperations
:ivar telemetry: TelemetryOperations operations
:vartype telemetry: azure.ai.projects.operations.TelemetryOperations
:ivar evaluations: EvaluationsOperations operations
:vartype evaluations: azure.ai.projects.operations.EvaluationsOperations
:param endpoint: The Azure AI Studio project endpoint, in the form
Expand Down Expand Up @@ -95,7 +95,7 @@ def __init__(
self._serialize.client_side_validation = False
self.agents = AgentsOperations(self._client, self._config, self._serialize, self._deserialize)
self.connections = ConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.diagnostics = DiagnosticsOperations(self._client, self._config, self._serialize, self._deserialize)
self.telemetry = TelemetryOperations(self._client, self._config, self._serialize, self._deserialize)
self.evaluations = EvaluationsOperations(self._client, self._config, self._serialize, self._deserialize)

def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
Expand Down
4 changes: 2 additions & 2 deletions sdk/ai/azure-ai-projects/azure/ai/projects/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from azure.core.pipeline import policies
from ._configuration import AIProjectClientConfiguration
from ._serialization import Deserializer, Serializer
from .operations import AgentsOperations, ConnectionsOperations, EvaluationsOperations, DiagnosticsOperations
from .operations import AgentsOperations, ConnectionsOperations, EvaluationsOperations, TelemetryOperations
from ._client import AIProjectClient as ClientGenerated
from .operations._patch import InferenceOperations

Expand Down Expand Up @@ -185,7 +185,7 @@ def __init__(
self._deserialize = Deserializer()
self._serialize.client_side_validation = False

self.diagnostics = DiagnosticsOperations(
self.telemetry = TelemetryOperations(
self._client0, self._config0, self._serialize, self._deserialize, outer_instance=self
)
self.connections = ConnectionsOperations(self._client1, self._config1, self._serialize, self._deserialize)
Expand Down
8 changes: 4 additions & 4 deletions sdk/ai/azure-ai-projects/azure/ai/projects/aio/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from .._serialization import Deserializer, Serializer
from ._configuration import AIProjectClientConfiguration
from .operations import AgentsOperations, ConnectionsOperations, DiagnosticsOperations, EvaluationsOperations
from .operations import AgentsOperations, ConnectionsOperations, EvaluationsOperations, TelemetryOperations

if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential
Expand All @@ -29,8 +29,8 @@ class AIProjectClient:
:vartype agents: azure.ai.projects.aio.operations.AgentsOperations
:ivar connections: ConnectionsOperations operations
:vartype connections: azure.ai.projects.aio.operations.ConnectionsOperations
:ivar diagnostics: DiagnosticsOperations operations
:vartype diagnostics: azure.ai.projects.aio.operations.DiagnosticsOperations
:ivar telemetry: TelemetryOperations operations
:vartype telemetry: azure.ai.projects.aio.operations.TelemetryOperations
:ivar evaluations: EvaluationsOperations operations
:vartype evaluations: azure.ai.projects.aio.operations.EvaluationsOperations
:param endpoint: The Azure AI Studio project endpoint, in the form
Expand Down Expand Up @@ -95,7 +95,7 @@ def __init__(
self._serialize.client_side_validation = False
self.agents = AgentsOperations(self._client, self._config, self._serialize, self._deserialize)
self.connections = ConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
self.diagnostics = DiagnosticsOperations(self._client, self._config, self._serialize, self._deserialize)
self.telemetry = TelemetryOperations(self._client, self._config, self._serialize, self._deserialize)
self.evaluations = EvaluationsOperations(self._client, self._config, self._serialize, self._deserialize)

def send_request(
Expand Down
4 changes: 2 additions & 2 deletions sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

from .._serialization import Deserializer, Serializer
from ._configuration import AIProjectClientConfiguration
from .operations import AgentsOperations, ConnectionsOperations, EvaluationsOperations, DiagnosticsOperations
from .operations import AgentsOperations, ConnectionsOperations, EvaluationsOperations, TelemetryOperations
from ._client import AIProjectClient as ClientGenerated
from .operations._patch import InferenceOperations

Expand Down Expand Up @@ -184,7 +184,7 @@ def __init__(
self._deserialize = Deserializer()
self._serialize.client_side_validation = False

self.diagnostics = DiagnosticsOperations(
self.telemetry = TelemetryOperations(
self._client0, self._config0, self._serialize, self._deserialize, outer_instance=self
)
self.connections = ConnectionsOperations(self._client1, self._config1, self._serialize, self._deserialize)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from ._operations import AgentsOperations # type: ignore
from ._operations import ConnectionsOperations # type: ignore
from ._operations import DiagnosticsOperations # type: ignore
from ._operations import TelemetryOperations # type: ignore
from ._operations import EvaluationsOperations # type: ignore

from ._patch import __all__ as _patch_all
Expand All @@ -24,7 +24,7 @@
__all__ = [
"AgentsOperations",
"ConnectionsOperations",
"DiagnosticsOperations",
"TelemetryOperations",
"EvaluationsOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@
build_connections_get_connection_with_secrets_request,
build_connections_get_workspace_request,
build_connections_list_connections_request,
build_diagnostics_get_app_insights_request,
build_evaluations_create_or_replace_schedule_request,
build_evaluations_create_request,
build_evaluations_disable_schedule_request,
Expand All @@ -86,6 +85,7 @@
build_evaluations_list_request,
build_evaluations_list_schedule_request,
build_evaluations_update_request,
build_telemetry_get_app_insights_request,
)

if sys.version_info >= (3, 9):
Expand Down Expand Up @@ -5281,14 +5281,14 @@ async def _get_connection_with_secrets(
return deserialized # type: ignore


class DiagnosticsOperations:
class TelemetryOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.

Instead, you should access the following operations through
:class:`~azure.ai.projects.aio.AIProjectClient`'s
:attr:`diagnostics` attribute.
:attr:`telemetry` attribute.
"""

def __init__(self, *args, **kwargs) -> None:
Expand All @@ -5299,7 +5299,9 @@ def __init__(self, *args, **kwargs) -> None:
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")

@distributed_trace_async
async def get_app_insights(self, app_insights_resource_url: str, **kwargs: Any) -> _models.GetAppInsightsResponse:
async def _get_app_insights(
self, app_insights_resource_url: str, **kwargs: Any
) -> _models._models.GetAppInsightsResponse:
# pylint: disable=line-too-long
"""Gets the properties of the specified Application Insights resource.

Expand All @@ -5309,7 +5311,7 @@ async def get_app_insights(self, app_insights_resource_url: str, **kwargs: Any)
Required.
:type app_insights_resource_url: str
:return: GetAppInsightsResponse. The GetAppInsightsResponse is compatible with MutableMapping
:rtype: ~azure.ai.projects.models.GetAppInsightsResponse
:rtype: ~azure.ai.projects.models._models.GetAppInsightsResponse
:raises ~azure.core.exceptions.HttpResponseError:
"""
error_map: MutableMapping = {
Expand All @@ -5323,9 +5325,9 @@ async def get_app_insights(self, app_insights_resource_url: str, **kwargs: Any)
_headers = kwargs.pop("headers", {}) or {}
_params = kwargs.pop("params", {}) or {}

cls: ClsType[_models.GetAppInsightsResponse] = kwargs.pop("cls", None)
cls: ClsType[_models._models.GetAppInsightsResponse] = kwargs.pop("cls", None)

_request = build_diagnostics_get_app_insights_request(
_request = build_telemetry_get_app_insights_request(
app_insights_resource_url=app_insights_resource_url,
api_version=self._config.api_version,
headers=_headers,
Expand Down Expand Up @@ -5360,7 +5362,9 @@ async def get_app_insights(self, app_insights_resource_url: str, **kwargs: Any)
if _stream:
deserialized = response.iter_bytes()
else:
deserialized = _deserialize(_models.GetAppInsightsResponse, response.json())
deserialized = _deserialize(
_models._models.GetAppInsightsResponse, response.json() # pylint: disable=protected-access
)

if cls:
return cls(pipeline_response, deserialized, {}) # type: ignore
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Expand All @@ -18,7 +19,7 @@
from azure.ai.projects import _types
from ._operations import ConnectionsOperations as ConnectionsOperationsGenerated
from ._operations import AgentsOperations as AgentsOperationsGenerated
from ._operations import DiagnosticsOperations as DiagnosticsOperationsGenerated
from ._operations import TelemetryOperations as TelemetryOperationsGenerated
from ...models._patch import ConnectionProperties
from ...models._enums import AuthenticationType, ConnectionType, FilePurpose
from ...models._models import (
Expand Down Expand Up @@ -310,7 +311,7 @@ async def list(
return connection_properties_list


class DiagnosticsOperations(DiagnosticsOperationsGenerated):
class TelemetryOperations(TelemetryOperationsGenerated):

_connection_string: Optional[str] = None
_get_connection_string_called: bool = False
Expand All @@ -336,7 +337,7 @@ async def get_connection_string(self) -> str:
if get_workspace_response.properties.application_insights:

# Make a GET call to the Application Insights resource URL to get the connection string
app_insights_respose: GetAppInsightsResponse = await self.get_app_insights(
app_insights_respose: GetAppInsightsResponse = await self._get_app_insights(
app_insights_resource_url=get_workspace_response.properties.application_insights
)

Expand All @@ -345,10 +346,9 @@ async def get_connection_string(self) -> str:
self._get_connection_string_called = True
return self._connection_string


# TODO: what about `set AZURE_TRACING_GEN_AI_CONTENT_RECORDING_ENABLED=true`?
# TODO: This could be a class method. But we don't have a class property AIProjectClient.diagnostics
def enable(self, *, destination: Union[TextIOWrapper, str] , **kwargs) -> None:
# TODO: This could be a class method. But we don't have a class property AIProjectClient.telemetry
def enable(self, *, destination: Union[TextIOWrapper, str], **kwargs) -> None:
"""Enable tracing to console (sys.stdout), or to an OpenTelemetry Protocol (OTLP) collector.

:keyword destination: `sys.stdout` for tracing to console output, or a string holding the
Expand Down Expand Up @@ -2022,7 +2022,7 @@ async def create_vector_store_file_batch_and_poll(
__all__: List[str] = [
"AgentsOperations",
"ConnectionsOperations",
"DiagnosticsOperations",
"TelemetryOperations",
"InferenceOperations",
] # Add all objects you want publicly available to users at this package level

Expand Down
4 changes: 0 additions & 4 deletions sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
AgentThreadCreationOptions,
AgentsApiResponseFormat,
AgentsNamedToolChoice,
AppInsightsProperties,
ApplicationInsightsConfiguration,
AzureAISearchResource,
AzureAISearchToolDefinition,
Expand All @@ -42,7 +41,6 @@
FunctionDefinition,
FunctionName,
FunctionToolDefinition,
GetAppInsightsResponse,
IndexResource,
InputData,
MessageAttachment,
Expand Down Expand Up @@ -203,7 +201,6 @@
"AgentThreadCreationOptions",
"AgentsApiResponseFormat",
"AgentsNamedToolChoice",
"AppInsightsProperties",
"ApplicationInsightsConfiguration",
"AzureAISearchResource",
"AzureAISearchToolDefinition",
Expand All @@ -225,7 +222,6 @@
"FunctionDefinition",
"FunctionName",
"FunctionToolDefinition",
"GetAppInsightsResponse",
"IndexResource",
"InputData",
"MessageAttachment",
Expand Down
40 changes: 2 additions & 38 deletions sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,23 +380,6 @@ class AppInsightsProperties(_model_base.Model):
connection_string: str = rest_field(name="ConnectionString")
"""Authentication type of the connection target. Required."""

@overload
def __init__(
self,
*,
connection_string: str,
) -> None: ...

@overload
def __init__(self, mapping: Mapping[str, Any]) -> None:
"""
:param mapping: raw JSON to initialize the model.
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


class InputData(_model_base.Model):
"""Abstract data class for input data configuration.
Expand Down Expand Up @@ -1334,35 +1317,16 @@ class GetAppInsightsResponse(_model_base.Model):
:ivar name: The name of the resource. Required.
:vartype name: str
:ivar properties: The properties of the resource. Required.
:vartype properties: ~azure.ai.projects.models.AppInsightsProperties
:vartype properties: ~azure.ai.projects.models._models.AppInsightsProperties
"""

id: str = rest_field()
"""A unique identifier for the resource. Required."""
name: str = rest_field()
"""The name of the resource. Required."""
properties: "_models.AppInsightsProperties" = rest_field()
properties: "_models._models.AppInsightsProperties" = rest_field()
"""The properties of the resource. Required."""

@overload
def __init__(
self,
*,
id: str, # pylint: disable=redefined-builtin
name: str,
properties: "_models.AppInsightsProperties",
) -> None: ...

@overload
def __init__(self, mapping: Mapping[str, Any]) -> None:
"""
:param mapping: raw JSON to initialize the model.
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


class GetConnectionResponse(_model_base.Model):
"""Response from the listSecrets operation.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines
# pylint: disable=too-many-lines
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from ._operations import AgentsOperations # type: ignore
from ._operations import ConnectionsOperations # type: ignore
from ._operations import DiagnosticsOperations # type: ignore
from ._operations import TelemetryOperations # type: ignore
from ._operations import EvaluationsOperations # type: ignore

from ._patch import __all__ as _patch_all
Expand All @@ -24,7 +24,7 @@
__all__ = [
"AgentsOperations",
"ConnectionsOperations",
"DiagnosticsOperations",
"TelemetryOperations",
"EvaluationsOperations",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
Expand Down
Loading