|
| 1 | +openapi: 3.0.0 |
| 2 | +info: |
| 3 | + title: Completions API |
| 4 | + version: 1.0.0 |
| 5 | + description: API for generating text completions |
| 6 | + |
| 7 | +paths: |
| 8 | + /completions: |
| 9 | + post: |
| 10 | + summary: Create a completion |
| 11 | + operationId: createCompletion |
| 12 | + requestBody: |
| 13 | + required: true |
| 14 | + content: |
| 15 | + application/json: |
| 16 | + schema: |
| 17 | + $ref: '#/components/schemas/CreateCompletionRequest' |
| 18 | + responses: |
| 19 | + '200': |
| 20 | + description: Successful completion response |
| 21 | + content: |
| 22 | + application/json: |
| 23 | + schema: |
| 24 | + type: object |
| 25 | + # Note: Full response schema would be defined here |
| 26 | + |
| 27 | +components: |
| 28 | + schemas: |
| 29 | + CreateCompletionRequest: |
| 30 | + type: object |
| 31 | + required: |
| 32 | + - model |
| 33 | + - prompt |
| 34 | + properties: |
| 35 | + model: |
| 36 | + description: ID of the model to use |
| 37 | + anyOf: |
| 38 | + - type: string |
| 39 | + - type: string |
| 40 | + enum: |
| 41 | + - gpt-3.5-turbo-instruct |
| 42 | + - davinci-002 |
| 43 | + - babbage-002 |
| 44 | + prompt: |
| 45 | + description: The prompt(s) to generate completions for |
| 46 | + default: <|endoftext|> |
| 47 | + oneOf: |
| 48 | + - type: string |
| 49 | + default: "" |
| 50 | + example: This is a test. |
| 51 | + - type: array |
| 52 | + items: |
| 53 | + type: string |
| 54 | + default: "" |
| 55 | + example: This is a test. |
| 56 | + - type: array |
| 57 | + minItems: 1 |
| 58 | + items: |
| 59 | + type: integer |
| 60 | + example: "[1212, 318, 257, 1332, 13]" |
| 61 | + - type: array |
| 62 | + minItems: 1 |
| 63 | + items: |
| 64 | + type: array |
| 65 | + minItems: 1 |
| 66 | + items: |
| 67 | + type: integer |
| 68 | + example: "[[1212, 318, 257, 1332, 13]]" |
| 69 | + max_tokens: |
| 70 | + type: integer |
| 71 | + minimum: 0 |
| 72 | + default: 16 |
| 73 | + nullable: true |
| 74 | + description: The maximum number of tokens that can be generated in the completion |
| 75 | + temperature: |
| 76 | + type: number |
| 77 | + minimum: 0 |
| 78 | + maximum: 2 |
| 79 | + default: 1 |
| 80 | + nullable: true |
| 81 | + description: What sampling temperature to use, between 0 and 2 |
| 82 | + top_p: |
| 83 | + type: number |
| 84 | + minimum: 0 |
| 85 | + maximum: 1 |
| 86 | + default: 1 |
| 87 | + nullable: true |
| 88 | + description: An alternative to sampling with temperature, called nucleus sampling |
| 89 | + n: |
| 90 | + type: integer |
| 91 | + minimum: 1 |
| 92 | + maximum: 128 |
| 93 | + default: 1 |
| 94 | + nullable: true |
| 95 | + description: How many completions to generate for each prompt |
| 96 | + stream: |
| 97 | + type: boolean |
| 98 | + nullable: true |
| 99 | + default: false |
| 100 | + description: Whether to stream back partial progress |
| 101 | + logprobs: |
| 102 | + type: integer |
| 103 | + minimum: 0 |
| 104 | + maximum: 5 |
| 105 | + nullable: true |
| 106 | + description: Include the log probabilities on the most likely output tokens |
| 107 | + echo: |
| 108 | + type: boolean |
| 109 | + default: false |
| 110 | + nullable: true |
| 111 | + description: Echo back the prompt in addition to the completion |
| 112 | + stop: |
| 113 | + description: Up to 4 sequences where the API will stop generating further tokens |
| 114 | + nullable: true |
| 115 | + oneOf: |
| 116 | + - type: string |
| 117 | + example: "\n" |
| 118 | + - type: array |
| 119 | + minItems: 1 |
| 120 | + maxItems: 4 |
| 121 | + items: |
| 122 | + type: string |
| 123 | + presence_penalty: |
| 124 | + type: number |
| 125 | + default: 0 |
| 126 | + minimum: -2 |
| 127 | + maximum: 2 |
| 128 | + nullable: true |
| 129 | + description: Number between -2.0 and 2.0 for presence-based penalty |
| 130 | + frequency_penalty: |
| 131 | + type: number |
| 132 | + default: 0 |
| 133 | + minimum: -2 |
| 134 | + maximum: 2 |
| 135 | + nullable: true |
| 136 | + description: Number between -2.0 and 2.0 for frequency-based penalty |
| 137 | + best_of: |
| 138 | + type: integer |
| 139 | + default: 1 |
| 140 | + minimum: 0 |
| 141 | + maximum: 20 |
| 142 | + nullable: true |
| 143 | + description: Number of completions to generate server-side |
| 144 | + logit_bias: |
| 145 | + type: object |
| 146 | + nullable: true |
| 147 | + additionalProperties: |
| 148 | + type: integer |
| 149 | + description: Modify the likelihood of specified tokens appearing |
| 150 | + user: |
| 151 | + type: string |
| 152 | + example: user-1234 |
| 153 | + description: A unique identifier representing your end-user |
| 154 | + seed: |
| 155 | + type: integer |
| 156 | + format: int64 |
| 157 | + nullable: true |
| 158 | + description: Seed for deterministic sampling |
| 159 | + suffix: |
| 160 | + type: string |
| 161 | + nullable: true |
| 162 | + description: The suffix that comes after a completion of inserted text |
0 commit comments