-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Expand file tree
/
Copy pathroutes.tsp
More file actions
194 lines (172 loc) · 5.89 KB
/
routes.tsp
File metadata and controls
194 lines (172 loc) · 5.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
import "@typespec/rest";
import "@azure-tools/typespec-autorest";
import "@typespec/versioning";
import "@azure-tools/typespec-azure-core";
import "./models.tsp";
using TypeSpec.Http;
using TypeSpec.Rest;
using TypeSpec.Versioning;
using Azure.Core;
using Azure.Core.Traits;
using Azure.Core.Foundations;
namespace Azure.AI.Projects;
alias RedTeamServiceTraits = SupportsClientRequestId &
NoRepeatableRequests &
NoConditionalRequests; // NoRetryRequests suppresses @azure-tools/typespec-azure-core/conditional-requests-trait-missing
alias RedTeamOperations = Azure.Core.ResourceOperations<RedTeamServiceTraits>;
@route("redTeams")
@added(Versions.v2025_05_15_preview)
@removed(Versions.v_latest)
interface RedTeams {
@doc("Get a redteam by name.")
get is RedTeamOperations.ResourceRead<RedTeam>;
@doc("List a redteam by name.")
list is RedTeamOperations.ResourceList<
RedTeam,
ListQueryParametersTrait<StandardListQueryParameters>
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Creates a redteam run.")
@route("runs:run")
@post
createRun is Azure.Core.Foundations.Operation<
{
@doc("Redteam to be run")
@body
RedTeam: RedTeam;
},
ResourceCreatedResponse<RedTeam>
>;
// Private Upload API
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Upload the result to a redteam run.")
@route("runs:upload")
@post
@useAuth(BearerAuth)
@added(Versions.v2025_05_15_preview)
@removed(Versions.v_latest)
UploadRun is Azure.Core.Foundations.Operation<
{
@doc("Redteam to upload.")
@body
redteam: RedTeamUpload;
},
RedTeam
>;
#suppress "@typespec/http/patch-implicit-optional" ""
#suppress "@azure-tools/typespec-azure-core/use-standard-operations"
@doc("Update the uploaded the result to an redteam run.")
@route("runs:updateUpload/{name}")
@patch
@useAuth(BearerAuth)
@added(Versions.v2025_05_15_preview)
@removed(Versions.v_latest)
UploadUpdateRun is Azure.Core.Foundations.Operation<
{
@doc("Name of the redteam run to update.")
@path
name: string;
@doc("Redteam upload to update.")
@body
redteam: RedTeamUpload;
},
RedTeam
>;
// Simulation Private APIs
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Waiting for bug fix: https://github.com/Azure/typespec-azure-pr/issues/3739."
@doc("Get the jailbreak dataset with type.")
@route("/simulation/jailbreak/{type}")
@get
getJailBreakDatasetWithType is Azure.Core.Foundations.Operation<
{
@doc("Type of jailbreak dataset")
@path
type: string;
},
Array<string>
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Waiting for bug fix: https://github.com/Azure/typespec-azure-pr/issues/3739."
#suppress "@azure-tools/typespec-azure-core/no-query-explode"
@doc("Get the attack objectives.")
@route("/simulation/attackobjectives")
@get
getAttackObjectives is Azure.Core.Foundations.Operation<
{
@doc("Risk types for the attack objectives dataset")
@query(#{ explode: true })
riskTypes?: string[];
@doc("The language for the attack objectives dataset, defaults to 'en'")
@query
lang?: string;
@doc("The strategy")
@query
strategy?: string;
},
Array<AttackObjective>
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Waiting for bug fix: https://github.com/Azure/typespec-azure-pr/issues/3739."
@doc("Get the jailbreak dataset.")
@route("/simulation/jailbreak/")
@get
getJailBreakDataset is Azure.Core.Foundations.Operation<{}, Array<string>>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Waiting for bug fix: https://github.com/Azure/typespec-azure-pr/issues/3739."
@doc("Get template parameters with type.")
@route("/simulation/template/parameters/{type}")
@get
getTemplateParametersWithType is Azure.Core.Foundations.Operation<
{
@doc("Type for the template parameters")
@path
type: string;
},
string
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Waiting for bug fix: https://github.com/Azure/typespec-azure-pr/issues/3739."
@doc("Get template parameters.")
@route("/simulation/template/parameters/")
@get
getTemplateParameters is Azure.Core.Foundations.Operation<{}, string>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Waiting for bug fix: https://github.com/Azure/typespec-azure-pr/issues/3739."
@doc("Get the template parameters image.")
@route("/simulation/template/parameters/image")
@get
getTemplateParametersImage is Azure.Core.Foundations.Operation<
{
@doc("Image path.")
@query
path: string;
},
string
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Waiting for bug fix: https://github.com/Azure/typespec-azure-pr/issues/3739."
@doc("Submit a request for simulation.")
@route("/simulation/chat/completions/submit")
@post
submitSimulation is Azure.Core.Foundations.Operation<
{
@doc("Properties of a Prompt Version.")
@body
body: SimulationDTO;
},
ResourceCreatedOrOkResponse<LongRunningResponse>
>;
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Waiting for bug fix: https://github.com/Azure/typespec-azure-pr/issues/3739."
#suppress "@azure-tools/typespec-azure-core/no-closed-literal-union"
@doc("Poll for the operation results.")
@route("/operations/{operationId}")
@get
@useAuth(BearerAuth)
@added(Versions.v2025_05_15_preview)
@removed(Versions.v_latest)
operationResults(
...Azure.Core.Foundations.ApiVersionParameter,
@doc("Operation ID for the polling operation.")
@path
operationId: string,
): {
@statusCode statusCode: 200 | 202;
@doc("The operation results.")
@body
operationResults: ChatCompletions;
};
}