openai-openapi icon indicating copy to clipboard operation
openai-openapi copied to clipboard

Add Server-sent events response type to `createChatCompletion`

Open atacan opened this issue 1 year ago • 0 comments

In the createChatCompletion operation there is only json as response type. However the same endpoint returns event stream when the request is created with stream = true

Because of this openapi-based code generators do not handle SSE response. Adding text/event-stream to the response types, will help using the schema without additional effort.

Current file:

/chat/completions:
    post:
      operationId: createChatCompletion
      tags:
        - Chat
      summary: Creates a model response for the given chat conversation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateChatCompletionRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreateChatCompletionResponse"

atacan avatar Feb 18 '24 10:02 atacan