From aa031ebc3fb96def6a2b69f193f1aebc26860660 Mon Sep 17 00:00:00 2001 From: David Schnurr Date: Fri, 16 Jun 2023 09:12:04 -0700 Subject: [PATCH] fix chat completions stream response type --- openapi.yaml | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/openapi.yaml b/openapi.yaml index b234996d..95d4e0f0 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2293,6 +2293,7 @@ components: type: integer finish_reason: type: string + enum: ["stop", "length"] usage: type: object properties: @@ -2369,6 +2370,7 @@ components: content: type: string description: The contents of the message. + nullable: true function_call: type: object description: The name and arguments of a function that should be called, as generated by the model. @@ -2381,6 +2383,28 @@ components: description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. required: - role + + ChatCompletionStreamResponseDelta: + type: object + properties: + role: + type: string + enum: ["system", "user", "assistant", "function"] + description: The role of the author of this message. + content: + type: string + description: The contents of the chunk message. + nullable: true + function_call: + type: object + description: The name and arguments of a function that should be called, as generated by the model. + properties: + name: + type: string + description: The name of the function to call. + arguments: + type: string + description: The arguments to call the function with, as generated by the model in JSON format. Note that the model does not always generate valid JSON, and may hallucinate parameters not defined by your function schema. Validate the arguments in your code before calling your function. CreateChatCompletionRequest: type: object @@ -2512,6 +2536,7 @@ components: $ref: '#/components/schemas/ChatCompletionResponseMessage' finish_reason: type: string + enum: ["stop", "length", "function_call"] usage: type: object properties: @@ -2532,6 +2557,36 @@ components: - model - choices + CreateChatCompletionStreamResponse: + type: object + properties: + id: + type: string + object: + type: string + created: + type: integer + model: + type: string + choices: + type: array + items: + type: object + properties: + index: + type: integer + delta: + $ref: '#/components/schemas/ChatCompletionStreamResponseDelta' + finish_reason: + type: string + enum: ["stop", "length", "function_call"] + required: + - id + - object + - created + - model + - choices + CreateEditRequest: type: object properties: @@ -2617,6 +2672,7 @@ components: type: integer finish_reason: type: string + enum: ["stop", "length"] usage: type: object properties: