Repository: Azure/azure-rest-api-specs
Pull request #34144: Red-Team Target API Definition
Author: login: kseager
Labels: name: data-plane
name: TypeSpec
description: Authored with TypeSpec
Created: 2025-04-22T23:48:36Z | Merged: 2025-04-23T20:29:05Z

# Data Plane API Specification Update Pull Request

> [!TIP]
> Overwhelmed by all this guidance? See the `Getting help` section at the bottom of this PR description.


<!-- 🚨🚨🚨 Replace this line with a summary and reason for these changes to your data plane API 🚨🚨🚨 -->

## PR review workflow diagram

Please understand this diagram before proceeding. It explains how to get your PR approved & merged.

![spec_pr_review_workflow_diagram](https://github.com/Azure/azure-rest-api-specs/assets/4429827/5bb5e7ce-8aff-4dbb-a3f8-0d9b68fef5b1)

## API Info: The Basics

Most of the information about your service should be captured in the issue that serves as your [*API Spec engagement record*](https://aka.ms/azsdk/onboarding/restapischedule).

* Link to API Spec engagement record issue:

Is this review for (select one):

- [ ] a private preview
- [ ] a public preview
- [ ] GA release

### Change Scope

<sup>This section will help us focus on the specific parts of your API that are new or have been modified. <br/>Please share a link to the design document for the new APIs, a link to the previous API Spec document (if applicable), and the root paths that have been updated. </sup>
* Design Document:
* Previous API Spec Doc:
* Updated paths:

### Viewing API changes

For convenient view of the API changes made by this PR, refer to the URLs provided in the table 
in the `Generated ApiView` comment added to this PR. You can use ApiView to show API versions diff. 

### Suppressing failures

If one or multiple validation error/warning suppression(s) is detected in your PR, please follow the 
[Swagger-Suppression-Process](https://aka.ms/pr-suppressions) 
to get approval.

## ❔Got questions? Need additional info?? We are here to help!

<details>
  <summary> Contact us!</summary>

The [Azure API Review Board](https://aka.ms/azsdk/onboarding/restapischedule) is dedicated to helping you create amazing APIs. You can read about our mission and learn more about our process on our [wiki](https://aka.ms/azsdk/onboarding/restapischedule).
* 💬 [Teams Channel](https://teams.microsoft.com/l/channel/19%3a3ebb18fded0e47938f998e196a52952f%40thread.tacv2/General?groupId=1a10b50c-e870-4fe0-8483-bf5542a8d2d8&tenantId=72f988bf-86f1-41af-91ab-2d7cd011db47)
* 💌 [email](mailto://azureapirbcore@microsoft.com)

</details>

<details>
  <summary>Click here for links to tools, specs, guidelines & other good stuff</summary>

### Tooling

 * [Open API validation tools](https://aka.ms/swaggertools) were run on this PR. Go here to see [how to fix errors](https://aka.ms/ci-fix)
 * [Spectral Linting](https://github.com/Azure/azure-api-style-guide/blob/main/README.md)

### Guidelines & Specifications

 * [Azure REST API Guidelines](https://aka.ms/azapi/guidelines)
 * [OpenAPI Style Guidelines](https://aka.ms/azapi/style)
 * [Azure Breaking Change Policy](https://aka.ms/AzBreakingChangesPolicy)

### Helpful Links

 * [Schedule a data plane REST API spec review](https://aka.ms/azsdk/onboarding/restapischedule)

</details>

## Getting help

- First, please carefully read through this PR description, from top to bottom.
- If you don't have permissions to remove or add labels to the PR, request `write access` per [aka.ms/azsdk/access#request-access-to-rest-api-or-sdk-repositories](https://aka.ms/azsdk/access#request-access-to-rest-api-or-sdk-repositories) 
- To understand what you must do next to merge this PR, see the `Next Steps to Merge` comment. It will appear within few minutes of submitting this PR and will continue to be up-to-date with current PR state.
- For guidance on fixing this PR CI check failures, see the hyperlinks provided in given failure 
  and https://aka.ms/ci-fix.
- If the PR CI checks appear to be stuck in `queued` state, please add a comment with contents `/azp run`.
  This should result in a new comment denoting a `PR validation pipeline` has started and the checks should be updated after few minutes.
- If the help provided by the previous points is not enough, post to https://aka.ms/azsdk/support/specreview-channel and link to this PR.



Diff:
diff --git a/specification/ai/Azure.AI.Projects/red-teams/models.tsp b/specification/ai/Azure.AI.Projects/red-teams/models.tsp
index db9b001a1ef1..924552662e70 100644
--- a/specification/ai/Azure.AI.Projects/red-teams/models.tsp
+++ b/specification/ai/Azure.AI.Projects/red-teams/models.tsp
@@ -110,16 +110,27 @@ union RiskCategory {
   Sexual: "Sexual",
 
   @doc("Represents content related to self-harm.")
-  SelfHarm: "SelfHarm",
+  SelfHarm: "SelfHarm"
+}
 
-  @doc("Represents content involving protected material.")
-  ProtectedMaterial: "ProtectedMaterial",
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureOpenAIModel";
 
-  @doc("Represents content related to code vulnerabilities.")
-  CodeVulnerability: "CodeVulnerability",
+  @doc("Deployment name for AOAI model. Example: gpt-4o if in AIServices or connection based `connection_name/deployment_name` (i.e. `my-aoai-connection/gpt-4o`.")
+  modelDeploymentName: string;
+}
 
-  @doc("Represents content with ungrounded attributes.")
-  UngroundedAttributes: "UngroundedAttributes",
+@doc("Abstract class for target configuration.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+@discriminator("type")
+model TargetConfig {
+  @doc("Type of the model configuration.")
+  type: string;
 }
 
 @doc("Red team details.")
@@ -159,4 +170,7 @@ model RedTeam {
   @doc("Status of the red-team. It is set by service and is read-only.")
   @visibility(Lifecycle.Read)
   status?: string;
+
+  @doc("Target configuration for the red-team run.")
+  targetConfig: TargetConfig;
 }
diff --git a/specification/ai/data-plane/Azure.AI.Projects/preview/2025-05-15-preview/azure-ai-projects-1dp.json b/specification/ai/data-plane/Azure.AI.Projects/preview/2025-05-15-preview/azure-ai-projects-1dp.json
index cebe7d9b3a1c..22568a8f3605 100644
--- a/specification/ai/data-plane/Azure.AI.Projects/preview/2025-05-15-preview/azure-ai-projects-1dp.json
+++ b/specification/ai/data-plane/Azure.AI.Projects/preview/2025-05-15-preview/azure-ai-projects-1dp.json
@@ -1972,6 +1972,25 @@
       ],
       "x-ms-discriminator-value": "AzureSearch"
     },
+    "AzureOpenAIModelConfiguration": {
+      "type": "object",
+      "description": "Azure OpenAI model configuration. The API version would be selected by the service for querying the model.",
+      "properties": {
+        "ModelDeploymentName": {
+          "type": "string",
+          "description": "Deployment name for AOAI model. Example: gpt-4o if in AIServices or connection based `connection_name/deployment_name` (i.e. `my-aoai-connection/gpt-4o`."
+        }
+      },
+      "required": [
+        "ModelDeploymentName"
+      ],
+      "allOf": [
+        {
+          "$ref": "#/definitions/TargetConfig"
+        }
+      ],
+      "x-ms-discriminator-value": "AzureOpenAIModel"
+    },
     "BaseCredentials": {
       "type": "object",
       "description": "A base class for connection credentials",
@@ -3204,6 +3223,10 @@
           "type": "string",
           "description": "Status of the red-team. It is set by service and is read-only.",
           "readOnly": true
+        },
+        "targetConfig": {
+          "$ref": "#/definitions/TargetConfig",
+          "description": "Target configuration for the red-team run."
         }
       },
       "required": [
@@ -3211,7 +3234,8 @@
         "numTurns",
         "attackStrategies",
         "simulationOnly",
-        "riskCategories"
+        "riskCategories",
+        "targetConfig"
       ]
     },
     "RiskCategory": {
@@ -3221,10 +3245,7 @@
         "HateUnfairness",
         "Violence",
         "Sexual",
-        "SelfHarm",
-        "ProtectedMaterial",
-        "CodeVulnerability",
-        "UngroundedAttributes"
+        "SelfHarm"
       ],
       "x-ms-enum": {
         "name": "RiskCategory",
@@ -3249,21 +3270,6 @@
             "name": "SelfHarm",
             "value": "SelfHarm",
             "description": "Represents content related to self-harm."
-          },
-          {
-            "name": "ProtectedMaterial",
-            "value": "ProtectedMaterial",
-            "description": "Represents content involving protected material."
-          },
-          {
-            "name": "CodeVulnerability",
-            "value": "CodeVulnerability",
-            "description": "Represents content related to code vulnerabilities."
-          },
-          {
-            "name": "UngroundedAttributes",
-            "value": "UngroundedAttributes",
-            "description": "Represents content with ungrounded attributes."
           }
         ]
       }
@@ -3344,6 +3350,20 @@
         "size",
         "tier"
       ]
+    },
+    "TargetConfig": {
+      "type": "object",
+      "description": "Abstract class for target configuration.",
+      "properties": {
+        "type": {
+          "type": "string",
+          "description": "Type of the model configuration."
+        }
+      },
+      "discriminator": "type",
+      "required": [
+        "type"
+      ]
     }
   },
   "parameters": {


Reviews:
user: login: singankit
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T00:01:18Z
user: login: posaninagendra
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-23T16:23:01Z
user: login: singankit
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T16:32:16Z
user: login: singankit
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T16:32:47Z
user: login: needuv
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-23T16:44:11Z
user: login: slister1001
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-23T17:03:35Z
user: login: needuv
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-23T17:38:59Z
user: login: needuv
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-23T17:41:33Z
user: login: nagkumar91
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-23T17:53:52Z
user: login: minthigpen
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-23T17:57:51Z
user: login: minthigpen
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-23T18:34:31Z
user: login: johanste
state: COMMENTED
author_association: MEMBER
submitted_at: 2025-04-23T19:57:19Z
user: login: posaninagendra
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-23T20:12:10Z
user: login: singankit
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-04-23T20:17:12Z
user: login: dargilco
state: APPROVED
author_association: MEMBER
submitted_at: 2025-04-23T20:28:13Z

Review comments:
diff_hunk: @@ -122,6 +122,32 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
 }
 
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureAOAIModel";
+
+  @doc("Endpoint targetURI for AOAI model.")
+  AzureEndpoint: string;
+
+  @doc("API Key for AOAI model.")
+  apiKey: string;
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: singankit
body: @needuv Should this be avoided and only information needed is deploymentName ?
created_at: 2025-04-23T00:01:18Z
author_association: CONTRIBUTOR
diff_hunk: @@ -122,6 +122,32 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
 }
 
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureAOAIModel";
+
+  @doc("Endpoint targetURI for AOAI model.")
+  AzureEndpoint: string;
+
+  @doc("API Key for AOAI model.")
+  apiKey: string;
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: posaninagendra
body: yes, this should instead take, connectionName and deploymentName
created_at: 2025-04-23T16:23:01Z
author_association: MEMBER
diff_hunk: @@ -122,6 +122,32 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
 }
 
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureAOAIModel";
+
+  @doc("Endpoint targetURI for AOAI model.")
+  AzureEndpoint: string;
+
+  @doc("API Key for AOAI model.")
+  apiKey: string;
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: singankit
body: I believe this how deployment name will be passed if it is coming from a connection.  `connection_name/deployment_name` (i.e. `my-aoai-connection/gpt-4o`)
created_at: 2025-04-23T16:32:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -122,6 +122,32 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
 }
 
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureAOAIModel";
+
+  @doc("Endpoint targetURI for AOAI model.")
+  AzureEndpoint: string;
+
+  @doc("API Key for AOAI model.")
+  apiKey: string;
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: singankit
body: Sharing the spec which has it https://github.com/Azure/agent-first-sdk/pull/78/files#diff-f5fa664464db58548ea4922b88d6291a2802e51566feb0aafabec1ab45aa3c5fR42

