Skip to content

Commit

Permalink
Restoring for older versions ChatMessageContent
Browse files Browse the repository at this point in the history
  • Loading branch information
jpalvarezl committed Sep 27, 2024
1 parent 52b029a commit fd67682
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ using TypeSpec.Versioning;

namespace Azure.OpenAI;

#suppress "@azure-tools/typespec-autorest/union-unsupported" "External API shape is defined in OpenAPI 3.0 as oneOf."
@removed(ServiceApiVersions.v2024_08_01_Preview)
@doc("The contents of the user message, with available input types varying by selected model.")
union ChatMessageContent {
string,

@added(ServiceApiVersions.v2024_02_15_Preview)
ChatMessageContentItem[],
}

@added(ServiceApiVersions.v2024_02_15_Preview)
@doc("An abstract representation of a structured content item within a chat message.")
@discriminator("type")
Expand Down Expand Up @@ -121,7 +131,7 @@ model ChatRequestUserMessage extends ChatRequestMessage {

#suppress "@azure-tools/typespec-autorest/union-unsupported" "OpenAPI v2 support deferred"
@doc("The contents of the user message, with available input types varying by selected model.")
@typeChangedFrom(ServiceApiVersions.v2024_08_01_Preview, string | ChatMessageContentItem[])
@typeChangedFrom(ServiceApiVersions.v2024_08_01_Preview, ChatMessageContent)
content: string | ChatMessageTextContentItem[] | ChatMessageImageContentItem[];

@doc("An optional name for the participant.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,10 @@
"messages"
]
},
"ChatMessageContent": {
"type": "string",
"x-nullable": false
},
"ChatRequestAssistantMessage": {
"type": "object",
"description": "A request chat message representing response or action from the assistant.",
Expand Down Expand Up @@ -652,6 +656,7 @@
"description": "A request chat message representing user input to the assistant.",
"properties": {
"content": {
"$ref": "#/definitions/ChatMessageContent",
"description": "The contents of the user message, with available input types varying by selected model."
},
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,10 @@
"messages"
]
},
"ChatMessageContent": {
"type": "string",
"x-nullable": false
},
"ChatRequestAssistantMessage": {
"type": "object",
"description": "A request chat message representing response or action from the assistant.",
Expand Down Expand Up @@ -694,6 +698,7 @@
"description": "A request chat message representing user input to the assistant.",
"properties": {
"content": {
"$ref": "#/definitions/ChatMessageContent",
"description": "The contents of the user message, with available input types varying by selected model."
},
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2326,6 +2326,7 @@
"type"
]
},
"ChatMessageContent": {},
"ChatRequestAssistantMessage": {
"type": "object",
"description": "A request chat message representing response or action from the assistant.",
Expand Down Expand Up @@ -2454,6 +2455,7 @@
"description": "A request chat message representing user input to the assistant.",
"properties": {
"content": {
"$ref": "#/definitions/ChatMessageContent",
"description": "The contents of the user message, with available input types varying by selected model."
},
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2326,6 +2326,7 @@
"type"
]
},
"ChatMessageContent": {},
"ChatRequestAssistantMessage": {
"type": "object",
"description": "A request chat message representing response or action from the assistant.",
Expand Down Expand Up @@ -2454,6 +2455,7 @@
"description": "A request chat message representing user input to the assistant.",
"properties": {
"content": {
"$ref": "#/definitions/ChatMessageContent",
"description": "The contents of the user message, with available input types varying by selected model."
},
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2462,6 +2462,7 @@
"type"
]
},
"ChatMessageContent": {},
"ChatRequestAssistantMessage": {
"type": "object",
"description": "A request chat message representing response or action from the assistant.",
Expand Down Expand Up @@ -2590,6 +2591,7 @@
"description": "A request chat message representing user input to the assistant.",
"properties": {
"content": {
"$ref": "#/definitions/ChatMessageContent",
"description": "The contents of the user message, with available input types varying by selected model."
},
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2616,6 +2616,7 @@
"type"
]
},
"ChatMessageContent": {},
"ChatRequestAssistantMessage": {
"type": "object",
"description": "A request chat message representing response or action from the assistant.",
Expand Down Expand Up @@ -2744,6 +2745,7 @@
"description": "A request chat message representing user input to the assistant.",
"properties": {
"content": {
"$ref": "#/definitions/ChatMessageContent",
"description": "The contents of the user message, with available input types varying by selected model."
},
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3293,6 +3293,7 @@
"type"
]
},
"ChatMessageContent": {},
"ChatRequestAssistantMessage": {
"type": "object",
"description": "A request chat message representing response or action from the assistant.",
Expand Down Expand Up @@ -3421,6 +3422,7 @@
"description": "A request chat message representing user input to the assistant.",
"properties": {
"content": {
"$ref": "#/definitions/ChatMessageContent",
"description": "The contents of the user message, with available input types varying by selected model."
},
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,10 @@
"messages"
]
},
"ChatMessageContent": {
"type": "string",
"x-nullable": false
},
"ChatRequestAssistantMessage": {
"type": "object",
"description": "A request chat message representing response or action from the assistant.",
Expand Down Expand Up @@ -469,6 +473,7 @@
"description": "A request chat message representing user input to the assistant.",
"properties": {
"content": {
"$ref": "#/definitions/ChatMessageContent",
"description": "The contents of the user message, with available input types varying by selected model."
},
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,10 @@
"messages"
]
},
"ChatMessageContent": {
"type": "string",
"x-nullable": false
},
"ChatRequestAssistantMessage": {
"type": "object",
"description": "A request chat message representing response or action from the assistant.",
Expand Down Expand Up @@ -694,6 +698,7 @@
"description": "A request chat message representing user input to the assistant.",
"properties": {
"content": {
"$ref": "#/definitions/ChatMessageContent",
"description": "The contents of the user message, with available input types varying by selected model."
},
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2616,6 +2616,7 @@
"type"
]
},
"ChatMessageContent": {},
"ChatRequestAssistantMessage": {
"type": "object",
"description": "A request chat message representing response or action from the assistant.",
Expand Down Expand Up @@ -2744,6 +2745,7 @@
"description": "A request chat message representing user input to the assistant.",
"properties": {
"content": {
"$ref": "#/definitions/ChatMessageContent",
"description": "The contents of the user message, with available input types varying by selected model."
},
"name": {
Expand Down

0 comments on commit fd67682

Please sign in to comment.