Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Evaluation Review Feedback
  • Loading branch information
singankit committed Apr 30, 2025
commit b405b887922d34a4e6f44d8409ca03d6b9451d6f
8 changes: 4 additions & 4 deletions sdk/ai/azure-ai-projects/apiview-properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"azure.ai.projects.aio.operations.EvaluationsOperations.get": "Azure.AI.Projects.Evaluations.get",
"azure.ai.projects.operations.EvaluationsOperations.list": "Azure.AI.Projects.Evaluations.list",
"azure.ai.projects.aio.operations.EvaluationsOperations.list": "Azure.AI.Projects.Evaluations.list",
"azure.ai.projects.operations.EvaluationsOperations.create_run": "Azure.AI.Projects.Evaluations.createRun",
"azure.ai.projects.aio.operations.EvaluationsOperations.create_run": "Azure.AI.Projects.Evaluations.createRun",
"azure.ai.projects.operations.EvaluationsOperations.create": "Azure.AI.Projects.Evaluations.create",
"azure.ai.projects.aio.operations.EvaluationsOperations.create": "Azure.AI.Projects.Evaluations.create",
"azure.ai.projects.operations.EvaluationsOperations.create_agent_evaluation": "Azure.AI.Projects.Evaluations.createAgentEvaluation",
"azure.ai.projects.aio.operations.EvaluationsOperations.create_agent_evaluation": "Azure.AI.Projects.Evaluations.createAgentEvaluation",
"azure.ai.projects.operations.DatasetsOperations.list_versions": "Azure.AI.Projects.ServicePatterns.Datasets.listVersions",
Expand Down Expand Up @@ -86,7 +86,7 @@
"azure.ai.projects.aio.operations.RedTeamsOperations.get": "Azure.AI.Projects.RedTeams.get",
"azure.ai.projects.operations.RedTeamsOperations.list": "Azure.AI.Projects.RedTeams.list",
"azure.ai.projects.aio.operations.RedTeamsOperations.list": "Azure.AI.Projects.RedTeams.list",
"azure.ai.projects.operations.RedTeamsOperations.create_run": "Azure.AI.Projects.RedTeams.createRun",
"azure.ai.projects.aio.operations.RedTeamsOperations.create_run": "Azure.AI.Projects.RedTeams.createRun"
"azure.ai.projects.operations.RedTeamsOperations.create": "Azure.AI.Projects.RedTeams.create",
"azure.ai.projects.aio.operations.RedTeamsOperations.create": "Azure.AI.Projects.RedTeams.create"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
if TYPE_CHECKING:
from prompty import Prompty # type: ignore[import]


class PromptTemplate:
"""A helper class which takes variant of inputs, e.g. Prompty format or string, and returns the parsed prompt in an array.
Prompty library is required to use this class (`pip install prompty`).
Expand Down
1 change: 1 addition & 0 deletions sdk/ai/azure-ai-projects/azure/ai/projects/aio/_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
# pylint: disable=unused-import,ungrouped-imports
from azure.ai.agents.aio import AgentsClient


class AIProjectClient(AIProjectClientGenerated): # pylint: disable=too-many-instance-attributes
"""AIProjectClient.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=too-many-lines
# pylint: disable=line-too-long,useless-suppression,too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
Expand Down Expand Up @@ -48,15 +48,15 @@
build_deployments_get_request,
build_deployments_list_request,
build_evaluations_create_agent_evaluation_request,
build_evaluations_create_run_request,
build_evaluations_create_request,
build_evaluations_get_request,
build_evaluations_list_request,
build_indexes_create_or_update_request,
build_indexes_delete_request,
build_indexes_get_request,
build_indexes_list_request,
build_indexes_list_versions_request,
build_red_teams_create_run_request,
build_red_teams_create_request,
build_red_teams_get_request,
build_red_teams_list_request,
)
Expand Down Expand Up @@ -525,7 +525,7 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)

