forked from Azure/azure-rest-api-specs
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimages.tsp
More file actions
112 lines (89 loc) · 3.79 KB
/
images.tsp
File metadata and controls
112 lines (89 loc) · 3.79 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
import "@azure-tools/typespec-azure-core";
import "@typespec/http";
import "@typespec/versioning";
import "./operations.common.tsp";
using Azure.Core;
using TypeSpec.Http;
using TypeSpec.Versioning;
namespace Azure.OpenAI;
@doc("The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.")
@added(ServiceApiVersions.v2023_06_01_Preview)
enum ImageSize {
@doc("Image size of 256x256.")
Size256x256: "256x256",
@doc("Image size of 512x512.")
Size512x512: "512x512",
@doc("Image size of 1024x1024.")
Size1024x1024: "1024x1024",
}
@doc("The format in which the generated images are returned.")
@added(ServiceApiVersions.v2023_06_01_Preview)
enum ImageGenerationResponseFormat {
@doc("Image generation response items should provide a URL from which the image may be retrieved.")
Url: "url",
@doc("Image generation response items should provide image data as a base64-encoded string.")
Base64: "b64_json",
}
@doc("Represents the request data used to generate images.")
@added(ServiceApiVersions.v2023_06_01_Preview)
model ImageGenerationOptions {
@doc("A description of the desired images.")
prompt: string;
@doc("The number of images to generate (defaults to 1).")
@projectedName("csharp", "ImageCount")
n?: int32 = 1;
@doc("The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 (defaults to 1024x1024).")
size?: ImageSize = ImageSize.Size1024x1024;
@doc("""
The format in which image generation response items should be presented.
Azure OpenAI only supports URL response items.
""")
@projectedName("json", "response_format")
responseFormat?: ImageGenerationResponseFormat;
@doc("A unique identifier representing your end-user, which can help to monitor and detect abuse.")
user?: string;
}
@doc("An image response item that provides a URL from which an image may be accessed.")
@added(ServiceApiVersions.v2023_06_01_Preview)
@projectedName("csharp", "InternalImageLocation")
model ImageLocation {
@doc("The URL that provides temporary access to download the generated image.")
url: url;
}
@doc("An image response item that directly represents the image data as a base64-encoded string.")
@added(ServiceApiVersions.v2023_06_01_Preview)
model ImagePayload {
@doc("The complete data for an image represented as a base64-encoded string.")
@projectedName("json", "b64_json")
base64Data: string;
}
@doc("The result of the operation if the operation succeeded.")
@added(ServiceApiVersions.v2023_06_01_Preview)
model ImageGenerations {
@doc("A timestamp when this job or item was created (in unix epochs).")
@projectedName("csharp", "InternalCreatedSecondsAfterUnixEpoch")
created: int64;
#suppress "@azure-tools/typespec-autorest/union-unsupported" "openapi v2 not required"
@doc("The images generated by the operator.")
@projectedName("csharp", "InternalEmittedImageResponseItems")
data: ImageLocation[] | ImagePayload[];
}
// Note: pending resolution of cross-language code emission behavior for long-running operations, image generation
// reuses its final operation response model as its status polling model.
// @lroStatus
@doc("A polling status update or final response payload for an image operation.")
@added(ServiceApiVersions.v2023_06_01_Preview)
model BatchImageGenerationOperationResponse {
@doc("The ID of the operation.")
id: string;
@doc("A timestamp when this job or item was created (in unix epochs).")
created: int64;
@doc("A timestamp when this operation and its associated images expire and will be deleted (in unix epochs).")
expires?: int64;
@doc("The result of the operation if the operation succeeded.")
result?: ImageGenerations;
@doc("The status of the operation")
status: AzureOpenAIOperationState;
@doc("The error if the operation failed.")
error?: Foundations.Error;
}