created_at: 2025-04-23T16:32:47Z
author_association: CONTRIBUTOR
diff_hunk: @@ -122,6 +122,32 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
 }
 
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureAOAIModel";
+
+  @doc("Endpoint targetURI for AOAI model.")
+  AzureEndpoint: string;
+
+  @doc("API Key for AOAI model.")
+  apiKey: string;
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: needuv
body: yeah just one field, `modelDeploymentName`. Can point to a deployment in the parent AIServices OR a connected model following the schema of Ankit's comment
created_at: 2025-04-23T16:44:11Z
author_association: MEMBER
diff_hunk: @@ -122,6 +122,26 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: slister1001
body: `UngroundedAttributes`, `CodeVulnerability` and `ProtectedMaterial` are not yet supported by SDK
created_at: 2025-04-23T17:03:35Z
author_association: MEMBER
diff_hunk: @@ -122,6 +122,26 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: minthigpen
body: +1
created_at: 2025-04-23T17:22:10Z
author_association: MEMBER
diff_hunk: @@ -122,6 +122,26 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
 }
 
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureAOAIModel";
+
+  @doc("Deployment name for AOAI model. Example: gpt-4o if in AIServices or connection based `connection_name/deployment_name` (i.e. `my-aoai-connection/gpt-4o`.")
+  DeploymentName: string;
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: needuv
body: nit: `ModelDeploymentName`
created_at: 2025-04-23T17:38:59Z
author_association: MEMBER
diff_hunk: @@ -122,6 +122,26 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
 }
 
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureAOAIModel";
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: needuv
body: in theory, any AIServices based model would be supported, right? Or do you specifically check if the model is published by OpenAI?
created_at: 2025-04-23T17:41:32Z
author_association: MEMBER
diff_hunk: @@ -122,6 +122,26 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
 }
 
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureAOAIModel";
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: nagkumar91
body: All of them should be supported, but I think its ok if we start with just OpenAI published models

