Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
1a8a1f8
Adding images.json to 2023-04-01-preview
hstellmach-msft Mar 15, 2023
5da89ef
Reference swagger JSON file from the readme file.
hstellmach-msft Mar 16, 2023
edf16cc
Fix readme
hstellmach-msft Mar 16, 2023
85af26b
Fix $refs and security def
hstellmach-msft Mar 16, 2023
3a0332c
Fix error messages
hstellmach-msft Mar 17, 2023
4402321
Fix security scheme
hstellmach-msft Mar 17, 2023
0bbdcea
Fix indentation
hstellmach-msft Mar 17, 2023
03fe1eb
Fix parameters
hstellmach-msft Mar 17, 2023
ab5a699
Move definitions under path
hstellmach-msft Mar 17, 2023
b1c5182
Fix status
hstellmach-msft Mar 17, 2023
8c16fbe
Use ref for api version
hstellmach-msft Mar 17, 2023
94050ec
Remove operation location from GET route
hstellmach-msft Mar 17, 2023
e7e40eb
Remove examples
hstellmach-msft Mar 17, 2023
43b6fd4
Fix size enum
hstellmach-msft Mar 17, 2023
31a23ac
Fix timestamps
hstellmach-msft Mar 17, 2023
ad26bbb
Add format to id
hstellmach-msft Mar 17, 2023
4962af9
Rename GenerateImagesPostResponse to GenerateImagesResponse
hstellmach-msft Mar 17, 2023
c70235c
Rename GenerateImagesPostRequest to GenerateImagesCreation
hstellmach-msft Mar 17, 2023
23be47b
Update descriptions
hstellmach-msft Mar 17, 2023
5245ea6
Rename "expires_at" to" expires"
hstellmach-msft Mar 17, 2023
2efaa47
Merge remote-tracking branch 'upstream/main'
hstellmach-msft Mar 17, 2023
4410ea9
Add some descriptions
hstellmach-msft Mar 17, 2023
703cb1f
Fixes
hstellmach-msft Mar 17, 2023
1bfd112
Fix LRO
hstellmach-msft Mar 17, 2023
e7eef3a
Add example for post images generate
hstellmach-msft Mar 17, 2023
ac158d8
Rename version and some other fixes
hstellmach-msft Mar 20, 2023
7137695
Fx version
hstellmach-msft Mar 20, 2023
bdc7f37
Fixes and add example for delete operation
hstellmach-msft Mar 20, 2023
c52e141
Add x-ms-request-id to headers
hstellmach-msft Mar 20, 2023
8401244
Change operationId to Operation-Id
hstellmach-msft Mar 20, 2023
bd9d298
Fix version in readme and fix operation-id
hstellmach-msft Mar 20, 2023
f2b541d
Fix swagger operationId
hstellmach-msft Mar 20, 2023
70b7aa4
Prettier fix
hstellmach-msft Mar 20, 2023
fcae5ec
Revert operationId changes
hstellmach-msft Mar 20, 2023
7dbed88
Fix operationId in examples
hstellmach-msft Mar 20, 2023
1f2076d
Fix patterns and error
hstellmach-msft Mar 21, 2023
9c0fba6
Fix image error code
hstellmach-msft Mar 21, 2023
d0d1472
Align operation-id with FT
hstellmach-msft Mar 22, 2023
e0b8dc7
Add images to operation routes
hstellmach-msft Mar 22, 2023
92ea4ab
Fix operation-id in examples
hstellmach-msft Mar 22, 2023
7220508
Remove suppression for DefinitionsPropertiesNamesCamelCase
hstellmach-msft Mar 22, 2023
3f7ad9b
Address comments
hstellmach-msft Mar 22, 2023
237f3e4
Remove string format
hstellmach-msft Mar 22, 2023
bc0016f
Add operation-id header
hstellmach-msft Mar 23, 2023
7ccf424
Remove maxLength and pattern
hstellmach-msft Mar 23, 2023
3021379
Address comments
hstellmach-msft Mar 23, 2023
d6f6d36
Use reuslt in operation repsonse
hstellmach-msft Mar 23, 2023
1839b06
Fix casing for enums
hstellmach-msft Mar 23, 2023
35a7f92
Address comments
hstellmach-msft Mar 24, 2023
9e3b5c0
Fix url in GET example
hstellmach-msft Mar 24, 2023
5ddfb3c
Fix url in GET example
hstellmach-msft Mar 24, 2023
f5a39a1
Fix url in GET example
hstellmach-msft Mar 24, 2023
2fe4093
Make data in result required
hstellmach-msft Mar 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,348 @@
{
"swagger": "2.0",
"info": {
"title": "Cognitive Services API",
"description": "Cognitive Services API to support OpenAI Dall-E",
"version": "2023-04-01-preview"
},
"host": "eastus.api.cognitive.microsoft.com",
"basePath": "/dalle",
"schemes": ["https"],
"securityDefinitions": {
"Api-Key": {
"type": "apiKey",
"name": "Api-Key",
"in": "header",
"description": "Provide your Cognitive Services Azure OpenAI account key here."
}
},
"security": [
{
"Api-Key": []
}
],
"parameters": {
"apiVersionQueryParameter": {
"in": "query",
"name": "api-version",
"description": "The requested API version.",
"required": true,
"type": "string"
}
},
"definitions": {
"Status": {
"description": "The status of the operation.",
"type": "string",
"enum": [
"NotStarted",
"Running",
"Failed",
"Canceled",
"Succeeded"
]
},
"InnerError": {
"type": "object",
"description": "The inner error if a task in a batch failed.",
"properties": {
"message": {
"type": "string",
"description": "The error message.",
"example": "Operation failed as a result of our safety system."
},
"code": {
"type": "string",
"enum": [
"ContentFilter",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C

c, i, b

"Internal",
"BlockedImages"
],
"description": "The error code."
}
}
},
"Error": {
"type": "object",
"description": "The error if the request or operation failed.",
"properties": {
"message": {
"type": "string",
"description": "The error message.",
"example": "Required query parameter 'api-version' is missing."
},
"code": {
"type": "string",
"enum": [
"BadRequest",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

B

b, ...

"ContentFilter",
"Internal",
"TooManyRequests",
"Unauthorized",
"NotFound",
"OperationNotInTerminalState",
"BlockedImages",
"RequestTimout"
],
"description": "The error code."
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/InnerError"
}
}
},
"required": [
"message",
"code"
]
},
"ErrorResponse": {
"type": "object",
"properties": {
"error": {
"$ref": "#/definitions/Error"
}
},
"required": [
"error"
]
},
"ImageResult": {
"type": "object",
"description": "The image url if successful, and an error otherwise.",
"properties": {
"url": {
"type": "string",
"description": "The image url.",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The image url.

Please expand the descriptions for the important properties, like this is the result picture's url to GET.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it make sense like this: "The URL that provides temporary access to download the generated image."?

"example": "https://www.contoso.com"
},
"error": {
"$ref": "#/definitions/Error"
}
}
},
"OperationResult": {
"type": "array",
"description": "The result data of the operation, if successful",
"items": {
"$ref": "#/definitions/ImageResult"
}
},
"OperationResponse": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The ID of the operation.",
"example": "59c7e2ea-7450-4e85-9762-55c78727f4c7"
},
"created": {
"type": "integer",
"format": "int64",
"description": "The unix timestamp when the operation was created.",
"example": "1676540381"
},
"last_action": {
"type": "integer",
"format": "int64",
"description": "The unix timestamp for when the current state was entered.",
"example": "1676540381"
},
"expires_at": {
"type": "integer",
"format": "int64",
"description": "The unix timestamp when the operation expires.",
"example": "1676540381"
},
"data": {
"$ref": "#/definitions/OperationResult"
},
"status": {
"$ref": "#/definitions/Status"
},
"error": {
"$ref": "#/definitions/Error"
}
},
"required": [
"id",
"status",
"created",
"last_action"
]
},
"ImageResolution": {
"description": "The resolution of the image (256x256, 512x512, or 1024x1024). Smaller images are faster to generate.",
"type": "string",
"enum": [
"256x256",
"512x512",
"1024x1024"
],
"default": "1024x1024"
},
"GenerateImagesPostRequest": {
"type": "object",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simply derive from OperationResult here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm not sure what you mean? Here we provide the prompt etc to generate the images.

"properties": {
"prompt": {
"type": "string",
"description": "The prompt to generate an image from.",
"minLength": 1,
"maxLength": 1000
},
"n": {
"type": "integer",
"description": "The number of images to generate.",
"minimum": 1,
"default": 1
},
"size": {
"$ref": "#/definitions/ImageResolution"
}
},
"required": [
"prompt"
]
},
"GenerateImagesPostResponse": {
"type": "object",
"properties": {
"status": {
"$ref": "#/definitions/Status"
}
},
"required": [
"id"
]
}
},
"paths": {
"/images/generate": {
"post": {
"summary": "Generates a batch of images from a text caption",
"operationId": "Images_Generate",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"parameters": [
{
"$ref": "#/parameters/apiVersionQueryParameter"
},
{
"in": "body",
"name": "body",
"required": true,
"schema": {
"$ref": "#/definitions/GenerateImagesPostRequest"
}
}
],
"responses": {
"202": {
"description": "Created",
"headers": {
"Operation-Location": {
"type": "string",
"description": "URL to poll for the operation result."
}
},
"schema": {
"$ref": "#/definitions/GenerateImagesPostResponse"
}
},
"default": {
"description": "An error occurred.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
},
"/operations/{operationId}": {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/

as discussed, we should separate the routes already in this version /operations/images/generations/{id}

Copy link
Contributor Author

@hstellmach-msft hstellmach-msft Mar 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to /operations/images/{id} (not splitting generations and edits since the repsonse is the same)

"get": {
"summary": "Returns the status of the operation",
"operationId": "Operations_Get",
"produces": [
"application/json"
],
"parameters": [
{
"$ref": "#/parameters/apiVersionQueryParameter"
},
{
"in": "path",
"name": "operationId",
"required": true,
"type": "string",
"description": "The id of the operation"
}
],
"responses": {
"200": {
"description": "OK",
"headers": {
"Operation-Location": {
"schema": {
"type": "string"
},
"description": "The location of the operation."
},
"Retry-After": {
"schema": {
"type": "integer"
},
"description": "Indicates the number of seconds that the client should wait before trying to get the result from the URL identified by the Operation-Location header if the operation did not terminate yet."
}
},
"schema": {
"$ref": "#/definitions/OperationResponse"
}
},
"default": {
"description": "An error occurred.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
},
"delete": {
"summary": "Deletes an operation (if in terminal state)",
"operationId": "Operations_Delete",
"parameters": [
{
"in": "query",
"name": "api-version",
"required": true,
"type": "string",
"description": "API version."
},
{
"in": "path",
"name": "operationId",
"required": true,
"type": "string",
"description": "The id of the operation"
}
],
"responses": {
"204": {
"description": "NoContent"
},
"default": {
"description": "An error occurred.",
"schema": {
"$ref": "#/definitions/ErrorResponse"
}
}
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,10 @@ directive:
- suppress: IntegerTypeMustHaveFormat
reason: API stewardship board recommend to use format "unixtime" which is not supported by linter at the moment.
```

## AzureOpenAI 2023-04-01-preview
These settings apply only when `api-version=2023-04-201-preview` is specified in the query parameters of the request.

``` yaml $(tag) == 'release_2023_04_01_preview'
input-file: preview/2023-04-01-preview/images.json
```