Skip to content

Scheduled code regeneration test #41843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
362 changes: 242 additions & 120 deletions eng/emitter-package-lock.json

Large diffs are not rendered by default.

28 changes: 15 additions & 13 deletions eng/emitter-package.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,25 @@
{
"name": "dist/src/index.js",
"main": "dist/src/index.js",
"dependencies": {
"@azure-tools/typespec-python": "0.46.0"
"@azure-tools/typespec-python": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/@azure-tools/typespec-python/-/typespec-python-0.46.0-alpha.20250711.1.tgz"
},
"devDependencies": {
"@azure-tools/typespec-autorest": "~0.57.0",
"@azure-tools/typespec-azure-core": "~0.57.0",
"@azure-tools/typespec-azure-resource-manager": "~0.57.0",
"@azure-tools/typespec-azure-rulesets": "~0.57.0",
"@azure-tools/typespec-client-generator-core": "~0.57.2",
"@typespec/compiler": "^1.1.0",
"@typespec/events": "~0.71.0",
"@typespec/http": "^1.1.0",
"@typespec/rest": "~0.71.0",
"@typespec/versioning": "~0.71.0",
"@typespec/openapi": "^1.1.0",
"@typespec/events": "~0.71.0",
"@typespec/rest": "~0.71.0",
"@typespec/sse": "~0.71.0",
"@typespec/streams": "~0.71.0",
"@typespec/xml": "~0.71.0",
"@azure-tools/typespec-azure-core": "~0.57.0",
"@azure-tools/typespec-azure-resource-manager": "~0.57.2",
"@azure-tools/typespec-autorest": "~0.57.1",
"@azure-tools/typespec-azure-rulesets": "~0.57.1",
"@azure-tools/typespec-client-generator-core": "~0.57.3",
"@azure-tools/typespec-liftr-base": "0.8.0"
"@typespec/versioning": "~0.71.0",
"@typespec/xml": "~0.71.0"
},
"overrides": {
"@autorest/python": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/@autorest/python/-/python-6.36.0-alpha.20250711.1.tgz"
}
}
}
4 changes: 2 additions & 2 deletions sdk/ai/azure-ai-agents/azure/ai/agents/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from ._configuration import AgentsClientConfiguration
from ._utils.serialization import Deserializer, Serializer
from .operations import (
AgentsClientOperationsMixin,
FilesOperations,
MessagesOperations,
RunStepsOperations,
Expand All @@ -27,12 +26,13 @@
VectorStoreFilesOperations,
VectorStoresOperations,
)
from .operations._operations import _AgentsClientOperationsMixin

if TYPE_CHECKING:
from azure.core.credentials import TokenCredential


class AgentsClient(AgentsClientOperationsMixin): # pylint: disable=too-many-instance-attributes
class AgentsClient(_AgentsClientOperationsMixin): # pylint: disable=too-many-instance-attributes
"""AgentsClient.

:ivar threads: ThreadsOperations operations
Expand Down
1 change: 0 additions & 1 deletion sdk/ai/azure-ai-agents/azure/ai/agents/_types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# pylint: disable=line-too-long,useless-suppression
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=line-too-long,useless-suppression,too-many-lines
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
4 changes: 2 additions & 2 deletions sdk/ai/azure-ai-agents/azure/ai/agents/aio/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from .._utils.serialization import Deserializer, Serializer
from ._configuration import AgentsClientConfiguration
from .operations import (
AgentsClientOperationsMixin,
FilesOperations,
MessagesOperations,
RunStepsOperations,
Expand All @@ -27,12 +26,13 @@
VectorStoreFilesOperations,
VectorStoresOperations,
)
from .operations._operations import _AgentsClientOperationsMixin

if TYPE_CHECKING:
from azure.core.credentials_async import AsyncTokenCredential


class AgentsClient(AgentsClientOperationsMixin): # pylint: disable=too-many-instance-attributes
class AgentsClient(_AgentsClientOperationsMixin): # pylint: disable=too-many-instance-attributes
"""AgentsClient.

:ivar threads: ThreadsOperations operations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from ._operations import VectorStoresOperations # type: ignore
from ._operations import VectorStoreFilesOperations # type: ignore
from ._operations import VectorStoreFileBatchesOperations # type: ignore
from ._operations import AgentsClientOperationsMixin # type: ignore