@overload
async def create_run(
async def create(
self, evaluation: _models.Evaluation, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Evaluation:
"""Creates an evaluation run.
Expand All @@ -541,7 +541,7 @@ async def create_run(
"""

@overload
async def create_run(
async def create(
self, evaluation: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Evaluation:
"""Creates an evaluation run.
Expand All @@ -557,7 +557,7 @@ async def create_run(
"""

@overload
async def create_run(
async def create(
self, evaluation: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.Evaluation:
"""Creates an evaluation run.
Expand All @@ -577,9 +577,7 @@ async def create_run(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "content_type", "accept"]},
)
async def create_run(
self, evaluation: Union[_models.Evaluation, JSON, IO[bytes]], **kwargs: Any
) -> _models.Evaluation:
async def create(self, evaluation: Union[_models.Evaluation, JSON, IO[bytes]], **kwargs: Any) -> _models.Evaluation:
"""Creates an evaluation run.

:param evaluation: Evaluation to be run. Is one of the following types: Evaluation, JSON,
Expand Down Expand Up @@ -610,7 +608,7 @@ async def create_run(
else:
_content = json.dumps(evaluation, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore

_request = build_evaluations_create_run_request(
_request = build_evaluations_create_request(
content_type=content_type,
api_version=self._config.api_version,
content=_content,
Expand Down Expand Up @@ -2271,7 +2269,7 @@ async def get_next(next_link=None):
return AsyncItemPaged(get_next, extract_data)

@overload
async def create_run(
async def create(
self, red_team: _models.RedTeam, *, content_type: str = "application/json", **kwargs: Any
) -> _models.RedTeam:
"""Creates a redteam run.
Expand All @@ -2287,9 +2285,7 @@ async def create_run(
"""

@overload
async def create_run(
self, red_team: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> _models.RedTeam:
async def create(self, red_team: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.RedTeam:
"""Creates a redteam run.

:param red_team: Redteam to be run. Required.
Expand All @@ -2303,7 +2299,7 @@ async def create_run(
"""

@overload
async def create_run(
async def create(
self, red_team: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RedTeam:
"""Creates a redteam run.
Expand All @@ -2323,7 +2319,7 @@ async def create_run(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "content_type", "accept"]},
)
async def create_run(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: Any) -> _models.RedTeam:
async def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: Any) -> _models.RedTeam:
"""Creates a redteam run.

:param red_team: Redteam to be run. Is one of the following types: RedTeam, JSON, IO[bytes]
Expand Down Expand Up @@ -2354,7 +2350,7 @@ async def create_run(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **
else:
_content = json.dumps(red_team, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore

_request = build_red_teams_create_run_request(
_request = build_red_teams_create_request(
content_type=content_type,
api_version=self._config.api_version,
content=_content,
Expand Down
30 changes: 14 additions & 16 deletions sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,8 @@ class BlobReference(_Model):
"""Blob reference details.

:ivar blob_uri: Blob URI path for client to upload data. Example:
``https://blob.windows.core.net/Container/Path``. Required.
`https://blob.windows.core.net/Container/Path <https://blob.windows.core.net/Container/Path>`_.
Required.
:vartype blob_uri: str
:ivar storage_account_arm_id: ARM ID of the storage account to use. Required.
:vartype storage_account_arm_id: str
Expand All @@ -558,7 +559,8 @@ class BlobReference(_Model):
"""

blob_uri: str = rest_field(name="blobUri", visibility=["read", "create", "update", "delete", "query"])
"""Blob URI path for client to upload data. Example: ``https://blob.windows.core.net/Container/Path``. Required."""
"""Blob URI path for client to upload data. Example: `https://blob.windows.core.net/Container/Path
<https://blob.windows.core.net/Container/Path>`_. Required."""
storage_account_arm_id: str = rest_field(
name="storageAccountArmId", visibility=["read", "create", "update", "delete", "query"]
)
Expand Down Expand Up @@ -719,8 +721,7 @@ class DatasetVersion(_Model):
You probably want to use the sub-classes and not this class directly. Known sub-classes are:
FileDatasetVersion, FolderDatasetVersion

:ivar data_uri: [Required] Uri of the data. Example:
`https://go.microsoft.com/fwlink/?linkid=2202330
:ivar data_uri: URI of the data. Example: `https://go.microsoft.com/fwlink/?linkid=2202330
<https://go.microsoft.com/fwlink/?linkid=2202330>`_. Required.
:vartype data_uri: str
:ivar type: Dataset type. Required. Known values are: "uri_file" and "uri_folder".
Expand All @@ -742,7 +743,7 @@ class DatasetVersion(_Model):

__mapping__: Dict[str, _Model] = {}
data_uri: str = rest_field(name="dataUri", visibility=["read", "create"])
"""[Required] Uri of the data. Example: `https://go.microsoft.com/fwlink/?linkid=2202330
"""URI of the data. Example: `https://go.microsoft.com/fwlink/?linkid=2202330
<https://go.microsoft.com/fwlink/?linkid=2202330>`_. Required."""
type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])
"""Dataset type. Required. Known values are: \"uri_file\" and \"uri_folder\"."""
Expand Down Expand Up @@ -994,8 +995,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
class FileDatasetVersion(DatasetVersion, discriminator="uri_file"):
"""FileDatasetVersion Definition.

:ivar data_uri: [Required] Uri of the data. Example:
`https://go.microsoft.com/fwlink/?linkid=2202330
:ivar data_uri: URI of the data. Example: `https://go.microsoft.com/fwlink/?linkid=2202330
<https://go.microsoft.com/fwlink/?linkid=2202330>`_. Required.
:vartype data_uri: str
:ivar is_reference: Indicates if dataset is reference only or managed by dataset service. If
Expand Down Expand Up @@ -1041,8 +1041,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
class FolderDatasetVersion(DatasetVersion, discriminator="uri_folder"):
"""FileDatasetVersion Definition.

:ivar data_uri: [Required] Uri of the data. Example:
`https://go.microsoft.com/fwlink/?linkid=2202330
:ivar data_uri: URI of the data. Example: `https://go.microsoft.com/fwlink/?linkid=2202330
<https://go.microsoft.com/fwlink/?linkid=2202330>`_. Required.
:vartype data_uri: str
:ivar is_reference: Indicates if dataset is reference only or managed by dataset service. If
Expand Down Expand Up @@ -1327,8 +1326,8 @@ class PendingUploadResponse(_Model):
:ivar version: Version of asset to be created if user did not specify version when initially
creating upload.
:vartype version: str
:ivar pending_upload_type: TemporaryBlobReference is the only supported type. Required. Blob
Reference is the only supported type.
:ivar pending_upload_type: BlobReference is the only supported type. Required. Blob Reference
is the only supported type.
:vartype pending_upload_type: str or ~azure.ai.projects.models.BLOB_REFERENCE
"""

Expand All @@ -1345,8 +1344,7 @@ class PendingUploadResponse(_Model):
pending_upload_type: Literal[PendingUploadType.BLOB_REFERENCE] = rest_field(
name="pendingUploadType", visibility=["read", "create", "update", "delete", "query"]
)
"""TemporaryBlobReference is the only supported type. Required. Blob Reference is the only
supported type."""
"""BlobReference is the only supported type. Required. Blob Reference is the only supported type."""

@overload
def __init__(
Expand All @@ -1372,8 +1370,8 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
class RedTeam(_Model):
"""Red team details.

:ivar id: Identifier of the red team. Required.
:vartype id: str
:ivar name: Identifier of the red team. Required.
:vartype name: str
:ivar scan_name: Name of the red-team scan.
:vartype scan_name: str
:ivar num_turns: Number of simulation rounds. Required.
Expand All @@ -1400,7 +1398,7 @@ class RedTeam(_Model):
:vartype target_config: ~azure.ai.projects.models.TargetConfig
"""

id: str = rest_field(visibility=["read"])
name: str = rest_field(name="id", visibility=["read"])
"""Identifier of the red team. Required."""
scan_name: Optional[str] = rest_field(name="scanName", visibility=["read", "create", "update", "delete", "query"])
"""Name of the red-team scan."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def build_evaluations_list_request(
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)


def build_evaluations_create_run_request(**kwargs: Any) -> HttpRequest:
def build_evaluations_create_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

Expand Down Expand Up @@ -657,7 +657,7 @@ def build_red_teams_list_request(
return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs)


def build_red_teams_create_run_request(**kwargs: Any) -> HttpRequest:
def build_red_teams_create_request(**kwargs: Any) -> HttpRequest:
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

Expand Down Expand Up @@ -1137,7 +1137,7 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)

@overload
def create_run(
def create(
self, evaluation: _models.Evaluation, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Evaluation:
"""Creates an evaluation run.
Expand All @@ -1153,9 +1153,7 @@ def create_run(
"""

@overload
def create_run(
self, evaluation: JSON, *, content_type: str = "application/json", **kwargs: Any
) -> _models.Evaluation:
def create(self, evaluation: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.Evaluation:
"""Creates an evaluation run.

:param evaluation: Evaluation to be run. Required.
Expand All @@ -1169,7 +1167,7 @@ def create_run(
"""

@overload
def create_run(
def create(
self, evaluation: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.Evaluation:
"""Creates an evaluation run.
Expand All @@ -1189,7 +1187,7 @@ def create_run(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "content_type", "accept"]},
)
def create_run(self, evaluation: Union[_models.Evaluation, JSON, IO[bytes]], **kwargs: Any) -> _models.Evaluation:
def create(self, evaluation: Union[_models.Evaluation, JSON, IO[bytes]], **kwargs: Any) -> _models.Evaluation:
"""Creates an evaluation run.

:param evaluation: Evaluation to be run. Is one of the following types: Evaluation, JSON,
Expand Down Expand Up @@ -1220,7 +1218,7 @@ def create_run(self, evaluation: Union[_models.Evaluation, JSON, IO[bytes]], **k
else:
_content = json.dumps(evaluation, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore

_request = build_evaluations_create_run_request(
_request = build_evaluations_create_request(
content_type=content_type,
api_version=self._config.api_version,
content=_content,
Expand Down Expand Up @@ -2877,7 +2875,7 @@ def get_next(next_link=None):
return ItemPaged(get_next, extract_data)

@overload
def create_run(
def create(
self, red_team: _models.RedTeam, *, content_type: str = "application/json", **kwargs: Any
) -> _models.RedTeam:
"""Creates a redteam run.
Expand All @@ -2893,7 +2891,7 @@ def create_run(
"""

@overload
def create_run(self, red_team: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.RedTeam:
def create(self, red_team: JSON, *, content_type: str = "application/json", **kwargs: Any) -> _models.RedTeam:
"""Creates a redteam run.

:param red_team: Redteam to be run. Required.
Expand All @@ -2907,9 +2905,7 @@ def create_run(self, red_team: JSON, *, content_type: str = "application/json",
"""

@overload
def create_run(
self, red_team: IO[bytes], *, content_type: str = "application/json", **kwargs: Any
) -> _models.RedTeam:
def create(self, red_team: IO[bytes], *, content_type: str = "application/json", **kwargs: Any) -> _models.RedTeam:
"""Creates a redteam run.

:param red_team: Redteam to be run. Required.
Expand All @@ -2927,7 +2923,7 @@ def create_run(
method_added_on="2025-05-15-preview",
params_added_on={"2025-05-15-preview": ["api_version", "content_type", "accept"]},
)
def create_run(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: Any) -> _models.RedTeam:
def create(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs: Any) -> _models.RedTeam:
"""Creates a redteam run.

:param red_team: Redteam to be run. Is one of the following types: RedTeam, JSON, IO[bytes]
Expand Down Expand Up @@ -2958,7 +2954,7 @@ def create_run(self, red_team: Union[_models.RedTeam, JSON, IO[bytes]], **kwargs
else:
_content = json.dumps(red_team, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore

_request = build_red_teams_create_run_request(
_request = build_red_teams_create_request(
content_type=content_type,
api_version=self._config.api_version,
content=_content,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@ async def sample_connections_async() -> None:
async for connection in project_client.connections.list():
print(connection)

print("List the properties of all connections of a particular type (in this case, Azure OpenAI connections):")
print(
"List the properties of all connections of a particular type (in this case, Azure OpenAI connections):"
)
async for connection in project_client.connections.list(
connection_type=ConnectionType.AZURE_OPEN_AI,
):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
load_dotenv()

endpoint = os.environ["PROJECT_ENDPOINT"]
#dataset_name = os.environ["DATASET_NAME"]
# dataset_name = os.environ["DATASET_NAME"]

with DefaultAzureCredential(exclude_interactive_browser_credential=False) as credential:

Expand Down Expand Up @@ -70,7 +70,7 @@
data_mapping={
"query": "${data.query}",
"response": "${data.response}",
}
},
),
},
)
Expand Down
Loading
Loading