created_at: 2025-04-23T17:53:52Z
author_association: MEMBER
diff_hunk: @@ -122,6 +122,26 @@ union RiskCategory {
   UngroundedAttributes: "UngroundedAttributes",
 }
 
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureAOAIModel";
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: minthigpen
body: I also agree, let's start with a scoped version and iteratively extend support over time
created_at: 2025-04-23T17:57:33Z
author_association: MEMBER
diff_hunk: @@ -110,16 +110,27 @@ union RiskCategory {
   Sexual: "Sexual",
 
   @doc("Represents content related to self-harm.")
-  SelfHarm: "SelfHarm",
+  SelfHarm: "SelfHarm"
+}
 
-  @doc("Represents content involving protected material.")
-  ProtectedMaterial: "ProtectedMaterial",
+@doc("Azure OpenAI model configuration. The API version would be selected by the service for querying the model.")
+@added(Versions.v2025_05_15_preview)
+@removed(Versions.v_latest)
+model AzureOpenAIModelConfiguration extends TargetConfig {
+  @visibility(Lifecycle.Read)
+  type: "AzureOpenAIModel";
 
-  @doc("Represents content related to code vulnerabilities.")
-  CodeVulnerability: "CodeVulnerability",
+  @doc("Deployment name for AOAI model. Example: gpt-4o if in AIServices or connection based `connection_name/deployment_name` (i.e. `my-aoai-connection/gpt-4o`.")
+  ModelDeploymentName: string;
path: specification/ai/Azure.AI.Projects/red-teams/models.tsp
user: login: johanste
body: ```suggestion
  modelDeploymentName: string;
```
created_at: 2025-04-23T19:57:19Z
author_association: MEMBER

PR comments:
user: login: openapi-pipeline-app[bot]
created_at: 2025-04-22T23:48:40Z
body: <h2>Next Steps to Merge</h2>✅ All automated merging requirements have been met! To get your PR merged, see <a href="https://aka.ms/azsdk/specreview/merge">aka.ms/azsdk/specreview/merge</a>.
author_association: NONE
user: login: openapi-pipeline-app[bot]
created_at: 2025-04-22T23:48:41Z
body: PR validation pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment.
author_association: NONE
user: login: github-actions[bot]
created_at: 2025-04-22T23:53:41Z
body: ## API Change Check

APIView identified API level changes in this PR and created the following API reviews

| Language | API Review for Package |
|----------|---------|
| TypeSpec | [Azure.AI.Projects](https://spa.apiview.dev/review/2d95fc27d5b8484a8600b3f00af0901f?activeApiRevisionId=5b478e3a8deb41759ca2aa5cbcdc0349) |
| Python | [azure-ai-projects-onedp](https://spa.apiview.dev/review/1db997851be4466c878ecf7771a63695?activeApiRevisionId=de80db829bd4418a876ff825f07b561c) |
<!-- Fetch URI: https://apiview.dev/api/pullrequests?pullRequestNumber=34144&repoName=Azure/azure-rest-api-specs&commitSHA=c7d4a7faed9d07baa7d1f1cca1c5f38d0c50666c -->
author_association: NONE