Skip to content

Commit

Permalink
a couple of representation tweaks for codegen (Azure#24847)
Browse files Browse the repository at this point in the history
  • Loading branch information
trrwilson authored and harryli0108 committed Jul 28, 2023
1 parent fa537fc commit e0945ef
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ model ChatMessage {
@projectedName("json", "role")
role: ChatRole;

#suppress "@azure-tools/typespec-azure-core/no-nullable" "we explicitly want a nullable string"
@doc("The text associated with this message payload.")
@projectedName("json", "content")
content?: string;
content: string | null;

@doc("""
The name of the author of this message. `name` is required if role is `function`, and it should be the name of the
Expand Down Expand Up @@ -225,9 +226,9 @@ model ChatCompletions {
represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970.
""")
@projectedName("json", "created")
@projectedName("csharp", "InternalCreatedSecondsAfterUnixEpoch")
@projectedName("java", "createdAt")
created: int32;
@encode(DateTimeKnownEncoding.unixTimestamp, int32)
created: utcDateTime;

@doc("""
The collection of completions choices associated with this completions response.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,9 @@ model Completions {
represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970.
""")
@projectedName("json", "created")
@projectedName("csharp", "InternalCreatedSecondsAfterUnixEpoch")
created: int32;
@projectedName("java", "createdAt")
@encode(DateTimeKnownEncoding.unixTimestamp, int32)
created: utcDateTime;

@doc("""
Content filtering results for zero or more prompts in the request. In a streaming request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,13 @@ model ImagePayload {
@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;
@projectedName("json", "created")
@projectedName("java", "createdAt")
@encode(DateTimeKnownEncoding.unixTimestamp, int32)
created: utcDateTime;

#suppress "@azure-tools/typespec-autorest/union-unsupported" "openapi v2 not required"
@doc("The images generated by the operator.")
@projectedName("csharp", "InternalEmittedImageResponseItems")
data: ImageLocation[] | ImagePayload[];
}

Expand All @@ -96,7 +97,10 @@ model BatchImageGenerationOperationResponse {
id: string;

@doc("A timestamp when this job or item was created (in unix epochs).")
created: int64;
@projectedName("json", "created")
@projectedName("java", "createdAt")
@encode(DateTimeKnownEncoding.unixTimestamp, int32)
created: utcDateTime;

@doc("A timestamp when this operation and its associated images expire and will be deleted (in unix epochs).")
expires?: int64;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@
},
"created": {
"type": "integer",
"format": "int64",
"format": "unixtime",
"description": "A timestamp when this job or item was created (in unix epochs)."
},
"expires": {
Expand Down Expand Up @@ -492,7 +492,7 @@
},
"created": {
"type": "integer",
"format": "int32",
"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": {
Expand Down Expand Up @@ -613,11 +613,13 @@
},
"content": {
"type": "string",
"description": "The text associated with this message payload."
"description": "The text associated with this message payload.",
"x-nullable": true
}
},
"required": [
"role"
"role",
"content"
]
},
"ChatRole": {
Expand Down Expand Up @@ -702,7 +704,7 @@
},
"created": {
"type": "integer",
"format": "int32",
"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."
},
"prompt_annotations": {
Expand Down Expand Up @@ -1164,7 +1166,7 @@
"properties": {
"created": {
"type": "integer",
"format": "int64",
"format": "unixtime",
"description": "A timestamp when this job or item was created (in unix epochs)."
},
"data": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@
},
"created": {
"type": "integer",
"format": "int64",
"format": "unixtime",
"description": "A timestamp when this job or item was created (in unix epochs)."
},
"expires": {
Expand Down Expand Up @@ -492,7 +492,7 @@
},
"created": {
"type": "integer",
"format": "int32",
"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": {
Expand Down Expand Up @@ -625,7 +625,8 @@
},
"content": {
"type": "string",
"description": "The text associated with this message payload."
"description": "The text associated with this message payload.",
"x-nullable": true
},
"name": {
"type": "string",
Expand All @@ -638,7 +639,8 @@
}
},
"required": [
"role"
"role",
"content"
]
},
"ChatRole": {
Expand Down Expand Up @@ -729,7 +731,7 @@
},
"created": {
"type": "integer",
"format": "int32",
"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."
},
"prompt_annotations": {
Expand Down Expand Up @@ -1235,7 +1237,7 @@
"properties": {
"created": {
"type": "integer",
"format": "int64",
"format": "unixtime",
"description": "A timestamp when this job or item was created (in unix epochs)."
},
"data": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
},
"created": {
"type": "integer",
"format": "int32",
"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": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
},
"created": {
"type": "integer",
"format": "int32",
"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": {
Expand Down Expand Up @@ -426,11 +426,13 @@
},
"content": {
"type": "string",
"description": "The text associated with this message payload."
"description": "The text associated with this message payload.",
"x-nullable": true
}
},
"required": [
"role"
"role",
"content"
]
},
"ChatRole": {
Expand Down Expand Up @@ -510,7 +512,7 @@
},
"created": {
"type": "integer",
"format": "int32",
"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": {
Expand Down

0 comments on commit e0945ef

Please sign in to comment.