Skip to content

Commit 18528c3

Browse files
authored
Fix the code generation problem. (#39493)
* Fix the code generation problem. * Fix
1 parent 1cc0c65 commit 18528c3

File tree

3 files changed

+80
-67
lines changed

3 files changed

+80
-67
lines changed

specification/ai/Foundry/openai-evaluations/models.tsp

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -161,29 +161,32 @@ model CreateEvalRequest is OpenAI.CreateEvalRequest {
161161
properties?: Record<string>;
162162
}
163163

164-
/** Represents the parameters for red team item generation. */
165-
@added(Versions.v2025_11_15_preview)
166-
@removed(Versions.v1)
167-
@discriminator("type")
168-
model RedTeamItemGenerationParams extends ItemGenerationParams {
169-
/** The type of item generation parameters. */
170-
#suppress "@azure-tools/typespec-azure-core/no-unnamed-union" "Auto-suppressed warnings non-applicable rules during import."
171-
type: "red_team" | "red_team_seed_prompts" | "red_team_taxonomy";
164+
/** The types of parameters for red team item generation. */
165+
union ItemGenerationParamsType {
166+
string,
172167

173-
/** The collection of attack strategies to be used. */
174-
attack_strategies: AttackStrategy[];
168+
/** The ResponseRetrieval item generation parameters. */
169+
responseRetrieval: "response_retrieval",
175170

176-
/** The number of turns allowed in the game. */
177-
num_turns: int32 = 20;
171+
/** Parameters for red team seed prompts. */
172+
redTeamSeedPrompts: "red_team_seed_prompts",
173+
174+
/** Parameters for red team taxonomy item generation. */
175+
redTeamTaxonomy: "red_team_taxonomy",
178176
}
179177

180178
/** Represents the parameters for red team seed prompts item generation. */
181179
@added(Versions.v2025_11_15_preview)
182180
@removed(Versions.v1)
183-
model RedTeamSeedPromptsItemGenerationParams
184-
extends RedTeamItemGenerationParams {
181+
model RedTeamSeedPromptsItemGenerationParams extends ItemGenerationParams {
185182
/** The type of item generation parameters, always `red_team_seed_prompts`. */
186-
type: "red_team_seed_prompts";
183+
type: ItemGenerationParamsType.redTeamSeedPrompts;
184+
185+
/** The collection of attack strategies to be used. */
186+
attack_strategies: AttackStrategy[];
187+
188+
/** The number of turns allowed in the game. */
189+
num_turns: int32 = 20;
187190

188191
/** The source of JSONL content to be processed. */
189192
source: OpenAI.EvalJsonlFileContentSource;
@@ -192,9 +195,15 @@ model RedTeamSeedPromptsItemGenerationParams
192195
/** Represents the parameters for red team taxonomy item generation. */
193196
@added(Versions.v2025_11_15_preview)
194197
@removed(Versions.v1)
195-
model RedTeamTaxonomyItemGenerationParams extends RedTeamItemGenerationParams {
198+
model RedTeamTaxonomyItemGenerationParams extends ItemGenerationParams {
196199
/** The type of item generation parameters, always `red_team_taxonomy`. */
197-
type: "red_team_taxonomy";
200+
type: ItemGenerationParamsType.redTeamTaxonomy;
201+
202+
/** The collection of attack strategies to be used. */
203+
attack_strategies: AttackStrategy[];
204+
205+
/** The number of turns allowed in the game. */
206+
num_turns: int32 = 20;
198207

199208
/** The source from which JSONL content is read. */
200209
source: OpenAI.EvalJsonlFileContentSource;
@@ -206,15 +215,15 @@ model RedTeamTaxonomyItemGenerationParams extends RedTeamItemGenerationParams {
206215
@removed(Versions.v1)
207216
model ItemGenerationParams {
208217
/** The type of item generation parameters to use. */
209-
type: string;
218+
type: ItemGenerationParamsType;
210219
}
211220

212221
/** Represents the parameters for continuous evaluation item generation. */
213222
@added(Versions.v2025_11_15_preview)
214223
@removed(Versions.v1)
215224
model ContinuousEvalItemGenerationParams extends ItemGenerationParams {
216225
/** The type of item generation parameters, always `ResponseRetrieval`. */
217-
type: "response_retrieval";
226+
type: ItemGenerationParamsType.responseRetrieval;
218227

219228
/** The maximum number of turns of chat history to evaluate. */
220229
max_num_turns: int32;
@@ -374,7 +383,7 @@ model RedTeamEvalRunDataSource extends EvalRunDataSource {
374383
type: "azure_ai_red_team";
375384

376385
/** The parameters for item generation. */
377-
item_generation_params: RedTeamItemGenerationParams;
386+
item_generation_params: ItemGenerationParams;
378387

379388
/** The target configuration for the evaluation. */
380389
target: Target;

specification/ai/Foundry/tools/models.tsp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ union _AgentIncludable {
5757
#suppress "@azure-tools/typespec-azure-core/experimental-feature" "Using experimental feature"
5858
@@copyProperties(OpenAI.WebSearchPreviewTool,
5959
{
60-
/**
61-
* The project connections attached to this tool. There can be a maximum of 1 connection
62-
* resource attached to the tool.
63-
*/
60+
/**
61+
* The project connections attached to this tool. There can be a maximum of 1 connection
62+
* resource attached to the tool.
63+
*/
6464
@added(Versions.v2025_11_15_preview)
6565
@removed(Versions.v1)
66-
custom_search_configuration?: WebSearchConfiguration;
66+
custom_search_configuration?: WebSearchConfiguration,
6767
}
6868
);
6969

specification/ai/data-plane/Azure.AI.Projects/openapi3/2025-11-15-preview/azure-ai-projects-openapi3.json

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -12805,20 +12805,39 @@
1280512805
],
1280612806
"properties": {
1280712807
"type": {
12808-
"type": "string",
12808+
"allOf": [
12809+
{
12810+
"$ref": "#/components/schemas/ItemGenerationParamsType"
12811+
}
12812+
],
1280912813
"description": "The type of item generation parameters to use."
1281012814
}
1281112815
},
1281212816
"discriminator": {
1281312817
"propertyName": "type",
1281412818
"mapping": {
12815-
"red_team": "#/components/schemas/RedTeamItemGenerationParams",
12816-
"red_team_seed_prompts": "#/components/schemas/RedTeamItemGenerationParams",
12817-
"red_team_taxonomy": "#/components/schemas/RedTeamItemGenerationParams"
12819+
"red_team_seed_prompts": "#/components/schemas/RedTeamSeedPromptsItemGenerationParams",
12820+
"red_team_taxonomy": "#/components/schemas/RedTeamTaxonomyItemGenerationParams"
1281812821
}
1281912822
},
1282012823
"description": "Represents the set of parameters used to control item generation operations."
1282112824
},
12825+
"ItemGenerationParamsType": {
12826+
"anyOf": [
12827+
{
12828+
"type": "string"
12829+
},
12830+
{
12831+
"type": "string",
12832+
"enum": [
12833+
"response_retrieval",
12834+
"red_team_seed_prompts",
12835+
"red_team_taxonomy"
12836+
]
12837+
}
12838+
],
12839+
"description": "The types of parameters for red team item generation."
12840+
},
1282212841
"ManagedAzureAISearchIndex": {
1282312842
"type": "object",
1282412843
"required": [
@@ -23991,7 +24010,7 @@
2399124010
"item_generation_params": {
2399224011
"allOf": [
2399324012
{
23994-
"$ref": "#/components/schemas/RedTeamItemGenerationParams"
24013+
"$ref": "#/components/schemas/ItemGenerationParams"
2399524014
}
2399624015
],
2399724016
"description": "The parameters for item generation."
@@ -24011,22 +24030,21 @@
2401124030
}
2401224031
]
2401324032
},
24014-
"RedTeamItemGenerationParams": {
24033+
"RedTeamSeedPromptsItemGenerationParams": {
2401524034
"type": "object",
2401624035
"required": [
2401724036
"type",
2401824037
"attack_strategies",
24019-
"num_turns"
24038+
"num_turns",
24039+
"source"
2402024040
],
2402124041
"properties": {
2402224042
"type": {
2402324043
"type": "string",
2402424044
"enum": [
24025-
"red_team",
24026-
"red_team_seed_prompts",
24027-
"red_team_taxonomy"
24045+
"red_team_seed_prompts"
2402824046
],
24029-
"description": "The type of item generation parameters."
24047+
"description": "The type of item generation parameters, always `red_team_seed_prompts`."
2403024048
},
2403124049
"attack_strategies": {
2403224050
"type": "array",
@@ -24040,35 +24058,6 @@
2404024058
"format": "int32",
2404124059
"description": "The number of turns allowed in the game.",
2404224060
"default": 20
24043-
}
24044-
},
24045-
"discriminator": {
24046-
"propertyName": "type",
24047-
"mapping": {
24048-
"red_team_seed_prompts": "#/components/schemas/RedTeamSeedPromptsItemGenerationParams",
24049-
"red_team_taxonomy": "#/components/schemas/RedTeamTaxonomyItemGenerationParams"
24050-
}
24051-
},
24052-
"allOf": [
24053-
{
24054-
"$ref": "#/components/schemas/ItemGenerationParams"
24055-
}
24056-
],
24057-
"description": "Represents the parameters for red team item generation."
24058-
},
24059-
"RedTeamSeedPromptsItemGenerationParams": {
24060-
"type": "object",
24061-
"required": [
24062-
"type",
24063-
"source"
24064-
],
24065-
"properties": {
24066-
"type": {
24067-
"type": "string",
24068-
"enum": [
24069-
"red_team_seed_prompts"
24070-
],
24071-
"description": "The type of item generation parameters, always `red_team_seed_prompts`."
2407224061
},
2407324062
"source": {
2407424063
"allOf": [
@@ -24081,7 +24070,7 @@
2408124070
},
2408224071
"allOf": [
2408324072
{
24084-
"$ref": "#/components/schemas/RedTeamItemGenerationParams"
24073+
"$ref": "#/components/schemas/ItemGenerationParams"
2408524074
}
2408624075
],
2408724076
"description": "Represents the parameters for red team seed prompts item generation."
@@ -24090,6 +24079,8 @@
2409024079
"type": "object",
2409124080
"required": [
2409224081
"type",
24082+
"attack_strategies",
24083+
"num_turns",
2409324084
"source"
2409424085
],
2409524086
"properties": {
@@ -24100,6 +24091,19 @@
2410024091
],
2410124092
"description": "The type of item generation parameters, always `red_team_taxonomy`."
2410224093
},
24094+
"attack_strategies": {
24095+
"type": "array",
24096+
"items": {
24097+
"$ref": "#/components/schemas/AttackStrategy"
24098+
},
24099+
"description": "The collection of attack strategies to be used."
24100+
},
24101+
"num_turns": {
24102+
"type": "integer",
24103+
"format": "int32",
24104+
"description": "The number of turns allowed in the game.",
24105+
"default": 20
24106+
},
2410324107
"source": {
2410424108
"allOf": [
2410524109
{
@@ -24111,7 +24115,7 @@
2411124115
},
2411224116
"allOf": [
2411324117
{
24114-
"$ref": "#/components/schemas/RedTeamItemGenerationParams"
24118+
"$ref": "#/components/schemas/ItemGenerationParams"
2411524119
}
2411624120
],
2411724121
"description": "Represents the parameters for red team taxonomy item generation."

0 commit comments

Comments
 (0)