Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing unused state + Fixing enum + Adding versioning to DALL-E models #24560

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Expand Up @@ -10,16 +10,13 @@ namespace Azure.OpenAI;
@doc("A description of the intended purpose of a message within a chat completions interaction.")
enum ChatRole {
@doc("The role that instructs or sets the behavior of the assistant.")
@projectedName("json", "system")
Copy link
Member

Choose a reason for hiding this comment

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

if we'd like to excise the verbose use of projectedName (I believe feedback was provided to that effect) we should do it across the board, as there's a lot of it. I'd recommend omitting this file's changes from the PR just to keep it simple.

system,
system: "system",

@doc("The role that provides responses to system-instructed, user-prompted input.")
@projectedName("json", "assistant")
assistant,
assistant: "assistant",

@doc("The role that provides input for chat completions.")
@projectedName("json", "user")
user,
user: "user",
}

@doc("A single, role-attributed message within a chat completion interaction.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import "@azure-tools/typespec-azure-core";
import "@typespec/http";
import "@typespec/versioning";

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",
Expand All @@ -19,6 +22,7 @@ enum ImageSize {
}

@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;
Expand All @@ -34,6 +38,7 @@ model ImageGenerationOptions {
}

@doc("The image url if successful, and an error otherwise.")
@added(ServiceApiVersions.v2023_06_01_Preview)
model ImageLocation {
@doc("The URL that provides temporary access to download the generated image.")
url?: url;
Expand All @@ -43,6 +48,7 @@ model ImageLocation {
}

@doc("The result of the operation if the operation succeeded.")
@added(ServiceApiVersions.v2023_06_01_Preview)
model ImageResponse {
@doc("A timestamp when this job or item was created (in unix epochs).")
created: int64;
Expand All @@ -52,6 +58,7 @@ model ImageResponse {
}

@doc("The result of the operation if the operation succeeded.")
@added(ServiceApiVersions.v2023_06_01_Preview)
model ImageOperationResponse {
@doc("The ID of the operation.")
id: string;
Expand All @@ -74,6 +81,7 @@ model ImageOperationResponse {

@lroStatus
@doc("The state of a job or item.")
@added(ServiceApiVersions.v2023_06_01_Preview)
enum State {
@doc("The operation was created and is queued to be processed in the future.")
notRunning,
Expand All @@ -92,12 +100,10 @@ enum State {
@lroFailed
@doc("The operation has completed processing with a failure and cannot be further consumed.")
failed,

@doc("The entity has been deleted but may still be referenced by other entities predating the deletion.")
deleted,
}

@doc("Provides status details for long running operations.")
@added(ServiceApiVersions.v2023_06_01_Preview)
model ImageOperationStatus {
@key("operationId")
@visibility("read", "query")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,7 @@
"running",
"succeeded",
"canceled",
"failed",
"deleted"
"failed"
],
"x-ms-enum": {
"name": "State",
Expand Down Expand Up @@ -1168,11 +1167,6 @@
"name": "failed",
"value": "failed",
"description": "The operation has completed processing with a failure and cannot be further consumed."
},
{
"name": "deleted",
"value": "deleted",
"description": "The entity has been deleted but may still be referenced by other entities predating the deletion."
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -803,161 +803,6 @@
"total_tokens"
]
},
"ImageGenerationOptions": {
"type": "object",
"properties": {
"prompt": {
"type": "string",
"description": "A description of the desired images."
},
"n": {
"type": "integer",
"format": "int32",
"description": "The number of images to generate (defaults to 1).",
"default": 1
},
"size": {
"$ref": "#/definitions/ImageSize",
"description": "The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024 (defaults to 1024x1024).",
"default": "1024x1024"
},
"user": {
"type": "string",
"description": "A unique identifier representing your end-user, which can help to monitor and detect abuse."
}
},
"description": "Represents the request data used to generate images.",
"required": [
"prompt"
]
},
"ImageLocation": {
"type": "object",
"properties": {
"url": {
"type": "string",
"format": "uri",
"description": "The URL that provides temporary access to download the generated image."
},
"error": {
"$ref": "#/definitions/Azure.Core.Foundations.Error",
"description": "The error if the operation failed."
}
},
"description": "The image url if successful, and an error otherwise."
},
"ImageOperationResponse": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The ID of the operation."
},
"created": {
"type": "integer",
"format": "int64",
"description": "A timestamp when this job or item was created (in unix epochs)."
},
"expires": {
"type": "integer",
"format": "int64",
"description": "A timestamp when this operation and its associated images expire and will be deleted (in unix epochs)."
},
"result": {
"$ref": "#/definitions/ImageResponse",
"description": "The result of the operation if the operation succeeded."
},
"status": {
"$ref": "#/definitions/State",
"description": "The status of the operation"
},
"error": {
"$ref": "#/definitions/Azure.Core.Foundations.Error",
"description": "The error if the operation failed."
}
},
"description": "The result of the operation if the operation succeeded.",
"required": [
"id",
"created",
"status"
]
},
"ImageOperationStatus": {
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "The unique ID of the operation.",
"x-ms-mutability": [
"read"
]
},
"status": {
"$ref": "#/definitions/State",
"description": "The status of the operation"
}
},
"description": "Provides status details for long running operations.",
"required": [
"id",
"status"
]
},
"ImageResponse": {
"type": "object",
"properties": {
"created": {
"type": "integer",
"format": "int64",
"description": "A timestamp when this job or item was created (in unix epochs)."
},
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/ImageLocation"
},
"x-ms-identifiers": [],
"description": "The images generated by the operator.",
"x-typespec-name": "ImageLocation[]"
}
},
"description": "The result of the operation if the operation succeeded.",
"required": [
"created",
"data"
]
},
"ImageSize": {
"type": "string",
"description": "The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024.",
"enum": [
"256x256",
"512x512",
"1024x1024"
],
"x-ms-enum": {
"name": "ImageSize",
"modelAsString": true,
"values": [
{
"name": "Size256x256",
"value": "256x256",
"description": "Image size of 256x256."
},
{
"name": "Size512x512",
"value": "512x512",
"description": "Image size of 512x512."
},
{
"name": "Size1024x1024",
"value": "1024x1024",
"description": "Image size of 1024x1024."
}
]
}
},
"ServiceApiVersions": {
"type": "string",
"enum": [
Expand All @@ -983,54 +828,6 @@
}
]
}
},
"State": {
"type": "string",
"description": "The state of a job or item.",
"enum": [
"notRunning",
"running",
"succeeded",
"canceled",
"failed",
"deleted"
],
"x-ms-enum": {
"name": "State",
"modelAsString": true,
"values": [
{
"name": "notRunning",
"value": "notRunning",
"description": "The operation was created and is queued to be processed in the future."
},
{
"name": "running",
"value": "running",
"description": "The operation has started to be processed."
},
{
"name": "succeeded",
"value": "succeeded",
"description": "The operation has successfully be processed and is ready for consumption."
},
{
"name": "canceled",
"value": "canceled",
"description": "The operation has been canceled and is incomplete."
},
{
"name": "failed",
"value": "failed",
"description": "The operation has completed processing with a failure and cannot be further consumed."
},
{
"name": "deleted",
"value": "deleted",
"description": "The entity has been deleted but may still be referenced by other entities predating the deletion."
}
]
}
}
},
"parameters": {
Expand Down
Loading