from ._patch import __all__ as _patch_all
from ._patch import *
Expand All @@ -35,7 +34,6 @@
"VectorStoresOperations",
"VectorStoreFilesOperations",
"VectorStoreFileBatchesOperations",
"AgentsClientOperationsMixin",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
Original file line number Diff line number Diff line change
Expand Up @@ -3975,7 +3975,7 @@ async def get_next(_continuation_token=None):
return AsyncItemPaged(get_next, extract_data)


class AgentsClientOperationsMixin(
class _AgentsClientOperationsMixin(
ClientMixinABC[AsyncPipelineClient[HttpRequest, AsyncHttpResponse], AgentsClientConfiguration]
):

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from ._operations import VectorStoresOperations # type: ignore
from ._operations import VectorStoreFilesOperations # type: ignore
from ._operations import VectorStoreFileBatchesOperations # type: ignore
from ._operations import AgentsClientOperationsMixin # type: ignore

from ._patch import __all__ as _patch_all
from ._patch import *
Expand All @@ -35,7 +34,6 @@
"VectorStoresOperations",
"VectorStoreFilesOperations",
"VectorStoreFileBatchesOperations",
"AgentsClientOperationsMixin",
]
__all__.extend([p for p in _patch_all if p not in __all__]) # pyright: ignore
_patch_sdk()
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=line-too-long,useless-suppression,too-many-lines
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down Expand Up @@ -5087,7 +5087,9 @@ def get_next(_continuation_token=None):
return ItemPaged(get_next, extract_data)


class AgentsClientOperationsMixin(ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], AgentsClientConfiguration]):
class _AgentsClientOperationsMixin(
ClientMixinABC[PipelineClient[HttpRequest, HttpResponse], AgentsClientConfiguration]
):

