Skip to content

Commit 7f10ba0

Browse files
author
SDKAuto
committed
CodeGen from PR 34235 in Azure/azure-rest-api-specs
Merge 1b6e2797d7b6f57c2dfa39949546227714b5a68a into 30355bb16e2dc552d4e91556a87ae38e6d9c0d46
1 parent ba90e15 commit 7f10ba0

38 files changed

+23524
-0
lines changed

sdk/ai/azure-ai-agents/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Release History
2+
3+
## 1.0.0b1 (1970-01-01)
4+
5+
- Initial version

sdk/ai/azure-ai-agents/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
Copyright (c) Microsoft Corporation.
2+
3+
MIT License
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

sdk/ai/azure-ai-agents/MANIFEST.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include *.md
2+
include LICENSE
3+
include azure/ai/agents/py.typed
4+
recursive-include tests *.py
5+
recursive-include samples *.py *.md
6+
include azure/__init__.py
7+
include azure/ai/__init__.py

sdk/ai/azure-ai-agents/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Azure Ai Agents client library for Python
2+
<!-- write necessary description of service -->
3+
4+
## Getting started
5+
6+
### Install the package
7+
8+
```bash
9+
python -m pip install azure-ai-agents
10+
```
11+
12+
#### Prequisites
13+
14+
- Python 3.9 or later is required to use this package.
15+
- You need an [Azure subscription][azure_sub] to use this package.
16+
- An existing Azure Ai Agents instance.
17+
18+
19+
## Contributing
20+
21+
This project welcomes contributions and suggestions. Most contributions require
22+
you to agree to a Contributor License Agreement (CLA) declaring that you have
23+
the right to, and actually do, grant us the rights to use your contribution.
24+
For details, visit https://cla.microsoft.com.
25+
26+
When you submit a pull request, a CLA-bot will automatically determine whether
27+
you need to provide a CLA and decorate the PR appropriately (e.g., label,
28+
comment). Simply follow the instructions provided by the bot. You will only
29+
need to do this once across all repos using our CLA.
30+
31+
This project has adopted the
32+
[Microsoft Open Source Code of Conduct][code_of_conduct]. For more information,
33+
see the Code of Conduct FAQ or contact [email protected] with any
34+
additional questions or comments.
35+
36+
<!-- LINKS -->
37+
[code_of_conduct]: https://opensource.microsoft.com/codeofconduct/
38+
[authenticate_with_token]: https://docs.microsoft.com/azure/cognitive-services/authentication?tabs=powershell#authenticate-with-an-authentication-token
39+
[azure_identity_credentials]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#credentials
40+
[azure_identity_pip]: https://pypi.org/project/azure-identity/
41+
[default_azure_credential]: https://github.com/Azure/azure-sdk-for-python/tree/main/sdk/identity/azure-identity#defaultazurecredential
42+
[pip]: https://pypi.org/project/pip/
43+
[azure_sub]: https://azure.microsoft.com/free/

sdk/ai/azure-ai-agents/_meta.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "645cb35500e38ca52eac5510483028093483c457",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/ai/Azure.AI.Agents",
5+
"@azure-tools/typespec-python": "0.44.1"
6+
}

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

