gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
help me create openapi json file for openai api (completion endpoint) along with auth…
- User
help me create openapi json file for openai api (completion endpoint) along with auth bearer. And please tell me where to update it
- Assistant
Here is an example OpenAPI JSON file for OpenAI's completion endpoint with an authentication bearer:
{ "openapi": "3.0.0", "info": { "title": "OpenAI Completion API", "version": "v1", "description": "API for generating natural language text." }, "servers": [ { "url": "https://api.openai.com/v1", "description": "OpenAI API server" } ], "components": { "securitySchemes": { "bearerAuth": { "type": "http", "scheme": "bearer" } } }, "security": [ { "bearerAuth": [] } ], "paths": { "/completions": { "post": { "summary": "Generate text completion.", "description": "", "operationId": "completions", "requestBody": { "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompletionRequest" } } } }, "responses": { "200": { "description": "Successful Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CompletionResponse" } } } } } } } }, "schemas": { "CompletionRequest": { "type": "object", "properties": { "model": { "type": "string", "enum": ["text-davinci-002"] }, "prompt": { "type": "string" }, "max_tokens": { "type": "integer", "minimum": 1, "maximum": 2048 }, "temperature": { "type": "number", "minimum": 0.0, "maximum": 1.0, "default": 0.5 }, "n": { "type": "integer", "minimum": 1, "maximum": 10, "default": 1 } }, "required": [ "model", "prompt" ] }, "CompletionResponse": { "type": "object", "properties": { "choices": { "type": "array", "items": { "$ref": "#/components/schemas/CompletionChoice" } } }, "required": [ "choices" ] }, "CompletionChoice": { "type": "object", "properties": { "text": { "type": "string" } }, "required": [ "text" ] } } }To update this file, you can edit it in a plain text editor or use an OpenAPI editor such as Swagger Editor or Insomnia Designer. You may also need to replace the
modelproperty value with the model you wish to use for generating text.