@overload
def create_agent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,7 @@ async def fetch_and_print_new_agent_response(
return response.id


def create_research_summary(
message : ThreadMessage,
filepath: str = "research_summary.md"
) -> None:
def create_research_summary(message: ThreadMessage, filepath: str = "research_summary.md") -> None:
if not message:
print("No message content provided, cannot create research summary.")
return
Expand Down Expand Up @@ -167,4 +164,4 @@ async def main() -> None:


if __name__ == "__main__":
asyncio.run(main())
asyncio.run(main())
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,7 @@ def fetch_and_print_new_agent_response(
return response.id


def create_research_summary(
message : ThreadMessage,
filepath: str = "research_summary.md"
) -> None:
def create_research_summary(message: ThreadMessage, filepath: str = "research_summary.md") -> None:
if not message:
print("No message content provided, cannot create research summary.")
return
Expand Down Expand Up @@ -154,9 +151,7 @@ def create_research_summary(
print(f"Run failed: {run.last_error}")

# Fetch the final message from the agent in the thread and create a research summary
final_message = agents_client.messages.get_last_message_by_role(
thread_id=thread.id, role=MessageRole.AGENT
)
final_message = agents_client.messages.get_last_message_by_role(thread_id=thread.id, role=MessageRole.AGENT)
if final_message:
create_research_summary(final_message)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
ListSortOrder,
MessageRole,
RunStepToolCallDetails,

)
from azure.identity import DefaultAzureCredential

Expand Down Expand Up @@ -146,14 +145,16 @@
# Delete the connected Agent when done
agents_client.delete_agent(weather_agent.id)
print("Deleted weather agent")

# [START list_tool_calls]
for run_step in agents_client.run_steps.list(thread_id=thread.id, run_id=run.id, order=ListSortOrder.ASCENDING):
if isinstance(run_step.step_details, RunStepToolCallDetails):
for tool_call in run_step.step_details.tool_calls:
print(f"\tAgent: {tool_call._data['connected_agent']['name']} "
f"query: {tool_call._data['connected_agent']['arguments']} ",
f"output: {tool_call._data['connected_agent']['output']}")
print(
f"\tAgent: {tool_call._data['connected_agent']['name']} "
f"query: {tool_call._data['connected_agent']['arguments']} ",
f"output: {tool_call._data['connected_agent']['output']}",
)
# [END list_tool_calls]

# [START list_messages]
Expand All @@ -162,7 +163,7 @@
for msg in messages:
if msg.text_messages:
last_text = msg.text_messages[-1]
text = last_text.text.value.replace('\u3010', '[').replace('\u3011', ']')
text = last_text.text.value.replace("\u3010", "[").replace("\u3011", "]")
print(f"{msg.role}: {text}")
# [END list_messages]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=line-too-long,useless-suppression,too-many-lines
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down
20 changes: 18 additions & 2 deletions sdk/ai/azure-ai-projects/azure/ai/projects/_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,22 @@
def api_version_validation(**kwargs):
params_added_on = kwargs.pop("params_added_on", {})
method_added_on = kwargs.pop("method_added_on", "")
api_versions_list = kwargs.pop("api_versions_list", [])

def _index_with_default(value: str, default: int = -1) -> int:
"""Get the index of value in lst, or return default if not found.

:param value: The value to search for in the api_versions_list.
:type value: str
:param default: The default value to return if the value is not found.
:type default: int
:return: The index of the value in the list, or the default value if not found.
:rtype: int
"""
try:
return api_versions_list.index(value)
except ValueError:
return default

def decorator(func):
@functools.wraps(func)
Expand All @@ -21,7 +37,7 @@ def wrapper(*args, **kwargs):
except AttributeError:
return func(*args, **kwargs)

if method_added_on > client_api_version:
if _index_with_default(method_added_on) > _index_with_default(client_api_version):
raise ValueError(
f"'{func.__name__}' is not available in API version "
f"{client_api_version}. Pass service API version {method_added_on} or newer to your client."
Expand All @@ -31,7 +47,7 @@ def wrapper(*args, **kwargs):
parameter: api_version
for api_version, parameters in params_added_on.items()
for parameter in parameters
if parameter in kwargs and api_version > client_api_version
if parameter in kwargs and _index_with_default(api_version) > _index_with_default(client_api_version)
}
if unsupported:
raise ValueError(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=line-too-long,useless-suppression,too-many-lines
# pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down Expand Up @@ -333,6 +333,7 @@ def __init__(self, *args, **kwargs) -> None:
@api_version_validation(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "name", "client_request_id", "accept"]},
api_versions_list=["2025-05-15-preview"],
)
async def get(self, name: str, **kwargs: Any) -> _models.Evaluation:
"""Get an evaluation run by name.
Expand Down Expand Up @@ -402,6 +403,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.Evaluation:
@api_version_validation(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "client_request_id", "accept"]},
api_versions_list=["2025-05-15-preview"],
)
def list(self, **kwargs: Any) -> AsyncItemPaged["_models.Evaluation"]:
"""List evaluation runs.
Expand Down Expand Up @@ -536,6 +538,7 @@ async def create(
@api_version_validation(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "content_type", "accept"]},
api_versions_list=["2025-05-15-preview"],
)
async def create(self, evaluation: Union[_models.Evaluation, JSON, IO[bytes]], **kwargs: Any) -> _models.Evaluation:
"""Creates an evaluation run.
Expand Down Expand Up @@ -658,6 +661,7 @@ async def create_agent_evaluation(
@api_version_validation(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "content_type", "accept"]},
api_versions_list=["2025-05-15-preview"],
)
async def create_agent_evaluation(
self, evaluation: Union[_models.AgentEvaluationRequest, JSON, IO[bytes]], **kwargs: Any
Expand Down Expand Up @@ -1022,7 +1026,7 @@ async def delete(self, name: str, version: str, **kwargs: Any) -> None:

response = pipeline_response.http_response

if response.status_code not in [204, 200]:
if response.status_code not in [204]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response)

Expand Down Expand Up @@ -2063,6 +2067,7 @@ def __init__(self, *args, **kwargs) -> None:
@api_version_validation(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "name", "client_request_id", "accept"]},
api_versions_list=["2025-05-15-preview"],
)
async def get(self, name: str, **kwargs: Any) -> _models.RedTeam:
"""Get a redteam by name.
Expand Down Expand Up @@ -2132,6 +2137,7 @@ async def get(self, name: str, **kwargs: Any) -> _models.RedTeam:
@api_version_validation(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "client_request_id", "accept"]},
api_versions_list=["2025-05-15-preview"],
)
def list(self, **kwargs: Any) -> AsyncItemPaged["_models.RedTeam"]:
"""List a redteam by name.
Expand Down Expand Up @@ -2264,6 +2270,7 @@ async def create(
@api_version_validation(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "content_type", "accept"]},
api_versions_list=["2025-05-15-preview"],
)
async def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: Any) -> _models.RedTeam:
"""Creates a redteam run.
Expand Down
Loading
Loading