diff --git a/sdk/ai/azure-ai-projects/apiview-properties.json b/sdk/ai/azure-ai-projects/apiview-properties.json index 9c11df0bd317..29de53e42619 100644 --- a/sdk/ai/azure-ai-projects/apiview-properties.json +++ b/sdk/ai/azure-ai-projects/apiview-properties.json @@ -23,6 +23,7 @@ "azure.ai.projects.models.EntraIDCredentials": "Azure.AI.Projects.EntraIDCredentials", "azure.ai.projects.models.Evaluation": "Azure.AI.Projects.Evaluation", "azure.ai.projects.models.EvaluatorConfiguration": "Azure.AI.Projects.EvaluatorConfiguration", + "azure.ai.projects.models.FieldMapping": "Azure.AI.Projects.FieldMapping", "azure.ai.projects.models.FileDatasetVersion": "Azure.AI.Projects.FileDatasetVersion", "azure.ai.projects.models.FolderDatasetVersion": "Azure.AI.Projects.FolderDatasetVersion", "azure.ai.projects.models.InputData": "Azure.AI.Projects.InputData", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py index 3403335e6a7c..fdde994dbb53 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_operations.py @@ -106,7 +106,7 @@ def __init__(self, *args, **kwargs) -> None: async def _get(self, name: str, **kwargs: Any) -> _models.Connection: """Get a connection by name, without populating connection credentials. - :param name: The name of the resource. Required. + :param name: The friendly name of the connection, provided by the user. Required. :type name: str :return: Connection. The Connection is compatible with MutableMapping :rtype: ~azure.ai.projects.models.Connection @@ -171,7 +171,7 @@ async def _get(self, name: str, **kwargs: Any) -> _models.Connection: async def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: """Get a connection by name, with its connection credentials. - :param name: The name of the resource. Required. + :param name: The friendly name of the connection, provided by the user. Required. :type name: str :return: Connection. The Connection is compatible with MutableMapping :rtype: ~azure.ai.projects.models.Connection @@ -429,19 +429,11 @@ async def get(self, name: str, **kwargs: Any) -> _models.Evaluation: @distributed_trace @api_version_validation( method_added_on="2025-05-15-preview", - params_added_on={ - "2025-05-15-preview": ["api_version", "top", "skip", "maxpagesize", "client_request_id", "accept"] - }, + params_added_on={"2025-05-15-preview": ["api_version", "client_request_id", "accept"]}, ) - def list( - self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.Evaluation"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Evaluation"]: """List evaluation runs. - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int :return: An iterator like instance of Evaluation :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Evaluation] :raises ~azure.core.exceptions.HttpResponseError: @@ -449,7 +441,6 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Evaluation]] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -464,9 +455,6 @@ def prepare_request(next_link=None): if not next_link: _request = build_evaluations_list_request( - top=top, - skip=skip, - maxpagesize=maxpagesize, api_version=self._config.api_version, headers=_headers, params=_params, @@ -789,16 +777,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_versions( - self, name: str, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.DatasetVersion"]: + def list_versions(self, name: str, **kwargs: Any) -> AsyncIterable["_models.DatasetVersion"]: """List all versions of the given DatasetVersion. :param name: The name of the resource. Required. :type name: str - :keyword continuation_token_parameter: Continuation token for pagination. Default value is - None. - :paramtype continuation_token_parameter: str :return: An iterator like instance of DatasetVersion :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: @@ -821,7 +804,6 @@ def prepare_request(next_link=None): _request = build_datasets_list_versions_request( name=name, - continuation_token_parameter=continuation_token_parameter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -880,14 +862,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list( - self, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.DatasetVersion"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.DatasetVersion"]: """List the latest version of each DatasetVersion. - :keyword continuation_token_parameter: Continuation token for pagination. Default value is - None. - :paramtype continuation_token_parameter: str :return: An iterator like instance of DatasetVersion :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: @@ -909,7 +886,6 @@ def prepare_request(next_link=None): if not next_link: _request = build_datasets_list_request( - continuation_token_parameter=continuation_token_parameter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1088,7 +1064,7 @@ async def create_or_update( version: str, body: _models.DatasetVersion, *, - content_type: str = "application/json", + content_type: str = "application/merge-patch+json", **kwargs: Any ) -> _models.DatasetVersion: """Create a new or update an existing DatasetVersion with the given version id. @@ -1100,7 +1076,7 @@ async def create_or_update( :param body: The definition of the DatasetVersion to create or update. Required. :type body: ~azure.ai.projects.models.DatasetVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DatasetVersion @@ -1109,7 +1085,7 @@ async def create_or_update( @overload async def create_or_update( - self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, name: str, version: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any ) -> _models.DatasetVersion: """Create a new or update an existing DatasetVersion with the given version id. @@ -1120,7 +1096,7 @@ async def create_or_update( :param body: The definition of the DatasetVersion to create or update. Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DatasetVersion @@ -1129,7 +1105,13 @@ async def create_or_update( @overload async def create_or_update( - self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any ) -> _models.DatasetVersion: """Create a new or update an existing DatasetVersion with the given version id. @@ -1140,7 +1122,7 @@ async def create_or_update( :param body: The definition of the DatasetVersion to create or update. Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DatasetVersion @@ -1178,7 +1160,7 @@ async def create_or_update( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/merge-patch+json" _content = None if isinstance(body, (IOBase, bytes)): _content = body @@ -1370,17 +1352,13 @@ async def pending_upload( return deserialized # type: ignore @distributed_trace_async - async def get_credentials( - self, name: str, version: str, body: Any, **kwargs: Any - ) -> _models.AssetCredentialResponse: + async def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.AssetCredentialResponse: """Get the SAS credential to access the storage account associated with a Dataset version. :param name: The name of the resource. Required. :type name: str :param version: The specific version id of the DatasetVersion to operate on. Required. :type version: str - :param body: Parameters for the action. Required. - :type body: any :return: AssetCredentialResponse. The AssetCredentialResponse is compatible with MutableMapping :rtype: ~azure.ai.projects.models.AssetCredentialResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -1393,20 +1371,15 @@ async def get_credentials( } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.AssetCredentialResponse] = kwargs.pop("cls", None) - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_datasets_get_credentials_request( name=name, version=version, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -1460,16 +1433,11 @@ def __init__(self, *args, **kwargs) -> None: self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_versions( - self, name: str, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Index"]: + def list_versions(self, name: str, **kwargs: Any) -> AsyncIterable["_models.Index"]: """List all versions of the given Index. :param name: The name of the resource. Required. :type name: str - :keyword continuation_token_parameter: Continuation token for pagination. Default value is - None. - :paramtype continuation_token_parameter: str :return: An iterator like instance of Index :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Index] :raises ~azure.core.exceptions.HttpResponseError: @@ -1492,7 +1460,6 @@ def prepare_request(next_link=None): _request = build_indexes_list_versions_request( name=name, - continuation_token_parameter=continuation_token_parameter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1551,14 +1518,9 @@ async def get_next(next_link=None): return AsyncItemPaged(get_next, extract_data) @distributed_trace - def list( - self, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> AsyncIterable["_models.Index"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.Index"]: """List the latest version of each Index. - :keyword continuation_token_parameter: Continuation token for pagination. Default value is - None. - :paramtype continuation_token_parameter: str :return: An iterator like instance of Index :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Index] :raises ~azure.core.exceptions.HttpResponseError: @@ -1580,7 +1542,6 @@ def prepare_request(next_link=None): if not next_link: _request = build_indexes_list_request( - continuation_token_parameter=continuation_token_parameter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1754,7 +1715,13 @@ async def delete(self, name: str, version: str, **kwargs: Any) -> None: @overload async def create_or_update( - self, name: str, version: str, body: _models.Index, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + body: _models.Index, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any ) -> _models.Index: """Create a new or update an existing Index with the given version id. @@ -1765,7 +1732,7 @@ async def create_or_update( :param body: The definition of the Index to create or update. Required. :type body: ~azure.ai.projects.models.Index :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: Index. The Index is compatible with MutableMapping :rtype: ~azure.ai.projects.models.Index @@ -1774,7 +1741,7 @@ async def create_or_update( @overload async def create_or_update( - self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, name: str, version: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any ) -> _models.Index: """Create a new or update an existing Index with the given version id. @@ -1785,7 +1752,7 @@ async def create_or_update( :param body: The definition of the Index to create or update. Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: Index. The Index is compatible with MutableMapping :rtype: ~azure.ai.projects.models.Index @@ -1794,7 +1761,13 @@ async def create_or_update( @overload async def create_or_update( - self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any ) -> _models.Index: """Create a new or update an existing Index with the given version id. @@ -1805,7 +1778,7 @@ async def create_or_update( :param body: The definition of the Index to create or update. Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: Index. The Index is compatible with MutableMapping :rtype: ~azure.ai.projects.models.Index @@ -1843,7 +1816,7 @@ async def create_or_update( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Index] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/merge-patch+json" _content = None if isinstance(body, (IOBase, bytes)): _content = body @@ -1980,8 +1953,6 @@ def list( model_publisher: Optional[str] = None, model_name: Optional[str] = None, deployment_type: Optional[Union[str, _models.DeploymentType]] = None, - top: Optional[int] = None, - skip: Optional[int] = None, **kwargs: Any ) -> AsyncIterable["_models.Deployment"]: """List all deployed models in the project. @@ -1994,10 +1965,6 @@ def list( :keyword deployment_type: Type of deployment to filter list by. "ModelDeployment" Default value is None. :paramtype deployment_type: str or ~azure.ai.projects.models.DeploymentType - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int :return: An iterator like instance of Deployment :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: @@ -2005,7 +1972,6 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -2023,9 +1989,6 @@ def prepare_request(next_link=None): model_publisher=model_publisher, model_name=model_name, deployment_type=deployment_type, - top=top, - skip=skip, - maxpagesize=maxpagesize, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2109,7 +2072,7 @@ def __init__(self, *args, **kwargs) -> None: async def get(self, name: str, **kwargs: Any) -> _models.RedTeam: """Get a redteam by name. - :param name: Identifier of the red team. Required. + :param name: Identifier of the red team run. Required. :type name: str :return: RedTeam. The RedTeam is compatible with MutableMapping :rtype: ~azure.ai.projects.models.RedTeam @@ -2173,19 +2136,11 @@ async def get(self, name: str, **kwargs: Any) -> _models.RedTeam: @distributed_trace @api_version_validation( method_added_on="2025-05-15-preview", - params_added_on={ - "2025-05-15-preview": ["api_version", "top", "skip", "maxpagesize", "client_request_id", "accept"] - }, + params_added_on={"2025-05-15-preview": ["api_version", "client_request_id", "accept"]}, ) - def list( - self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> AsyncIterable["_models.RedTeam"]: + def list(self, **kwargs: Any) -> AsyncIterable["_models.RedTeam"]: """List a redteam by name. - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int :return: An iterator like instance of RedTeam :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.ai.projects.models.RedTeam] :raises ~azure.core.exceptions.HttpResponseError: @@ -2193,7 +2148,6 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.RedTeam]] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -2208,9 +2162,6 @@ def prepare_request(next_link=None): if not next_link: _request = build_red_teams_list_request( - top=top, - skip=skip, - maxpagesize=maxpagesize, api_version=self._config.api_version, headers=_headers, params=_params, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_inference_async.py b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_inference_async.py index b1e296e2c5c4..bd15f1c89b93 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_inference_async.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/aio/operations/_patch_inference_async.py @@ -242,6 +242,7 @@ async def get_azure_openai_client( connection = await connections.__aiter__().__anext__() except StopAsyncIteration as exc: raise ResourceNotFoundError("No default Azure OpenAI connection found.") from exc + connection_name = connection.name # TODO: if there isn't a default openai connection, we would have to by convention # use https://{resource-name}.openai.azure.com where {resource-name} is the same as the diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py index 039f4eeef11a..ccef4d93c51f 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py @@ -34,6 +34,7 @@ EntraIDCredentials, Evaluation, EvaluatorConfiguration, + FieldMapping, FileDatasetVersion, FolderDatasetVersion, Index, @@ -86,6 +87,7 @@ "EntraIDCredentials", "Evaluation", "EvaluatorConfiguration", + "FieldMapping", "FileDatasetVersion", "FolderDatasetVersion", "Index", diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py index 5b73a805119b..1a7dd4435fbd 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py @@ -165,6 +165,8 @@ class AgentEvaluationResult(_Model): :ivar evaluator: Evaluator's name. This is the name of the evaluator that was used to evaluate the agent's completion. Required. :vartype evaluator: str + :ivar evaluator_id: Identifier of the evaluator. Required. + :vartype evaluator_id: str :ivar score: Score of the given evaluator. No restriction on range. Required. :vartype score: float :ivar status: Status of the evaluator result. Options: Running, Completed, Failed, @@ -188,6 +190,8 @@ class AgentEvaluationResult(_Model): evaluator: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Evaluator's name. This is the name of the evaluator that was used to evaluate the agent's completion. Required.""" + evaluator_id: str = rest_field(name="evaluatorId", visibility=["read", "create", "update", "delete", "query"]) + """Identifier of the evaluator. Required.""" score: float = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Score of the given evaluator. No restriction on range. Required.""" status: str = rest_field(visibility=["read", "create", "update", "delete", "query"]) @@ -212,6 +216,7 @@ def __init__( self, *, evaluator: str, + evaluator_id: str, score: float, status: str, run_id: str, @@ -445,6 +450,8 @@ class AzureAISearchIndex(Index, discriminator="AzureSearch"): :vartype connection_name: str :ivar index_name: Name of index in Azure AI Search resource to attach. Required. :vartype index_name: str + :ivar field_mapping: Field mapping configuration. + :vartype field_mapping: ~azure.ai.projects.models.FieldMapping """ type: Literal[IndexType.AZURE_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -453,6 +460,8 @@ class AzureAISearchIndex(Index, discriminator="AzureSearch"): """Name of connection to Azure AI Search. Required.""" index_name: str = rest_field(name="indexName", visibility=["create"]) """Name of index in Azure AI Search resource to attach. Required.""" + field_mapping: Optional["_models.FieldMapping"] = rest_field(name="fieldMapping", visibility=["create"]) + """Field mapping configuration.""" @overload def __init__( @@ -462,6 +471,7 @@ def __init__( index_name: str, description: Optional[str] = None, tags: Optional[Dict[str, str]] = None, + field_mapping: Optional["_models.FieldMapping"] = None, ) -> None: ... @overload @@ -589,8 +599,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class Connection(_Model): """Response from the list and get connections operations. - :ivar name: The name of the resource. Required. + :ivar name: The friendly name of the connection, provided by the user. Required. :vartype name: str + :ivar id: A unique identifier for the connection, generated by the service. Required. + :vartype id: str :ivar type: Category of the connection. Required. Known values are: "AzureOpenAI", "AzureBlob", "AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", "AppConfig", "AppInsights", and "CustomKeys". @@ -607,7 +619,9 @@ class Connection(_Model): """ name: str = rest_field(visibility=["read"]) - """The name of the resource. Required.""" + """The friendly name of the connection, provided by the user. Required.""" + id: str = rest_field(visibility=["read"]) + """A unique identifier for the connection, generated by the service. Required.""" type: Union[str, "_models.ConnectionType"] = rest_field(visibility=["read"]) """Category of the connection. Required. Known values are: \"AzureOpenAI\", \"AzureBlob\", \"AzureStorageAccount\", \"CognitiveSearch\", \"CosmosDB\", \"ApiKey\", \"AppConfig\", @@ -645,6 +659,8 @@ class CosmosDBIndex(Index, discriminator="CosmosDBNoSqlVectorStore"): :vartype container_name: str :ivar embedding_configuration: Embedding model configuration. Required. :vartype embedding_configuration: ~azure.ai.projects.models.EmbeddingConfiguration + :ivar field_mapping: Field mapping configuration. Required. + :vartype field_mapping: ~azure.ai.projects.models.FieldMapping """ type: Literal[IndexType.COSMOS_DB] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore @@ -659,6 +675,8 @@ class CosmosDBIndex(Index, discriminator="CosmosDBNoSqlVectorStore"): name="embeddingConfiguration", visibility=["create"] ) """Embedding model configuration. Required.""" + field_mapping: "_models.FieldMapping" = rest_field(name="fieldMapping", visibility=["create"]) + """Field mapping configuration. Required.""" @overload def __init__( @@ -668,6 +686,7 @@ def __init__( database_name: str, container_name: str, embedding_configuration: "_models.EmbeddingConfiguration", + field_mapping: "_models.FieldMapping", description: Optional[str] = None, tags: Optional[Dict[str, str]] = None, ) -> None: ... @@ -988,6 +1007,59 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) +class FieldMapping(_Model): + """Field mapping configuration class. + + :ivar content_fields: List of fields with text content. Required. + :vartype content_fields: list[str] + :ivar filepath_field: Path of file to be used as a source of text content. + :vartype filepath_field: str + :ivar title_field: Field containing the title of the document. + :vartype title_field: str + :ivar url_field: Field containing the url of the document. + :vartype url_field: str + :ivar vector_fields: List of fields with vector content. + :vartype vector_fields: list[str] + :ivar metadata_fields: List of fields with metadata content. + :vartype metadata_fields: list[str] + """ + + content_fields: List[str] = rest_field(name="contentFields", visibility=["create"]) + """List of fields with text content. Required.""" + filepath_field: Optional[str] = rest_field(name="filepathField", visibility=["create"]) + """Path of file to be used as a source of text content.""" + title_field: Optional[str] = rest_field(name="titleField", visibility=["create"]) + """Field containing the title of the document.""" + url_field: Optional[str] = rest_field(name="urlField", visibility=["create"]) + """Field containing the url of the document.""" + vector_fields: Optional[List[str]] = rest_field(name="vectorFields", visibility=["create"]) + """List of fields with vector content.""" + metadata_fields: Optional[List[str]] = rest_field(name="metadataFields", visibility=["create"]) + """List of fields with metadata content.""" + + @overload + def __init__( + self, + *, + content_fields: List[str], + filepath_field: Optional[str] = None, + title_field: Optional[str] = None, + url_field: Optional[str] = None, + vector_fields: Optional[List[str]] = None, + metadata_fields: Optional[List[str]] = None, + ) -> 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 FileDatasetVersion(DatasetVersion, discriminator="uri_file"): """FileDatasetVersion Definition. @@ -1364,19 +1436,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: class RedTeam(_Model): """Red team details. - :ivar name: Identifier of the red team. Required. + :ivar name: Identifier of the red team run. 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. + :ivar display_name: Name of the red-team run. + :vartype display_name: str + :ivar num_turns: Number of simulation rounds. :vartype num_turns: int :ivar attack_strategies: List of attack strategies or nested lists of attack strategies. - Required. :vartype attack_strategies: list[str or ~azure.ai.projects.models.AttackStrategy] :ivar simulation_only: Simulation-only or Simulation + Evaluation. Default false, if true the - scan outputs conversation not evaluation result. Required. + scan outputs conversation not evaluation result. :vartype simulation_only: bool - :ivar risk_categories: List of risk categories to generate attack objectives for. Required. + :ivar risk_categories: List of risk categories to generate attack objectives for. :vartype risk_categories: list[str or ~azure.ai.projects.models.RiskCategory] :ivar application_scenario: Application scenario for the red team operation, to generate scenario specific attacks. @@ -1388,29 +1459,31 @@ class RedTeam(_Model): :vartype properties: dict[str, str] :ivar status: Status of the red-team. It is set by service and is read-only. :vartype status: str - :ivar target_config: Target configuration for the red-team run. Required. - :vartype target_config: ~azure.ai.projects.models.TargetConfig + :ivar target: Target configuration for the red-team run. Required. + :vartype target: ~azure.ai.projects.models.TargetConfig """ 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.""" - num_turns: int = rest_field(name="numTurns", visibility=["read", "create", "update", "delete", "query"]) - """Number of simulation rounds. Required.""" - attack_strategies: List[Union[str, "_models.AttackStrategy"]] = rest_field( + """Identifier of the red team run. Required.""" + display_name: Optional[str] = rest_field( + name="displayName", visibility=["read", "create", "update", "delete", "query"] + ) + """Name of the red-team run.""" + num_turns: Optional[int] = rest_field(name="numTurns", visibility=["read", "create", "update", "delete", "query"]) + """Number of simulation rounds.""" + attack_strategies: Optional[List[Union[str, "_models.AttackStrategy"]]] = rest_field( name="attackStrategies", visibility=["read", "create", "update", "delete", "query"] ) - """List of attack strategies or nested lists of attack strategies. Required.""" - simulation_only: bool = rest_field( + """List of attack strategies or nested lists of attack strategies.""" + simulation_only: Optional[bool] = rest_field( name="simulationOnly", visibility=["read", "create", "update", "delete", "query"] ) """Simulation-only or Simulation + Evaluation. Default false, if true the scan outputs - conversation not evaluation result. Required.""" - risk_categories: List[Union[str, "_models.RiskCategory"]] = rest_field( + conversation not evaluation result.""" + risk_categories: Optional[List[Union[str, "_models.RiskCategory"]]] = rest_field( name="riskCategories", visibility=["read", "create", "update", "delete", "query"] ) - """List of risk categories to generate attack objectives for. Required.""" + """List of risk categories to generate attack objectives for.""" application_scenario: Optional[str] = rest_field( name="applicationScenario", visibility=["read", "create", "update", "delete", "query"] ) @@ -1422,21 +1495,19 @@ class RedTeam(_Model): removed.""" status: Optional[str] = rest_field(visibility=["read"]) """Status of the red-team. It is set by service and is read-only.""" - target_config: "_models.TargetConfig" = rest_field( - name="targetConfig", visibility=["read", "create", "update", "delete", "query"] - ) + target: "_models.TargetConfig" = rest_field(visibility=["read", "create", "update", "delete", "query"]) """Target configuration for the red-team run. Required.""" @overload def __init__( self, *, - num_turns: int, - attack_strategies: List[Union[str, "_models.AttackStrategy"]], - simulation_only: bool, - risk_categories: List[Union[str, "_models.RiskCategory"]], - target_config: "_models.TargetConfig", - scan_name: Optional[str] = None, + target: "_models.TargetConfig", + display_name: Optional[str] = None, + num_turns: Optional[int] = None, + attack_strategies: Optional[List[Union[str, "_models.AttackStrategy"]]] = None, + simulation_only: Optional[bool] = None, + risk_categories: Optional[List[Union[str, "_models.RiskCategory"]]] = None, application_scenario: Optional[str] = None, tags: Optional[Dict[str, str]] = None, properties: Optional[Dict[str, str]] = None, diff --git a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py index 8369d6fa8821..3da63caf5f14 100644 --- a/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py +++ b/sdk/ai/azure-ai-projects/azure/ai/projects/operations/_operations.py @@ -154,9 +154,7 @@ def build_evaluations_get_request(name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_evaluations_list_request( - *, top: Optional[int] = None, skip: Optional[int] = None, maxpagesize: Optional[int] = None, **kwargs: Any -) -> HttpRequest: +def build_evaluations_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -168,12 +166,6 @@ def build_evaluations_list_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["top"] = _SERIALIZER.query("top", top, "int") - if skip is not None: - _params["skip"] = _SERIALIZER.query("skip", skip, "int") - if maxpagesize is not None: - _params["maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -225,9 +217,7 @@ def build_evaluations_create_agent_evaluation_request(**kwargs: Any) -> HttpRequ return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_datasets_list_versions_request( - name: str, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_datasets_list_versions_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -244,10 +234,6 @@ def build_datasets_list_versions_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if continuation_token_parameter is not None: - _params["continuationToken"] = _SERIALIZER.query( - "continuation_token_parameter", continuation_token_parameter, "str" - ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -255,7 +241,7 @@ def build_datasets_list_versions_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_datasets_list_request(*, continuation_token_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_datasets_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -267,10 +253,6 @@ def build_datasets_list_request(*, continuation_token_parameter: Optional[str] = # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if continuation_token_parameter is not None: - _params["continuationToken"] = _SERIALIZER.query( - "continuation_token_parameter", continuation_token_parameter, "str" - ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -388,7 +370,6 @@ def build_datasets_get_credentials_request(name: str, version: str, **kwargs: An _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - content_type: str = kwargs.pop("content_type") api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-05-15-preview")) accept = _headers.pop("Accept", "application/json") @@ -405,15 +386,12 @@ def build_datasets_get_credentials_request(name: str, version: str, **kwargs: An _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") # Construct headers - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) -def build_indexes_list_versions_request( - name: str, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any -) -> HttpRequest: +def build_indexes_list_versions_request(name: str, **kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -430,10 +408,6 @@ def build_indexes_list_versions_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if continuation_token_parameter is not None: - _params["continuationToken"] = _SERIALIZER.query( - "continuation_token_parameter", continuation_token_parameter, "str" - ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -441,7 +415,7 @@ def build_indexes_list_versions_request( return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_indexes_list_request(*, continuation_token_parameter: Optional[str] = None, **kwargs: Any) -> HttpRequest: +def build_indexes_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -453,10 +427,6 @@ def build_indexes_list_request(*, continuation_token_parameter: Optional[str] = # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if continuation_token_parameter is not None: - _params["continuationToken"] = _SERIALIZER.query( - "continuation_token_parameter", continuation_token_parameter, "str" - ) # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -571,9 +541,6 @@ def build_deployments_list_request( model_publisher: Optional[str] = None, model_name: Optional[str] = None, deployment_type: Optional[Union[str, _models.DeploymentType]] = None, - top: Optional[int] = None, - skip: Optional[int] = None, - maxpagesize: Optional[int] = None, **kwargs: Any ) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) @@ -593,12 +560,6 @@ def build_deployments_list_request( _params["modelName"] = _SERIALIZER.query("model_name", model_name, "str") if deployment_type is not None: _params["deploymentType"] = _SERIALIZER.query("deployment_type", deployment_type, "str") - if top is not None: - _params["top"] = _SERIALIZER.query("top", top, "int") - if skip is not None: - _params["skip"] = _SERIALIZER.query("skip", skip, "int") - if maxpagesize is not None: - _params["maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -630,9 +591,7 @@ def build_red_teams_get_request(name: str, **kwargs: Any) -> HttpRequest: return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) -def build_red_teams_list_request( - *, top: Optional[int] = None, skip: Optional[int] = None, maxpagesize: Optional[int] = None, **kwargs: Any -) -> HttpRequest: +def build_red_teams_list_request(**kwargs: Any) -> HttpRequest: _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) @@ -644,12 +603,6 @@ def build_red_teams_list_request( # Construct parameters _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - if top is not None: - _params["top"] = _SERIALIZER.query("top", top, "int") - if skip is not None: - _params["skip"] = _SERIALIZER.query("skip", skip, "int") - if maxpagesize is not None: - _params["maxpagesize"] = _SERIALIZER.query("maxpagesize", maxpagesize, "int") # Construct headers _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") @@ -718,7 +671,7 @@ def __init__(self, *args, **kwargs): def _get(self, name: str, **kwargs: Any) -> _models.Connection: """Get a connection by name, without populating connection credentials. - :param name: The name of the resource. Required. + :param name: The friendly name of the connection, provided by the user. Required. :type name: str :return: Connection. The Connection is compatible with MutableMapping :rtype: ~azure.ai.projects.models.Connection @@ -783,7 +736,7 @@ def _get(self, name: str, **kwargs: Any) -> _models.Connection: def _get_with_credentials(self, name: str, **kwargs: Any) -> _models.Connection: """Get a connection by name, with its connection credentials. - :param name: The name of the resource. Required. + :param name: The friendly name of the connection, provided by the user. Required. :type name: str :return: Connection. The Connection is compatible with MutableMapping :rtype: ~azure.ai.projects.models.Connection @@ -1041,19 +994,11 @@ def get(self, name: str, **kwargs: Any) -> _models.Evaluation: @distributed_trace @api_version_validation( method_added_on="2025-05-15-preview", - params_added_on={ - "2025-05-15-preview": ["api_version", "top", "skip", "maxpagesize", "client_request_id", "accept"] - }, + params_added_on={"2025-05-15-preview": ["api_version", "client_request_id", "accept"]}, ) - def list( - self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.Evaluation"]: + def list(self, **kwargs: Any) -> Iterable["_models.Evaluation"]: """List evaluation runs. - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int :return: An iterator like instance of Evaluation :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Evaluation] :raises ~azure.core.exceptions.HttpResponseError: @@ -1061,7 +1006,6 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Evaluation]] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -1076,9 +1020,6 @@ def prepare_request(next_link=None): if not next_link: _request = build_evaluations_list_request( - top=top, - skip=skip, - maxpagesize=maxpagesize, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1399,16 +1340,11 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_versions( - self, name: str, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.DatasetVersion"]: + def list_versions(self, name: str, **kwargs: Any) -> Iterable["_models.DatasetVersion"]: """List all versions of the given DatasetVersion. :param name: The name of the resource. Required. :type name: str - :keyword continuation_token_parameter: Continuation token for pagination. Default value is - None. - :paramtype continuation_token_parameter: str :return: An iterator like instance of DatasetVersion :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: @@ -1431,7 +1367,6 @@ def prepare_request(next_link=None): _request = build_datasets_list_versions_request( name=name, - continuation_token_parameter=continuation_token_parameter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1490,14 +1425,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list( - self, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.DatasetVersion"]: + def list(self, **kwargs: Any) -> Iterable["_models.DatasetVersion"]: """List the latest version of each DatasetVersion. - :keyword continuation_token_parameter: Continuation token for pagination. Default value is - None. - :paramtype continuation_token_parameter: str :return: An iterator like instance of DatasetVersion :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.DatasetVersion] :raises ~azure.core.exceptions.HttpResponseError: @@ -1519,7 +1449,6 @@ def prepare_request(next_link=None): if not next_link: _request = build_datasets_list_request( - continuation_token_parameter=continuation_token_parameter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -1698,7 +1627,7 @@ def create_or_update( version: str, body: _models.DatasetVersion, *, - content_type: str = "application/json", + content_type: str = "application/merge-patch+json", **kwargs: Any ) -> _models.DatasetVersion: """Create a new or update an existing DatasetVersion with the given version id. @@ -1710,7 +1639,7 @@ def create_or_update( :param body: The definition of the DatasetVersion to create or update. Required. :type body: ~azure.ai.projects.models.DatasetVersion :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DatasetVersion @@ -1719,7 +1648,7 @@ def create_or_update( @overload def create_or_update( - self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, name: str, version: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any ) -> _models.DatasetVersion: """Create a new or update an existing DatasetVersion with the given version id. @@ -1730,7 +1659,7 @@ def create_or_update( :param body: The definition of the DatasetVersion to create or update. Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DatasetVersion @@ -1739,7 +1668,13 @@ def create_or_update( @overload def create_or_update( - self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any ) -> _models.DatasetVersion: """Create a new or update an existing DatasetVersion with the given version id. @@ -1750,7 +1685,7 @@ def create_or_update( :param body: The definition of the DatasetVersion to create or update. Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: DatasetVersion. The DatasetVersion is compatible with MutableMapping :rtype: ~azure.ai.projects.models.DatasetVersion @@ -1788,7 +1723,7 @@ def create_or_update( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.DatasetVersion] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/merge-patch+json" _content = None if isinstance(body, (IOBase, bytes)): _content = body @@ -1980,15 +1915,13 @@ def pending_upload( return deserialized # type: ignore @distributed_trace - def get_credentials(self, name: str, version: str, body: Any, **kwargs: Any) -> _models.AssetCredentialResponse: + def get_credentials(self, name: str, version: str, **kwargs: Any) -> _models.AssetCredentialResponse: """Get the SAS credential to access the storage account associated with a Dataset version. :param name: The name of the resource. Required. :type name: str :param version: The specific version id of the DatasetVersion to operate on. Required. :type version: str - :param body: Parameters for the action. Required. - :type body: any :return: AssetCredentialResponse. The AssetCredentialResponse is compatible with MutableMapping :rtype: ~azure.ai.projects.models.AssetCredentialResponse :raises ~azure.core.exceptions.HttpResponseError: @@ -2001,20 +1934,15 @@ def get_credentials(self, name: str, version: str, body: Any, **kwargs: Any) -> } error_map.update(kwargs.pop("error_map", {}) or {}) - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - content_type: str = kwargs.pop("content_type", _headers.pop("Content-Type", "application/json")) cls: ClsType[_models.AssetCredentialResponse] = kwargs.pop("cls", None) - _content = json.dumps(body, cls=SdkJSONEncoder, exclude_readonly=True) # type: ignore - _request = build_datasets_get_credentials_request( name=name, version=version, - content_type=content_type, api_version=self._config.api_version, - content=_content, headers=_headers, params=_params, ) @@ -2068,16 +1996,11 @@ def __init__(self, *args, **kwargs): self._deserialize: Deserializer = input_args.pop(0) if input_args else kwargs.pop("deserializer") @distributed_trace - def list_versions( - self, name: str, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any - ) -> Iterable["_models.Index"]: + def list_versions(self, name: str, **kwargs: Any) -> Iterable["_models.Index"]: """List all versions of the given Index. :param name: The name of the resource. Required. :type name: str - :keyword continuation_token_parameter: Continuation token for pagination. Default value is - None. - :paramtype continuation_token_parameter: str :return: An iterator like instance of Index :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Index] :raises ~azure.core.exceptions.HttpResponseError: @@ -2100,7 +2023,6 @@ def prepare_request(next_link=None): _request = build_indexes_list_versions_request( name=name, - continuation_token_parameter=continuation_token_parameter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2159,12 +2081,9 @@ def get_next(next_link=None): return ItemPaged(get_next, extract_data) @distributed_trace - def list(self, *, continuation_token_parameter: Optional[str] = None, **kwargs: Any) -> Iterable["_models.Index"]: + def list(self, **kwargs: Any) -> Iterable["_models.Index"]: """List the latest version of each Index. - :keyword continuation_token_parameter: Continuation token for pagination. Default value is - None. - :paramtype continuation_token_parameter: str :return: An iterator like instance of Index :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Index] :raises ~azure.core.exceptions.HttpResponseError: @@ -2186,7 +2105,6 @@ def prepare_request(next_link=None): if not next_link: _request = build_indexes_list_request( - continuation_token_parameter=continuation_token_parameter, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2360,7 +2278,13 @@ def delete(self, name: str, version: str, **kwargs: Any) -> None: # pylint: dis @overload def create_or_update( - self, name: str, version: str, body: _models.Index, *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + body: _models.Index, + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any ) -> _models.Index: """Create a new or update an existing Index with the given version id. @@ -2371,7 +2295,7 @@ def create_or_update( :param body: The definition of the Index to create or update. Required. :type body: ~azure.ai.projects.models.Index :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: Index. The Index is compatible with MutableMapping :rtype: ~azure.ai.projects.models.Index @@ -2380,7 +2304,7 @@ def create_or_update( @overload def create_or_update( - self, name: str, version: str, body: JSON, *, content_type: str = "application/json", **kwargs: Any + self, name: str, version: str, body: JSON, *, content_type: str = "application/merge-patch+json", **kwargs: Any ) -> _models.Index: """Create a new or update an existing Index with the given version id. @@ -2391,7 +2315,7 @@ def create_or_update( :param body: The definition of the Index to create or update. Required. :type body: JSON :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: Index. The Index is compatible with MutableMapping :rtype: ~azure.ai.projects.models.Index @@ -2400,7 +2324,13 @@ def create_or_update( @overload def create_or_update( - self, name: str, version: str, body: IO[bytes], *, content_type: str = "application/json", **kwargs: Any + self, + name: str, + version: str, + body: IO[bytes], + *, + content_type: str = "application/merge-patch+json", + **kwargs: Any ) -> _models.Index: """Create a new or update an existing Index with the given version id. @@ -2411,7 +2341,7 @@ def create_or_update( :param body: The definition of the Index to create or update. Required. :type body: IO[bytes] :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". + Default value is "application/merge-patch+json". :paramtype content_type: str :return: Index. The Index is compatible with MutableMapping :rtype: ~azure.ai.projects.models.Index @@ -2449,7 +2379,7 @@ def create_or_update( content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Index] = kwargs.pop("cls", None) - content_type = content_type or "application/json" + content_type = content_type or "application/merge-patch+json" _content = None if isinstance(body, (IOBase, bytes)): _content = body @@ -2586,8 +2516,6 @@ def list( model_publisher: Optional[str] = None, model_name: Optional[str] = None, deployment_type: Optional[Union[str, _models.DeploymentType]] = None, - top: Optional[int] = None, - skip: Optional[int] = None, **kwargs: Any ) -> Iterable["_models.Deployment"]: """List all deployed models in the project. @@ -2600,10 +2528,6 @@ def list( :keyword deployment_type: Type of deployment to filter list by. "ModelDeployment" Default value is None. :paramtype deployment_type: str or ~azure.ai.projects.models.DeploymentType - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int :return: An iterator like instance of Deployment :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.Deployment] :raises ~azure.core.exceptions.HttpResponseError: @@ -2611,7 +2535,6 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.Deployment]] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -2629,9 +2552,6 @@ def prepare_request(next_link=None): model_publisher=model_publisher, model_name=model_name, deployment_type=deployment_type, - top=top, - skip=skip, - maxpagesize=maxpagesize, api_version=self._config.api_version, headers=_headers, params=_params, @@ -2715,7 +2635,7 @@ def __init__(self, *args, **kwargs): def get(self, name: str, **kwargs: Any) -> _models.RedTeam: """Get a redteam by name. - :param name: Identifier of the red team. Required. + :param name: Identifier of the red team run. Required. :type name: str :return: RedTeam. The RedTeam is compatible with MutableMapping :rtype: ~azure.ai.projects.models.RedTeam @@ -2779,19 +2699,11 @@ def get(self, name: str, **kwargs: Any) -> _models.RedTeam: @distributed_trace @api_version_validation( method_added_on="2025-05-15-preview", - params_added_on={ - "2025-05-15-preview": ["api_version", "top", "skip", "maxpagesize", "client_request_id", "accept"] - }, + params_added_on={"2025-05-15-preview": ["api_version", "client_request_id", "accept"]}, ) - def list( - self, *, top: Optional[int] = None, skip: Optional[int] = None, **kwargs: Any - ) -> Iterable["_models.RedTeam"]: + def list(self, **kwargs: Any) -> Iterable["_models.RedTeam"]: """List a redteam by name. - :keyword top: The number of result items to return. Default value is None. - :paramtype top: int - :keyword skip: The number of result items to skip. Default value is None. - :paramtype skip: int :return: An iterator like instance of RedTeam :rtype: ~azure.core.paging.ItemPaged[~azure.ai.projects.models.RedTeam] :raises ~azure.core.exceptions.HttpResponseError: @@ -2799,7 +2711,6 @@ def list( _headers = kwargs.pop("headers", {}) or {} _params = kwargs.pop("params", {}) or {} - maxpagesize = kwargs.pop("maxpagesize", None) cls: ClsType[List[_models.RedTeam]] = kwargs.pop("cls", None) error_map: MutableMapping = { @@ -2814,9 +2725,6 @@ def prepare_request(next_link=None): if not next_link: _request = build_red_teams_list_request( - top=top, - skip=skip, - maxpagesize=maxpagesize, api_version=self._config.api_version, headers=_headers, params=_params, diff --git a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_datasets_operations.py b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_datasets_operations.py index 5e0e69ef17c0..c148f824e765 100644 --- a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_datasets_operations.py +++ b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_datasets_operations.py @@ -98,8 +98,6 @@ def test_datasets_get_credentials(self, aiproject_endpoint): response = client.datasets.get_credentials( name="str", version="str", - body={}, - content_type="str", ) # please add some check logic here by yourself diff --git a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_datasets_operations_async.py b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_datasets_operations_async.py index cc376ebdc30f..1aafb652e6b4 100644 --- a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_datasets_operations_async.py +++ b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_datasets_operations_async.py @@ -99,8 +99,6 @@ async def test_datasets_get_credentials(self, aiproject_endpoint): response = await client.datasets.get_credentials( name="str", version="str", - body={}, - content_type="str", ) # please add some check logic here by yourself diff --git a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_indexes_operations.py b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_indexes_operations.py index f1e0b52229fb..82f33d5188bd 100644 --- a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_indexes_operations.py +++ b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_indexes_operations.py @@ -70,6 +70,14 @@ def test_indexes_create_or_update(self, aiproject_endpoint): "type": "AzureSearch", "version": "str", "description": "str", + "fieldMapping": { + "contentFields": ["str"], + "filepathField": "str", + "metadataFields": ["str"], + "titleField": "str", + "urlField": "str", + "vectorFields": ["str"], + }, "id": "str", "tags": {"str": "str"}, }, diff --git a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_indexes_operations_async.py b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_indexes_operations_async.py index 08e0557a29e5..53812b80aa1d 100644 --- a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_indexes_operations_async.py +++ b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_indexes_operations_async.py @@ -71,6 +71,14 @@ async def test_indexes_create_or_update(self, aiproject_endpoint): "type": "AzureSearch", "version": "str", "description": "str", + "fieldMapping": { + "contentFields": ["str"], + "filepathField": "str", + "metadataFields": ["str"], + "titleField": "str", + "urlField": "str", + "vectorFields": ["str"], + }, "id": "str", "tags": {"str": "str"}, }, diff --git a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_red_teams_operations.py b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_red_teams_operations.py index 03d6211ace8e..8cb4893cbb4c 100644 --- a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_red_teams_operations.py +++ b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_red_teams_operations.py @@ -38,15 +38,15 @@ def test_red_teams_create(self, aiproject_endpoint): client = self.create_client(endpoint=aiproject_endpoint) response = client.red_teams.create( red_team={ - "attackStrategies": ["str"], "id": "str", + "target": "target_config", + "applicationScenario": "str", + "attackStrategies": ["str"], + "displayName": "str", "numTurns": 0, + "properties": {"str": "str"}, "riskCategories": ["str"], "simulationOnly": bool, - "targetConfig": "target_config", - "applicationScenario": "str", - "properties": {"str": "str"}, - "scanName": "str", "status": "str", "tags": {"str": "str"}, }, diff --git a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_red_teams_operations_async.py b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_red_teams_operations_async.py index 6f17becd4537..dc93a4d14181 100644 --- a/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_red_teams_operations_async.py +++ b/sdk/ai/azure-ai-projects/generated_tests/test_ai_project_red_teams_operations_async.py @@ -39,15 +39,15 @@ async def test_red_teams_create(self, aiproject_endpoint): client = self.create_async_client(endpoint=aiproject_endpoint) response = await client.red_teams.create( red_team={ - "attackStrategies": ["str"], "id": "str", + "target": "target_config", + "applicationScenario": "str", + "attackStrategies": ["str"], + "displayName": "str", "numTurns": 0, + "properties": {"str": "str"}, "riskCategories": ["str"], "simulationOnly": bool, - "targetConfig": "target_config", - "applicationScenario": "str", - "properties": {"str": "str"}, - "scanName": "str", "status": "str", "tags": {"str": "str"}, }, diff --git a/sdk/ai/azure-ai-projects/tests/samples/test_samples.py b/sdk/ai/azure-ai-projects/tests/samples/test_samples.py index cd20b10f33fc..ade73cfb3046 100644 --- a/sdk/ai/azure-ai-projects/tests/samples/test_samples.py +++ b/sdk/ai/azure-ai-projects/tests/samples/test_samples.py @@ -17,8 +17,10 @@ class TestSamples: To run this test: * 'cd' to the folder '/sdk/ai/azure-ai-projects' in your azure-sdk-for-python repo. * Define the environment variable PROJECT_ENDPOINT with the endpoint of the Azure AI Foundry project used for testing. + * You may also want to make sure ENABLE_AZURE_AI_PROJECTS_CONSOLE_LOGGING is not define (or defined to "false") + so you don't get too much console output. * Run: pytest tests/samples/test_samples.py::TestSamples - * Load the resulting report in Excel: /tests/samples/samples_report.csv + * Load the resulting report in Excel: tests\samples\samples_report.csv """ @classmethod @@ -240,7 +242,7 @@ def test_samples( @pytest.mark.parametrize( "sample_name, model_deployment_name, connection_name, data_folder", [ - ("samples\\agents\\sample_agents_async.py", "", "", ""), + ("samples\\agents\\sample_agents_async.py", "gpt-4o", "", ""), ("samples\\connections\\sample_connections_async.py", "", "connection1", ""), ("samples\\datasets\\sample_datasets_async.py", "", "", "samples\\datasets\\data_folder"), ("samples\\deployments\\sample_deployments_async.py", "DeepSeek-V3", "", ""), @@ -262,7 +264,7 @@ def test_samples( "samples\\inference\\async_samples\\sample_image_embeddings_with_azure_ai_inference_client_async.py", "to-do-add-model", "", - "", + "samples\\inference\\async_samples", ), ( "samples\\inference\\async_samples\\sample_text_embeddings_with_azure_ai_inference_client_async.py", diff --git a/sdk/ai/azure-ai-projects/tsp-location.yaml b/sdk/ai/azure-ai-projects/tsp-location.yaml index 46ad7536ab04..216290ee6b34 100644 --- a/sdk/ai/azure-ai-projects/tsp-location.yaml +++ b/sdk/ai/azure-ai-projects/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/ai/Azure.AI.Projects -commit: 8de48d87b4a46f26917673d0457ef3662441d1a1 +commit: a5177cafa6b7a3e6a45103b2569bf1cb80a1c4d1 repo: Azure/azure-rest-api-specs additionalDirectories: