Skip to content

Commit 9911eb4

Browse files
author
iscai-msft
committed
revert changed files
1 parent f899362 commit 9911eb4

20 files changed

Lines changed: 7457 additions & 27883 deletions
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
{
2-
"apiVersion": "v1",
3-
"apiVersions": {
4-
"Azure.AI.Projects": "v1"
5-
}
2+
"apiVersion": "2025-05-15-preview"
63
}

sdk/ai/azure-ai-agents/apiview-properties.json

Lines changed: 329 additions & 111 deletions
Large diffs are not rendered by default.

sdk/ai/azure-ai-agents/azure/ai/agents/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
if TYPE_CHECKING:
1313
from ._patch import * # pylint: disable=unused-wildcard-import
1414

15-
from ._client import AIProjectClient # type: ignore
16-
from . import types # type: ignore
15+
from ._client import AgentsClient # type: ignore
1716
from ._version import VERSION
1817

1918
__version__ = VERSION
@@ -26,7 +25,7 @@
2625
from ._patch import patch_sdk as _patch_sdk
2726

2827
__all__ = [
29-
"AIProjectClient",
28+
"AgentsClient",
3029
]
3130
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
3231

sdk/ai/azure-ai-agents/azure/ai/agents/_client.py

Lines changed: 48 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -7,76 +7,64 @@
77
# --------------------------------------------------------------------------
88

99
from copy import deepcopy
10-
import sys
11-
from typing import Any, Optional, TYPE_CHECKING
10+
from typing import Any, TYPE_CHECKING
11+
from typing_extensions import Self
1212

1313
from azure.core import PipelineClient
1414
from azure.core.pipeline import policies
1515
from azure.core.rest import HttpRequest, HttpResponse
1616

17-
from ._configuration import AIProjectClientConfiguration
17+
from ._configuration import AgentsClientConfiguration
1818
from ._utils.serialization import Deserializer, Serializer
1919
from .operations import (
20-
AgentsOperations,
21-
BetaOperations,
22-
ConnectionsOperations,
23-
DatasetsOperations,
24-
DeploymentsOperations,
25-
EvaluationRulesOperations,
26-
IndexesOperations,
27-
_AIProjectClientOperationsMixin,
20+
FilesOperations,
21+
MessagesOperations,
22+
RunStepsOperations,
23+
RunsOperations,
24+
ThreadsOperations,
25+
VectorStoreFileBatchesOperations,
26+
VectorStoreFilesOperations,
27+
VectorStoresOperations,
28+
_AgentsClientOperationsMixin,
2829
)
2930

30-
if sys.version_info >= (3, 11):
31-
from typing import Self
32-
else:
33-
from typing_extensions import Self # type: ignore
34-
3531
if TYPE_CHECKING:
3632
from azure.core.credentials import TokenCredential
3733

3834