Lines changed: 286 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
__path__ = __import__("pkgutil").extend_path(__path__, __name__) # type: ignore
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
# pylint: disable=wrong-import-position
9+
10+
from typing import TYPE_CHECKING
11+
12+
if TYPE_CHECKING:
13+
from ._patch import * # pylint: disable=unused-wildcard-import
14+
15+
from ._client import AgentsClient # type: ignore
16+
from ._version import VERSION
17+
18+
__version__ = VERSION
19+
20+
try:
21+
from ._patch import __all__ as _patch_all
22+
from ._patch import *
23+
except ImportError:
24+
_patch_all = []
25+
from ._patch import patch_sdk as _patch_sdk
26+
27+
__all__ = [
28+
"AgentsClient",
29+
]
30+
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
31+
32+
_patch_sdk()
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# Code generated by Microsoft (R) Python Code Generator.
6+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
7+
# --------------------------------------------------------------------------
8+
9+
from copy import deepcopy
10+
from typing import Any, TYPE_CHECKING, Union
11+
from typing_extensions import Self
12+
13+
from azure.core import PipelineClient
14+
from azure.core.credentials import AzureKeyCredential
15+
from azure.core.pipeline import policies
16+
from azure.core.rest import HttpRequest, HttpResponse
17+
18+
from ._configuration import AgentsClientConfiguration
19+
from ._utils.serialization import Deserializer, Serializer
20+
from .operations import (
21+
AgentsClientOperationsMixin,
22+
FilesOperations,
23+
MessagesOperations,
24+
RunStepsOperations,
25+
RunsOperations,
26+
ThreadsOperations,
27+
VectorStoreFileBatchesOperations,
28+
VectorStoreFilesOperations,
29+
VectorStoresOperations,
30+
)
31+
32+
if TYPE_CHECKING:
33+
from azure.core.credentials import TokenCredential
34+
35+
36+
class AgentsClient(AgentsClientOperationsMixin): # pylint: disable=too-many-instance-attributes
37+
"""AgentsClient.
38+
39+
:ivar threads: ThreadsOperations operations
40+
:vartype threads: azure.ai.agents.operations.ThreadsOperations
41+
:ivar messages: MessagesOperations operations
42+
:vartype messages: azure.ai.agents.operations.MessagesOperations
43+
:ivar runs: RunsOperations operations
44+
:vartype runs: azure.ai.agents.operations.RunsOperations
45+
:ivar run_steps: RunStepsOperations operations
46+
:vartype run_steps: azure.ai.agents.operations.RunStepsOperations
47+
:ivar files: FilesOperations operations
48+
:vartype files: azure.ai.agents.operations.FilesOperations
49+
:ivar vector_stores: VectorStoresOperations operations
50+
:vartype vector_stores: azure.ai.agents.operations.VectorStoresOperations
51+
:ivar vector_store_files: VectorStoreFilesOperations operations
52+
:vartype vector_store_files: azure.ai.agents.operations.VectorStoreFilesOperations
53+
:ivar vector_store_file_batches: VectorStoreFileBatchesOperations operations
54+
:vartype vector_store_file_batches: azure.ai.agents.operations.VectorStoreFileBatchesOperations
55+
:param endpoint: Project endpoint in the form of:
56+
https://<aiservices-id>.services.ai.azure.com/api/projects/<project-name>. Required.
57+
:type endpoint: str
58+
:param credential: Credential used to authenticate requests to the service. Is either a key
59+
credential type or a token credential type. Required.
60+
:type credential: ~azure.core.credentials.AzureKeyCredential or
61+
~azure.core.credentials.TokenCredential
62+
:keyword api_version: The API version to use for this operation. Default value is
63+
"2025-05-15-preview". Note that overriding this default value may result in unsupported
64+
behavior.
65+
:paramtype api_version: str
66+
"""
67+
68+
def __init__(self, endpoint: str, credential: Union[AzureKeyCredential, "TokenCredential"], **kwargs: Any) -> None:
69+
_endpoint = "{endpoint}"
70+
self._config = AgentsClientConfiguration(endpoint=endpoint, credential=credential, **kwargs)
71+
72+
_policies = kwargs.pop("policies", None)
73+
if _policies is None:
74+
_policies = [
75+
policies.RequestIdPolicy(**kwargs),
76+
self._config.headers_policy,
77+
self._config.user_agent_policy,
78+
self._config.proxy_policy,
79+
policies.ContentDecodePolicy(**kwargs),
80+
self._config.redirect_policy,
81+
self._config.retry_policy,
82+
self._config.authentication_policy,
83+
self._config.custom_hook_policy,
84+
self._config.logging_policy,
85+
policies.DistributedTracingPolicy(**kwargs),
86+
policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None,
87+
self._config.http_logging_policy,
88+
]
89+
self._client: PipelineClient = PipelineClient(base_url=_endpoint, policies=_policies, **kwargs)
90+
91+
self._serialize = Serializer()
92+
self._deserialize = Deserializer()
93+
self._serialize.client_side_validation = False
94+
self.threads = ThreadsOperations(self._client, self._config, self._serialize, self._deserialize)
95+
self.messages = MessagesOperations(self._client, self._config, self._serialize, self._deserialize)
96+
self.runs = RunsOperations(self._client, self._config, self._serialize, self._deserialize)
97+
self.run_steps = RunStepsOperations(self._client, self._config, self._serialize, self._deserialize)
98+
self.files = FilesOperations(self._client, self._config, self._serialize, self._deserialize)
99+
self.vector_stores = VectorStoresOperations(self._client, self._config, self._serialize, self._deserialize)
100+
self.vector_store_files = VectorStoreFilesOperations(
101+
self._client, self._config, self._serialize, self._deserialize
102+
)
103+
self.vector_store_file_batches = VectorStoreFileBatchesOperations(
104+
self._client, self._config, self._serialize, self._deserialize
105+
)
106+
107+
def send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse:
108+
"""Runs the network request through the client's chained policies.
109+
110+
>>> from azure.core.rest import HttpRequest
111+
>>> request = HttpRequest("GET", "https://www.example.org/")
112+
<HttpRequest [GET], url: 'https://www.example.org/'>
113+
>>> response = client.send_request(request)
114+
<HttpResponse: 200 OK>
115+
116+
For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request
117+
118+
:param request: The network request you want to make. Required.
119+
:type request: ~azure.core.rest.HttpRequest
120+
:keyword bool stream: Whether the response payload will be streamed. Defaults to False.
121+
:return: The response of your network call. Does not do error handling on your response.
122+
:rtype: ~azure.core.rest.HttpResponse
123+
"""
124+
125+
request_copy = deepcopy(request)
126+
path_format_arguments = {
127+
"endpoint": self._serialize.url("self._config.endpoint", self._config.endpoint, "str", skip_quote=True),
128+
}
129+
130+
request_copy.url = self._client.format_url(request_copy.url, **path_format_arguments)
131+
return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore
132+
133+
def close(self) -> None:
134+
self._client.close()
135+
136+
def __enter__(self) -> Self:
137+
self._client.__enter__()
138+
return self
139+
140+
def __exit__(self, *exc_details: Any) -> None:
141+
self._client.__exit__(*exc_details)

0 commit comments

Comments
 (0)