-
Notifications
You must be signed in to change notification settings - Fork 5.1k
/
generated.json
600 lines (600 loc) · 22.2 KB
/
generated.json
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
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
{
"swagger": "2.0",
"info": {
"title": "Azure OpenAI API",
"version": "2022-12-01",
"description": "Azure OpenAI APIs for completions and search",
"x-typespec-generated": [
{
"emitter": "@azure-tools/typespec-autorest"
}
]
},
"schemes": [
"https"
],
"x-ms-parameterized-host": {
"hostTemplate": "{endpoint}/openai",
"useSchemePrefix": false,
"parameters": [
{
"name": "endpoint",
"in": "path",
"required": true,
"description": "Supported Cognitive Services endpoints (protocol and hostname, for example:\nhttps://westus.api.cognitive.microsoft.com).",
"type": "string"
}
]
},
"produces": [
"application/json"
],
"consumes": [
"application/json"
],
"security": [
{
"ApiKeyAuth": []
},
{
"OAuth2Auth": [
"https://cognitiveservices.azure.com/.default"
]
}
],
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "api-key",
"in": "header"
},
"OAuth2Auth": {
"type": "oauth2",
"flow": "implicit",
"authorizationUrl": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
"scopes": {
"https://cognitiveservices.azure.com/.default": ""
}
}
},
"tags": [],
"paths": {
"/deployments/{deploymentId}/completions": {
"post": {
"operationId": "GetCompletions",
"description": "Gets completions for the provided input prompts.\nCompletions support a wide variety of tasks and generate text that continues from or \"completes\"\nprovided prompt data.",
"parameters": [
{
"$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter"
},
{
"name": "deploymentId",
"in": "path",
"description": "Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/CompletionsOptions"
}
}
],
"responses": {
"200": {
"description": "The request has succeeded.",
"schema": {
"$ref": "#/definitions/Completions"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse"
},
"headers": {
"x-ms-error-code": {
"description": "String error code indicating what went wrong.",
"type": "string"
}
}
}
},
"x-ms-examples": {
"Creates a completion for the provided prompt, parameters and chosen model.": {
"$ref": "./examples/completions.json"
}
}
}
},
"/deployments/{deploymentId}/embeddings": {
"post": {
"operationId": "GetEmbeddings",
"description": "Return the embeddings for a given prompt.",
"parameters": [
{
"$ref": "#/parameters/Azure.Core.Foundations.ApiVersionParameter"
},
{
"name": "deploymentId",
"in": "path",
"description": "Specifies either the model deployment name (when using Azure OpenAI) or model name (when using non-Azure OpenAI) to use for this request.",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/EmbeddingsOptions"
}
}
],
"responses": {
"200": {
"description": "The request has succeeded.",
"schema": {
"$ref": "#/definitions/Embeddings"
}
},
"default": {
"description": "An unexpected error response.",
"schema": {
"$ref": "#/definitions/Azure.Core.Foundations.ErrorResponse"
},
"headers": {
"x-ms-error-code": {
"description": "String error code indicating what went wrong.",
"type": "string"
}
}
}
},
"x-ms-examples": {
"Return the embeddings for a given prompt.": {
"$ref": "./examples/embeddings.json"
}
}
}
}
},
"definitions": {
"Azure.Core.Foundations.Error": {
"type": "object",
"description": "The error object.",
"properties": {
"code": {
"type": "string",
"description": "One of a server-defined set of error codes."
},
"message": {
"type": "string",
"description": "A human-readable representation of the error."
},
"target": {
"type": "string",
"description": "The target of the error."
},
"details": {
"type": "array",
"description": "An array of details about specific errors that led to this reported error.",
"items": {
"$ref": "#/definitions/Azure.Core.Foundations.Error"
},
"x-ms-identifiers": []
},
"innererror": {
"$ref": "#/definitions/Azure.Core.Foundations.InnerError",
"description": "An object containing more specific information than the current object about the error."
}
},
"required": [
"code",
"message"
]
},
"Azure.Core.Foundations.ErrorResponse": {
"type": "object",
"description": "A response containing error details.",
"properties": {
"error": {
"$ref": "#/definitions/Azure.Core.Foundations.Error",
"description": "The error object."
}
},
"required": [
"error"
]
},
"Azure.Core.Foundations.InnerError": {
"type": "object",
"description": "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.",
"properties": {
"code": {
"type": "string",
"description": "One of a server-defined set of error codes."
},
"innererror": {
"$ref": "#/definitions/Azure.Core.Foundations.InnerError",
"description": "Inner error."
}
}
},
"Choice": {
"type": "object",
"description": "The representation of a single prompt completion as part of an overall completions request.\nGenerally, `n` choices are generated per provided prompt with a default value of 1.\nToken limits and other settings may limit the number of choices generated.",
"properties": {
"text": {
"type": "string",
"description": "The generated text for a given completions prompt."
},
"index": {
"type": "integer",
"format": "int32",
"description": "The ordered index associated with this completions choice."
},
"logprobs": {
"type": "object",
"description": "The log probabilities model for tokens associated with this completions choice.",
"x-nullable": true,
"allOf": [
{
"$ref": "#/definitions/CompletionsLogProbabilityModel"
}
]
},
"finish_reason": {
"$ref": "#/definitions/CompletionsFinishReason",
"description": "Reason for finishing",
"x-nullable": true,
"x-ms-client-name": "finishReason"
}
},
"required": [
"text",
"index",
"logprobs",
"finish_reason"
]
},
"Completions": {
"type": "object",
"description": "Representation of the response data from a completions request.\nCompletions support a wide variety of tasks and generate text that continues from or \"completes\"\nprovided prompt data.",
"properties": {
"id": {
"type": "string",
"description": "A unique identifier associated with this completions response."
},
"created": {
"type": "integer",
"format": "unixtime",
"description": "The first timestamp associated with generation activity for this completions response,\nrepresented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970."
},
"choices": {
"type": "array",
"description": "The collection of completions choices associated with this completions response.\nGenerally, `n` choices are generated per provided prompt with a default value of 1.\nToken limits and other settings may limit the number of choices generated.",
"items": {
"$ref": "#/definitions/Choice"
},
"x-ms-identifiers": []
},
"usage": {
"$ref": "#/definitions/CompletionsUsage",
"description": "Usage information for tokens processed and generated as part of this completions operation."
}
},
"required": [
"id",
"created",
"choices",
"usage"
]
},
"CompletionsFinishReason": {
"type": "string",
"description": "Representation of the manner in which a completions response concluded.",
"enum": [
"stop",
"length",
"content_filter"
],
"x-ms-enum": {
"name": "CompletionsFinishReason",
"modelAsString": true,
"values": [
{
"name": "stopped",
"value": "stop",
"description": "Completions ended normally and reached its end of token generation."
},
{
"name": "tokenLimitReached",
"value": "length",
"description": "Completions exhausted available token limits before generation could complete."
},
{
"name": "contentFiltered",
"value": "content_filter",
"description": "Completions generated a response that was identified as potentially sensitive per content\nmoderation policies."
}
]
}
},
"CompletionsLogProbabilityModel": {
"type": "object",
"description": "Representation of a log probabilities model for a completions generation.",
"properties": {
"tokens": {
"type": "array",
"description": "The textual forms of tokens evaluated in this probability model.",
"items": {
"type": "string"
}
},
"token_logprobs": {
"type": "array",
"description": "A collection of log probability values for the tokens in this completions data.",
"items": {
"type": "number",
"format": "float",
"x-nullable": true
},
"x-ms-client-name": "tokenLogprobs"
},
"top_logprobs": {
"type": "array",
"description": "A mapping of tokens to maximum log probability values in this completions data.",
"items": {
"type": "object"
},
"x-ms-client-name": "topLogprobs",
"x-ms-identifiers": []
},
"text_offset": {
"type": "array",
"description": "The text offsets associated with tokens in this completions data.",
"items": {
"type": "integer",
"format": "int32"
},
"x-ms-client-name": "textOffset"
}
},
"required": [
"tokens",
"token_logprobs",
"top_logprobs",
"text_offset"
]
},
"CompletionsOptions": {
"type": "object",
"description": "The configuration information for a completions request.\nCompletions support a wide variety of tasks and generate text that continues from or \"completes\"\nprovided prompt data.",
"properties": {
"prompt": {
"type": "array",
"description": "The prompts to generate completions from.",
"items": {
"type": "string"
}
},
"max_tokens": {
"type": "integer",
"format": "int32",
"description": "The maximum number of tokens to generate.",
"x-ms-client-name": "maxTokens"
},
"temperature": {
"type": "number",
"format": "float",
"description": "The sampling temperature to use that controls the apparent creativity of generated completions.\nHigher values will make output more random while lower values will make results more focused\nand deterministic.\nIt is not recommended to modify temperature and top_p for the same completions request as the\ninteraction of these two settings is difficult to predict."
},
"top_p": {
"type": "number",
"format": "float",
"description": "An alternative to sampling with temperature called nucleus sampling. This value causes the\nmodel to consider the results of tokens with the provided probability mass. As an example, a\nvalue of 0.15 will cause only the tokens comprising the top 15% of probability mass to be\nconsidered.\nIt is not recommended to modify temperature and top_p for the same completions request as the\ninteraction of these two settings is difficult to predict.",
"x-ms-client-name": "topP"
},
"logit_bias": {
"type": "object",
"description": "A map between GPT token IDs and bias scores that influences the probability of specific tokens\nappearing in a completions response. Token IDs are computed via external tokenizer tools, while\nbias scores reside in the range of -100 to 100 with minimum and maximum values corresponding to\na full ban or exclusive selection of a token, respectively. The exact behavior of a given bias\nscore varies by model.",
"additionalProperties": {
"format": "int32",
"type": "integer"
},
"x-ms-client-name": "logitBias"
},
"user": {
"type": "string",
"description": "An identifier for the caller or end user of the operation. This may be used for tracking\nor rate-limiting purposes."
},
"n": {
"type": "integer",
"format": "int32",
"description": "The number of completions choices that should be generated per provided prompt as part of an\noverall completions response.\nBecause this setting can generate many completions, it may quickly consume your token quota.\nUse carefully and ensure reasonable settings for max_tokens and stop."
},
"logprobs": {
"type": "integer",
"format": "int32",
"description": "A value that controls the emission of log probabilities for the provided number of most likely\ntokens within a completions response."
},
"echo": {
"type": "boolean",
"description": "A value specifying whether completions responses should include input prompts as prefixes to\ntheir generated output."
},
"stop": {
"type": "array",
"description": "A collection of textual sequences that will end completions generation.",
"items": {
"type": "string"
}
},
"presence_penalty": {
"type": "number",
"format": "float",
"description": "A value that influences the probability of generated tokens appearing based on their existing\npresence in generated text.\nPositive values will make tokens less likely to appear when they already exist and increase the\nmodel's likelihood to output new topics.",
"x-ms-client-name": "presencePenalty"
},
"frequency_penalty": {
"type": "number",
"format": "float",
"description": "A value that influences the probability of generated tokens appearing based on their cumulative\nfrequency in generated text.\nPositive values will make tokens less likely to appear as their frequency increases and\ndecrease the likelihood of the model repeating the same statements verbatim.",
"x-ms-client-name": "frequencyPenalty"
},
"best_of": {
"type": "integer",
"format": "int32",
"description": "A value that controls how many completions will be internally generated prior to response\nformulation.\nWhen used together with n, best_of controls the number of candidate completions and must be\ngreater than n.\nBecause this setting can generate many completions, it may quickly consume your token quota.\nUse carefully and ensure reasonable settings for max_tokens and stop.",
"x-ms-client-name": "bestOf"
},
"stream": {
"type": "boolean",
"description": "A value indicating whether chat completions should be streamed for this request."
},
"model": {
"type": "string",
"description": "The model name to provide as part of this completions request.\nNot applicable to Azure OpenAI, where deployment information should be included in the Azure\nresource URI that's connected to."
}
},
"required": [
"prompt"
]
},
"CompletionsUsage": {
"type": "object",
"description": "Representation of the token counts processed for a completions request.\nCounts consider all tokens across prompts, choices, choice alternates, best_of generations, and\nother consumers.",
"properties": {
"completion_tokens": {
"type": "integer",
"format": "int32",
"description": "The number of tokens generated across all completions emissions.",
"x-ms-client-name": "completionTokens"
},
"prompt_tokens": {
"type": "integer",
"format": "int32",
"description": "The number of tokens in the provided prompts for the completions request.",
"x-ms-client-name": "promptTokens"
},
"total_tokens": {
"type": "integer",
"format": "int32",
"description": "The total number of tokens processed for the completions request and response.",
"x-ms-client-name": "totalTokens"
}
},
"required": [
"completion_tokens",
"prompt_tokens",
"total_tokens"
]
},
"EmbeddingItem": {
"type": "object",
"description": "Representation of a single embeddings relatedness comparison.",
"properties": {
"embedding": {
"type": "array",
"description": "List of embeddings value for the input prompt. These represent a measurement of the\nvector-based relatedness of the provided input.",
"items": {
"type": "number",
"format": "float"
}
},
"index": {
"type": "integer",
"format": "int32",
"description": "Index of the prompt to which the EmbeddingItem corresponds."
}
},
"required": [
"embedding",
"index"
]
},
"Embeddings": {
"type": "object",
"description": "Representation of the response data from an embeddings request.\nEmbeddings measure the relatedness of text strings and are commonly used for search, clustering,\nrecommendations, and other similar scenarios.",
"properties": {
"data": {
"type": "array",
"description": "Embedding values for the prompts submitted in the request.",
"items": {
"$ref": "#/definitions/EmbeddingItem"
},
"x-ms-identifiers": []
},
"usage": {
"$ref": "#/definitions/EmbeddingsUsage",
"description": "Usage counts for tokens input using the embeddings API."
}
},
"required": [
"data",
"usage"
]
},
"EmbeddingsOptions": {
"type": "object",
"description": "The configuration information for an embeddings request.\nEmbeddings measure the relatedness of text strings and are commonly used for search, clustering,\nrecommendations, and other similar scenarios.",
"properties": {
"user": {
"type": "string",
"description": "An identifier for the caller or end user of the operation. This may be used for tracking\nor rate-limiting purposes."
},
"model": {
"type": "string",
"description": "The model name to provide as part of this embeddings request.\nNot applicable to Azure OpenAI, where deployment information should be included in the Azure\nresource URI that's connected to."
},
"input": {
"type": "array",
"description": "Input texts to get embeddings for, encoded as a an array of strings.\nEach input must not exceed 2048 tokens in length.\n\nUnless you are embedding code, we suggest replacing newlines (\\n) in your input with a single space,\nas we have observed inferior results when newlines are present.",
"items": {
"type": "string"
}
}
},
"required": [
"input"
]
},
"EmbeddingsUsage": {
"type": "object",
"description": "Measurement of the amount of tokens used in this request and response.",
"properties": {
"prompt_tokens": {
"type": "integer",
"format": "int32",
"description": "Number of tokens sent in the original request.",
"x-ms-client-name": "promptTokens"
},
"total_tokens": {
"type": "integer",
"format": "int32",
"description": "Total number of tokens transacted in this request/response.",
"x-ms-client-name": "totalTokens"
}
},
"required": [
"prompt_tokens",
"total_tokens"
]
}
},
"parameters": {
"Azure.Core.Foundations.ApiVersionParameter": {
"name": "api-version",
"in": "query",
"description": "The API version to use for this operation.",
"required": true,
"type": "string",
"minLength": 1,
"x-ms-parameter-location": "method",
"x-ms-client-name": "apiVersion"
}
}
}