39-
class AIProjectClient(_AIProjectClientOperationsMixin): # pylint: disable=too-many-instance-attributes
40-
"""AIProjectClient.
41-
42-
:ivar beta: BetaOperations operations
43-
:vartype beta: azure.ai.agents.operations.BetaOperations
44-
:ivar agents: AgentsOperations operations
45-
:vartype agents: azure.ai.agents.operations.AgentsOperations
46-
:ivar evaluation_rules: EvaluationRulesOperations operations
47-
:vartype evaluation_rules: azure.ai.agents.operations.EvaluationRulesOperations
48-
:ivar connections: ConnectionsOperations operations
49-
:vartype connections: azure.ai.agents.operations.ConnectionsOperations
50-
:ivar datasets: DatasetsOperations operations
51-
:vartype datasets: azure.ai.agents.operations.DatasetsOperations
52-
:ivar deployments: DeploymentsOperations operations
53-
:vartype deployments: azure.ai.agents.operations.DeploymentsOperations
54-
:ivar indexes: IndexesOperations operations
55-
:vartype indexes: azure.ai.agents.operations.IndexesOperations
56-
:param endpoint: Foundry Project endpoint in the form
57-
"https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". If you
58-
only have one Project in your Foundry Hub, or to target the default Project in your Hub, use
59-
the form "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project".
60-
Required.
35+
class AgentsClient(_AgentsClientOperationsMixin): # pylint: disable=too-many-instance-attributes
36+
"""AgentsClient.
37+
38+
:ivar threads: ThreadsOperations operations
39+
:vartype threads: azure.ai.agents.operations.ThreadsOperations
40+
:ivar messages: MessagesOperations operations
41+
:vartype messages: azure.ai.agents.operations.MessagesOperations
42+
:ivar runs: RunsOperations operations
43+
:vartype runs: azure.ai.agents.operations.RunsOperations
44+
:ivar run_steps: RunStepsOperations operations
45+
:vartype run_steps: azure.ai.agents.operations.RunStepsOperations
46+
:ivar files: FilesOperations operations
47+
:vartype files: azure.ai.agents.operations.FilesOperations
48+
:ivar vector_stores: VectorStoresOperations operations
49+
:vartype vector_stores: azure.ai.agents.operations.VectorStoresOperations
50+
:ivar vector_store_files: VectorStoreFilesOperations operations
51+
:vartype vector_store_files: azure.ai.agents.operations.VectorStoreFilesOperations
52+
:ivar vector_store_file_batches: VectorStoreFileBatchesOperations operations
53+
:vartype vector_store_file_batches: azure.ai.agents.operations.VectorStoreFileBatchesOperations
54+
:param endpoint: Project endpoint in the form of:
55+
https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. Required.
6156
:type endpoint: str
6257
:param credential: Credential used to authenticate requests to the service. Required.
6358
:type credential: ~azure.core.credentials.TokenCredential
64-
:param allow_preview: Whether to enable preview features. Must be specified and set to True to
65-
enable preview features. Default value is None.
66-
:type allow_preview: bool
67-
:keyword api_version: The API version to use for this operation. Known values are "v1" and
68-
None. Default value is None. If not set, the operation's default API version will be used. Note
69-
that overriding this default value may result in unsupported behavior.
59+
:keyword api_version: The API version to use for this operation. Default value is
60+
"2025-05-15-preview". Note that overriding this default value may result in unsupported
61+
behavior.
7062
:paramtype api_version: str
7163
"""
7264

73-
def __init__(
74-
self, endpoint: str, credential: "TokenCredential", allow_preview: Optional[bool] = None, **kwargs: Any
75-
) -> None:
65+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
7666
_endpoint = "{endpoint}"
77-
self._config = AIProjectClientConfiguration(
78-
endpoint=endpoint, credential=credential, allow_preview=allow_preview, **kwargs
79-
)
67+
self._config = AgentsClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
8068

8169
_policies = kwargs.pop("policies", None)
8270
if _policies is None:
@@ -100,15 +88,18 @@ def __init__(
10088
self._serialize = Serializer()
10189
self._deserialize = Deserializer()
10290
self._serialize.client_side_validation = False
103-
self.beta = BetaOperations(self._client, self._config, self._serialize, self._deserialize)
104-
self.agents = AgentsOperations(self._client, self._config, self._serialize, self._deserialize)
105-
self.evaluation_rules = EvaluationRulesOperations(
91+
self.threads = ThreadsOperations(self._client, self._config, self._serialize, self._deserialize)
92+
self.messages = MessagesOperations(self._client, self._config, self._serialize, self._deserialize)
93+
self.runs = RunsOperations(self._client, self._config, self._serialize, self._deserialize)
94+
self.run_steps = RunStepsOperations(self._client, self._config, self._serialize, self._deserialize)
95+
self.files = FilesOperations(self._client, self._config, self._serialize, self._deserialize)
96+
self.vector_stores = VectorStoresOperations(self._client, self._config, self._serialize, self._deserialize)
97+
self.vector_store_files = VectorStoreFilesOperations(
98+
self._client, self._config, self._serialize, self._deserialize
99+
)
100+
self.vector_store_file_batches = VectorStoreFileBatchesOperations(
106101
self._client, self._config, self._serialize, self._deserialize
107102
)
108-
self.connections = ConnectionsOperations(self._client, self._config, self._serialize, self._deserialize)
109-
self.datasets = DatasetsOperations(self._client, self._config, self._serialize, self._deserialize)
110-
self.deployments = DeploymentsOperations(self._client, self._config, self._serialize, self._deserialize)
111-
self.indexes = IndexesOperations(self._client, self._config, self._serialize, self._deserialize)
112103

113104
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
114105
"""Runs the network request through the client's chained policies.

sdk/ai/azure-ai-agents/azure/ai/agents/_configuration.py

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
77
# --------------------------------------------------------------------------
88

9-
from typing import Any, Optional, TYPE_CHECKING
9+
from typing import Any, TYPE_CHECKING
1010

1111
from azure.core.pipeline import policies
1212

