-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathoutputModels.ts
337 lines (309 loc) · 14.3 KB
/
outputModels.ts
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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
/** The error object. */
export interface ErrorModel {
/** One of a server-defined set of error codes. */
code: string;
/** A human-readable representation of the error. */
message: string;
/** The target of the error. */
target?: string;
/** An array of details about specific errors that led to this reported error. */
details: Array<ErrorModel>;
/** An object containing more specific information than the current object about the error. */
innererror?: InnerError;
}
/** An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses. */
export interface InnerError {
/** One of a server-defined set of error codes. */
code: string;
/** Inner error. */
innererror?: InnerError;
}
/** Information about content filtering evaluated against generated model output. */
export interface ContentFilterResultsForChoiceOutput {
/**
* Describes language related to anatomical organs and genitals, romantic relationships,
* acts portrayed in erotic or affectionate terms, physical sexual acts, including
* those portrayed as an assault or a forced sexual violent act against one’s will,
* prostitution, pornography, and abuse.
*/
sexual?: ContentFilterResultOutput;
/**
* Describes language related to physical actions intended to hurt, injure, damage, or
* kill someone or something; describes weapons, etc.
*/
violence?: ContentFilterResultOutput;
/**
* Describes language attacks or uses that include pejorative or discriminatory language
* with reference to a person or identity group on the basis of certain differentiating
* attributes of these groups including but not limited to race, ethnicity, nationality,
* gender identity and expression, sexual orientation, religion, immigration status, ability
* status, personal appearance, and body size.
*/
hate?: ContentFilterResultOutput;
/**
* Describes language related to physical actions intended to purposely hurt, injure,
* or damage one’s body, or kill oneself.
*/
self_harm?: ContentFilterResultOutput;
/** Describes whether profanity was detected. */
profanity?: ContentFilterDetectionResultOutput;
/** Describes detection results against configured custom blocklists. */
custom_blocklists?: ContentFilterDetailedResults;
/**
* Describes an error returned if the content filtering system is
* down or otherwise unable to complete the operation in time.
*/
error?: ErrorModel;
/** Information about detection of protected text material. */
protected_material_text?: ContentFilterDetectionResultOutput;
/** Information about detection of protected code material. */
protected_material_code?: ContentFilterCitedDetectionResultOutput;
/** Information about detection of ungrounded material. */
ungrounded_material?: ContentFilterCompletionTextSpanResultOutput;
}
/** Represents a structured collection of result details for content filtering. */
export interface ContentFilterDetailedResults {
/** A value indicating whether or not the content has been filtered. */
filtered: boolean;
/** The collection of detailed blocklist result information. */
details: ContentFilterBlocklistIdResultOutput[];
}
/** Represents the outcome of a detection operation against protected resources as performed by content filtering. */
export interface ContentFilterCitedDetectionResultOutput {
/** A value indicating whether or not the content has been filtered. */
filtered: boolean;
/** A value indicating whether detection occurred, irrespective of severity or whether the content was filtered. */
detected: boolean;
/** The internet location associated with the detection. */
URL?: string;
/** The license description associated with the detection. */
license?: string;
}
/** Describes a span within generated completion text. */
export interface ContentFilterCompletionTextSpanResultOutput {
/** A value indicating whether or not the content has been filtered. */
filtered: boolean;
/** A value indicating whether detection occurred, irrespective of severity or whether the content was filtered. */
detected: boolean;
/** The collection of completion text spans. */
details: ContentFilterCompletionTextSpan[];
}
/** Describes a span within generated completion text. Offset 0 is the first UTF32 code point of the completion text. */
export interface ContentFilterCompletionTextSpan {
/** Offset of the UTF32 code point which begins the span. */
completion_start_offset: number;
/**
* Offset of the first UTF32 code point which is excluded from the span.
* This field is always equal to completion_start_offset for empty spans.
* This field is always larger than completion_start_offset for non-empty spans.
*/
completion_end_offset: number;
}
/**
* A representation of the additional context information available when Azure OpenAI chat extensions are involved
* in the generation of a corresponding chat completions response. This context information is only populated when
* using an Azure OpenAI request configured to use a matching extension.
*/
export interface AzureChatExtensionsMessageContextOutput {
/**
* The contextual information associated with the Azure chat extensions used for a chat completions request.
* These messages describe the data source retrievals, plugin invocations, and other intermediate steps taken in the
* course of generating a chat completions response that was augmented by capabilities from Azure OpenAI chat
* extensions.
*/
citations?: Array<AzureChatExtensionDataSourceResponseCitationOutput>;
/** The detected intent from the chat history, used to pass to the next turn to carry over the context. */
intent?: string;
/** All the retrieved documents. */
all_retrieved_documents?: Array<AzureChatExtensionRetrievedDocument>;
}
/** A single instance of additional context information available when Azure OpenAI chat extensions are involved
* in the generation of a corresponding chat completions response. This context information is only populated when
* using an Azure OpenAI request configured to use a matching extension.
*/
export interface AzureChatExtensionDataSourceResponseCitation {
/** The content of the citation. */
content: string;
/** The title of the citation. */
title?: string;
/** The URL of the citation. */
url?: string;
/** The file path of the citation. */
filepath?: string;
/** The chunk ID of the citation. */
chunk_id?: string;
/** The rerank score of the retrieved document. */
rerank_score?: number;
}
/** The retrieved document. */
export interface AzureChatExtensionRetrievedDocument
extends AzureChatExtensionDataSourceResponseCitation {
/** The search queries used to retrieve the document. */
search_queries: string[];
/** The index of the data source. */
data_source_index: number;
/** The original search score of the retrieved document. */
original_search_score?: number;
/** Represents the rationale for filtering the document. If the document does not undergo filtering,
* this field will remain unset.
*/
filter_reason?: AzureChatExtensionRetrieveDocumentFilterReason;
}
/** The reason for filtering the retrieved document. */
export type AzureChatExtensionRetrieveDocumentFilterReason = "score" | "rerank";
/** Content filtering results for a single prompt in the request. */
export interface ContentFilterResultsForPromptOutput {
/** The index of this prompt in the set of prompt results */
prompt_index: number;
/** Content filtering results for this prompt */
content_filter_results: ContentFilterResultDetailsForPromptOutput;
}
/** Information about content filtering evaluated against input data to Azure OpenAI. */
export interface ContentFilterResultDetailsForPromptOutput {
/**
* Describes language related to anatomical organs and genitals, romantic relationships,
* acts portrayed in erotic or affectionate terms, physical sexual acts, including
* those portrayed as an assault or a forced sexual violent act against one’s will,
* prostitution, pornography, and abuse.
*/
sexual?: ContentFilterResultOutput;
/**
* Describes language related to physical actions intended to hurt, injure, damage, or
* kill someone or something; describes weapons, etc.
*/
violence?: ContentFilterResultOutput;
/**
* Describes language attacks or uses that include pejorative or discriminatory language
* with reference to a person or identity group on the basis of certain differentiating
* attributes of these groups including but not limited to race, ethnicity, nationality,
* gender identity and expression, sexual orientation, religion, immigration status, ability
* status, personal appearance, and body size.
*/
hate?: ContentFilterResultOutput;
/**
* Describes language related to physical actions intended to purposely hurt, injure,
* or damage one’s body, or kill oneself.
*/
self_harm?: ContentFilterResultOutput;
/** Describes whether profanity was detected. */
profanity?: ContentFilterDetectionResultOutput;
/** Describes detection results against configured custom blocklists. */
custom_blocklists?: ContentFilterDetailedResults;
/**
* Describes an error returned if the content filtering system is
* down or otherwise unable to complete the operation in time.
*/
error?: ErrorModel;
/** Whether a jailbreak attempt was detected in the prompt. */
jailbreak?: ContentFilterDetectionResultOutput;
/** Whether an indirect attack was detected in the prompt. */
indirect_attack?: ContentFilterDetectionResultOutput;
}
/** Information about filtered content severity level and if it has been filtered or not. */
export interface ContentFilterResultOutput {
/**
* Ratings for the intensity and risk level of filtered content.
*
* Possible values: "safe", "low", "medium", "high"
*/
severity: string;
/** A value indicating whether or not the content has been filtered. */
filtered: boolean;
}
/** Represents the outcome of a detection operation performed by content filtering. */
export interface ContentFilterDetectionResultOutput {
/** A value indicating whether or not the content has been filtered. */
filtered: boolean;
/** A value indicating whether detection occurred, irrespective of severity or whether the content was filtered. */
detected: boolean;
}
/** Represents the outcome of an evaluation against a custom blocklist as performed by content filtering. */
export interface ContentFilterBlocklistIdResultOutput {
/** The ID of the custom blocklist evaluated. */
id: string;
/** A value indicating whether or not the content has been filtered. */
filtered: boolean;
}
/**
* A single instance of additional context information available when Azure OpenAI chat extensions are involved
* in the generation of a corresponding chat completions response. This context information is only populated when
* using an Azure OpenAI request configured to use a matching extension.
*/
export interface AzureChatExtensionDataSourceResponseCitationOutput {
/** The content of the citation. */
content: string;
/** The title of the citation. */
title?: string;
/** The URL of the citation. */
url?: string;
/** The file path of the citation. */
filepath?: string;
/** The chunk ID of the citation. */
chunk_id?: string;
}
/** Describes the content filtering result for the image generation request. */
export interface ImageGenerationContentFilterResults {
/**
* Describes language related to anatomical organs and genitals, romantic relationships,
* acts portrayed in erotic or affectionate terms, physical sexual acts, including
* those portrayed as an assault or a forced sexual violent act against one’s will,
* prostitution, pornography, and abuse.
*/
sexual?: ContentFilterResultOutput;
/**
* Describes language related to physical actions intended to hurt, injure, damage, or
* kill someone or something; describes weapons, etc.
*/
violence?: ContentFilterResultOutput;
/**
* Describes language attacks or uses that include pejorative or discriminatory language
* with reference to a person or identity group on the basis of certain differentiating
* attributes of these groups including but not limited to race, ethnicity, nationality,
* gender identity and expression, sexual orientation, religion, immigration status, ability
* status, personal appearance, and body size.
*/
hate?: ContentFilterResultOutput;
/**
* Describes language related to physical actions intended to purposely hurt, injure,
* or damage one’s body, or kill oneself.
*/
self_harm?: ContentFilterResultOutput;
}
/**
* Describes the content filtering results for the prompt of a image generation request.
*/
export interface ImageGenerationPromptFilterResults {
/**
* Describes language related to anatomical organs and genitals, romantic relationships,
* acts portrayed in erotic or affectionate terms, physical sexual acts, including
* those portrayed as an assault or a forced sexual violent act against one’s will,
* prostitution, pornography, and abuse.
*/
sexual?: ContentFilterResultOutput;
/**
* Describes language related to physical actions intended to hurt, injure, damage, or
* kill someone or something; describes weapons, etc.
*/
violence?: ContentFilterResultOutput;
/**
* Describes language attacks or uses that include pejorative or discriminatory language
* with reference to a person or identity group on the basis of certain differentiating
* attributes of these groups including but not limited to race, ethnicity, nationality,
* gender identity and expression, sexual orientation, religion, immigration status, ability
* status, personal appearance, and body size.
*/
hate?: ContentFilterResultOutput;
/**
* Describes language related to physical actions intended to purposely hurt, injure,
* or damage one’s body, or kill oneself.
*/
self_harm?: ContentFilterResultOutput;
/** Describes whether profanity was detected. */
profanity?: ContentFilterDetectionResultOutput;
/** Whether a jailbreak attempt was detected in the prompt. */
jailbreak?: ContentFilterDetectionResultOutput;
/** Information about customer block lists and if something was detected the associated list ID. */
custom_blocklists?: ContentFilterDetailedResults;
}