@@ -16,33 +16,25 @@
1616
from azure.core.credentials import TokenCredential
1717

1818

19-
class AIProjectClientConfiguration: # pylint: disable=too-many-instance-attributes
20-
"""Configuration for AIProjectClient.
19+
class AgentsClientConfiguration: # pylint: disable=too-many-instance-attributes
20+
"""Configuration for AgentsClient.
2121
2222
Note that all parameters used to create this instance are saved as instance
2323
attributes.
2424
25-
:param endpoint: Foundry Project endpoint in the form
26-
"https://{ai-services-account-name}.services.ai.azure.com/api/projects/{project-name}". If you
27-
only have one Project in your Foundry Hub, or to target the default Project in your Hub, use
28-
the form "https://{ai-services-account-name}.services.ai.azure.com/api/projects/_project".
29-
Required.
25+
:param endpoint: Project endpoint in the form of:
26+
https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. Required.
3027
:type endpoint: str
3128
:param credential: Credential used to authenticate requests to the service. Required.
3229
:type credential: ~azure.core.credentials.TokenCredential
33-
:param allow_preview: Whether to enable preview features. Must be specified and set to True to
34-
enable preview features. Default value is None.
35-
:type allow_preview: bool
36-
:keyword api_version: The API version to use for this operation. Known values are "v1" and
37-
None. Default value is None. If not set, the operation's default API version will be used. Note
38-
that overriding this default value may result in unsupported behavior.
30+
:keyword api_version: The API version to use for this operation. Default value is
31+
"2025-05-15-preview". Note that overriding this default value may result in unsupported
32+
behavior.
3933
:paramtype api_version: str
4034
"""
4135

42-
def __init__(
43-
self, endpoint: str, credential: "TokenCredential", allow_preview: Optional[bool] = None, **kwargs: Any
44-
) -> None:
45-
api_version: str = kwargs.pop("api_version", "v1")
36+
def __init__(self, endpoint: str, credential: "TokenCredential", **kwargs: Any) -> None:
37+
api_version: str = kwargs.pop("api_version", "2025-05-15-preview")
4638

4739
if endpoint is None:
4840
raise ValueError("Parameter 'endpoint' must not be None.")
@@ -51,7 +43,6 @@ def __init__(
5143

5244
self.endpoint = endpoint
5345
self.credential = credential
54-
self.allow_preview = allow_preview
5546
self.api_version = api_version
5647
self.credential_scopes = kwargs.pop("credential_scopes", ["https://ai.azure.com/.default"])
5748
kwargs.setdefault("sdk_moniker", "ai-agents/{}".format(VERSION))

sdk/ai/azure-ai-agents/azure/ai/agents/_utils/model_base.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# pylint: disable=line-too-long,useless-suppression,too-many-lines
21
# coding=utf-8
32
# --------------------------------------------------------------------------
43
# Copyright (c) Microsoft Corporation. All rights reserved.
@@ -817,22 +816,16 @@ def _get_deserialize_callable_from_annotation( # pylint: disable=too-many-retur
817816

818817
# is it optional?
819818
try:
820-
if any(
821-
a for a in annotation.__args__ if a == type(None)
822-
): # pyright: ignore # pylint: disable=unidiomatic-typecheck
819+
if any(a for a in annotation.__args__ if a == type(None)): # pyright: ignore # pylint: disable=unidiomatic-typecheck
823820
if len(annotation.__args__) <= 2: # pyright: ignore
824821
if_obj_deserializer = _get_deserialize_callable_from_annotation(
825-
next(a for a in annotation.__args__ if a != type(None)),
826-
module,
827-
rf, # pyright: ignore # pylint: disable=unidiomatic-typecheck
822+
next(a for a in annotation.__args__ if a != type(None)), module, rf # pyright: ignore # pylint: disable=unidiomatic-typecheck
828823
)
829824

830825
return functools.partial(_deserialize_with_optional, if_obj_deserializer)
831826
# the type is Optional[Union[...]], we need to remove the None type from the Union
832827
annotation_copy = copy.copy(annotation)
833-
annotation_copy.__args__ = [
834-
a for a in annotation_copy.__args__ if a != type(None)
835-
] # pyright: ignore # pylint: disable=unidiomatic-typecheck
828+
annotation_copy.__args__ = [a for a in annotation_copy.__args__ if a != type(None)] # pyright: ignore # pylint: disable=unidiomatic-typecheck
836829
return _get_deserialize_callable_from_annotation(annotation_copy, module, rf)
837830
except AttributeError:
838831
pass

sdk/ai/azure-ai-agents/azure/ai/agents/_utils/serialization.py

Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,11 @@
3939
import xml.etree.ElementTree as ET
4040

4141
import isodate # type: ignore
42+
from typing_extensions import Self
4243

4344
from azure.core.exceptions import DeserializationError, SerializationError
4445
from azure.core.serialization import NULL as CoreNull
4546

46-
if sys.version_info >= (3, 11):
47-
from typing import Self
48-
else:
49-
from typing_extensions import Self
50-
5147
_BOM = codecs.BOM_UTF8.decode(encoding="utf-8")
5248

5349
JSON = MutableMapping[str, Any]
@@ -825,20 +821,13 @@ def serialize_basic(cls, data, data_type, **kwargs):
825821
:param str data_type: Type of object in the iterable.
826822
:rtype: str, int, float, bool
827823
:return: serialized object
828-
:raises TypeError: raise if data_type is not one of str, int, float, bool.
829824
"""
830825
custom_serializer = cls._get_custom_serializers(data_type, **kwargs)
831826
if custom_serializer:
832827
return custom_serializer(data)
833828
if data_type == "str":
834829
return cls.serialize_unicode(data)
835-
if data_type == "int":
836-
return int(data)
837-
if data_type == "float":
838-
return float(data)
839-
if data_type == "bool":
840-
return bool(data)
841-
raise TypeError("Unknown basic data type: {}".format(data_type))
830+
return eval(data_type)(data) # nosec # pylint: disable=eval-used
842831

843832
@classmethod
844833
def serialize_unicode(cls, data):
@@ -1405,7 +1394,7 @@ def __init__(self, classes: Optional[Mapping[str, type]] = None) -> None:
14051394
# Otherwise, result are unexpected
14061395
self.additional_properties_detection = True
14071396

1408-
def __call__(self, target_obj, response_data, content_type=None): # pylint: disable=too-many-return-statements
1397+
def __call__(self, target_obj, response_data, content_type=None):
14091398
"""Call the deserializer to process a REST response.
14101399
14111400
:param str target_obj: Target data type to deserialize to.
@@ -1415,27 +1404,6 @@ def __call__(self, target_obj, response_data, content_type=None): # pylint: dis
14151404
:return: Deserialized object.
14161405
:rtype: object
14171406
"""
1418-
# Fast path for header deserialization: response_data is a plain str or None
1419-
# and target_obj is a simple scalar type. This avoids the expensive
1420-
# _unpack_content → _deserialize → _classify_target → deserialize_data chain.
1421-
if response_data is None:
1422-
return None
1423-
if target_obj == "str" and isinstance(response_data, str):
1424-
return response_data
1425-
if isinstance(response_data, str):
1426-
if target_obj == "int":
1427-
return int(response_data)
1428-
if target_obj == "bool":
1429-
if response_data in ("true", "1", "True"):
1430-
return True
1431-
if response_data in ("false", "0", "False"):
1432-
return False
1433-
return bool(response_data)
1434-
if target_obj == "rfc-1123":
1435-
return Deserializer.deserialize_rfc(response_data)
1436-
if target_obj == "bytearray":
1437-
return Deserializer.deserialize_bytearray(response_data)
1438-
14391407
data = self._unpack_content(response_data, content_type)
14401408
return self._deserialize(target_obj, data)
14411409

@@ -1789,7 +1757,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return
17891757
:param str data_type: deserialization data type.
17901758
:return: Deserialized basic type.
17911759
:rtype: str, int, float or bool
1792-
:raises TypeError: if string format is not valid or data_type is not one of str, int, float, bool.
1760+
:raises TypeError: if string format is not valid.
17931761
"""
17941762
# If we're here, data is supposed to be a basic type.
17951763
# If it's still an XML node, take the text
@@ -1815,11 +1783,7 @@ def deserialize_basic(self, attr, data_type): # pylint: disable=too-many-return
18151783

18161784
if data_type == "str":
18171785
return self.deserialize_unicode(attr)
1818-
if data_type == "int":
1819-
return int(attr)
1820-
if data_type == "float":
1821-
return float(attr)
1822-
raise TypeError("Unknown basic data type: {}".format(data_type))
1786+
return eval(data_type)(attr) # nosec # pylint: disable=eval-used
18231787

18241788
@staticmethod
18251789
def deserialize_unicode(data):

0 commit comments

Comments
 (0)