Skip to content

Commit 7973a7b

Browse files
committed
1.0.4
1 parent b658488 commit 7973a7b

File tree

1 file changed

+236
-2
lines changed

1 file changed

+236
-2
lines changed

openapi.yaml

Lines changed: 236 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ openapi: 3.0.0
22
info:
33
title: OpenAI API
44
description: APIs for sampling from and fine-tuning language models
5-
version: '1.0.3'
5+
version: '1.0.4'
66
servers:
77
- url: https://api.openai.com/v1
88
tags:
@@ -226,6 +226,82 @@ paths:
226226
oaiMeta:
227227
excludeFromDocs: true
228228

229+
/engines/{engine_id}/edits:
230+
post:
231+
operationId: createEdit
232+
tags:
233+
- OpenAI
234+
summary: Creates a new edit for the provided input, instruction, and parameters
235+
parameters:
236+
- in: path
237+
name: engine_id
238+
required: true
239+
schema:
240+
type: string
241+
example: text-davinci-edit-001
242+
description: *engine_id_description
243+
requestBody:
244+
required: true
245+
content:
246+
application/json:
247+
schema:
248+
$ref: '#/components/schemas/CreateEditRequest'
249+
responses:
250+
"200":
251+
description: OK
252+
content:
253+
application/json:
254+
schema:
255+
$ref: '#/components/schemas/CreateEditResponse'
256+
oaiMeta:
257+
name: Create edit
258+
group: edits
259+
path: create
260+
examples:
261+
curl: |
262+
curl https://api.openai.com/v1/engines/VAR_engine_id/edits \
263+
-H 'Content-Type: application/json' \
264+
-H 'Authorization: Bearer YOUR_API_KEY' \
265+
-d '{
266+
"input": "What day of the wek is it?",
267+
"instruction": "Fix the spelling mistakes"
268+
}'
269+
python: |
270+
import os
271+
import openai
272+
openai.api_key = os.getenv("OPENAI_API_KEY")
273+
openai.Edit.create(
274+
engine="VAR_engine_id",
275+
input="What day of the wek is it?",
276+
instruction="Fix the spelling mistakes"
277+
)
278+
node.js: |
279+
const { Configuration, OpenAIApi } = require("openai");
280+
const configuration = new Configuration({
281+
apiKey: process.env.OPENAI_API_KEY,
282+
});
283+
const openai = new OpenAIApi(configuration);
284+
const response = await openai.createEdit("VAR_engine_id", {
285+
input: "What day of the wek is it?",
286+
instruction: "Fix the spelling mistakes",
287+
});
288+
parameters: |
289+
{
290+
"input": "What day of the wek is it?",
291+
"instruction": "Fix the spelling mistakes",
292+
}
293+
response: |
294+
{
295+
"object": "edit",
296+
"created": 1589478378,
297+
"choices": [
298+
{
299+
"text": "What day of the week is it?",
300+
"index": 0,
301+
}
302+
]
303+
}
304+
229305
/engines/{engine_id}/search:
230306
post:
231307
operationId: createSearch
@@ -1230,6 +1306,49 @@ paths:
12301306
]
12311307
}
12321308
1309+
/models/{model}:
1310+
delete:
1311+
operationId: deleteModel
1312+
tags:
1313+
- OpenAI
1314+
summary: Delete a fine-tuned model. You must have the Owner role in your organization.
1315+
parameters:
1316+
- in: path
1317+
name: model
1318+
required: true
1319+
schema:
1320+
type: string
1321+
example: curie:ft-acmeco-2021-03-03-21-44-20
1322+
description: The model to delete
1323+
responses:
1324+
"200":
1325+
description: OK
1326+
content:
1327+
application/json:
1328+
schema:
1329+
$ref: '#/components/schemas/DeleteModelResponse'
1330+
oaiMeta:
1331+
name: Delete fine-tune model
1332+
group: fine-tunes
1333+
path: delete-model
1334+
beta: true
1335+
examples:
1336+
curl: |
1337+
curl https://api.openai.com/v1/models/curie:ft-acmeco-2021-03-03-21-44-20 \
1338+
-X DELETE \
1339+
-H "Authorization: Bearer YOUR_API_KEY"
1340+
python: |
1341+
import os
1342+
import openai
1343+
openai.api_key = os.getenv("OPENAI_API_KEY")
1344+
openai.Model.delete("curie:ft-acmeco-2021-03-03-21-44-20")
1345+
response: |
1346+
{
1347+
"id": "curie:ft-acmeco-2021-03-03-21-44-20",
1348+
"object": "model",
1349+
"deleted": true
1350+
}
1351+
12331352
/engines/{engine_id}/embeddings:
12341353
post:
12351354
operationId: createEmbedding
@@ -1320,6 +1439,16 @@ components:
13201439
type: array
13211440
items:
13221441
$ref: '#/components/schemas/Engine'
1442+
1443+
DeleteModelResponse:
1444+
type: object
1445+
properties:
1446+
id:
1447+
type: string
1448+
object:
1449+
type: string
1450+
deleted:
1451+
type: boolean
13231452

13241453
CreateCompletionRequest:
13251454
type: object
@@ -1353,6 +1482,20 @@ components:
13531482
items:
13541483
type: integer
13551484
example: "[[1212, 318, 257, 1332, 13]]"
1485+
suffix:
1486+
description:
1487+
The suffix that comes after a completion of inserted text, encoded as a string or array of strings.
1488+
default: null
1489+
nullable: true
1490+
oneOf:
1491+
- type: string
1492+
default: ''
1493+
example: "test."
1494+
- type: array
1495+
items:
1496+
type: string
1497+
default: ''
1498+
example: "test."
13561499
max_tokens:
13571500
type: integer
13581501
minimum: 0
@@ -1362,7 +1505,7 @@ components:
13621505
description: &completions_max_tokens_description |
13631506
The maximum number of [tokens](/tokenizer) to generate in the completion.
13641507

1365-
The token count of your prompt plus `max_tokens` cannot exceed the model's context length. Most models have a context length of 2048 tokens (except `code-davinci-001`, which supports 4096).
1508+
The token count of your prompt plus `max_tokens` cannot exceed the model's context length. Most models have a context length of 2048 tokens (except for the newest models, which support 4096).
13661509
temperature:
13671510
type: number
13681511
minimum: 0
@@ -1536,6 +1679,83 @@ components:
15361679
description: ID of the model to use for completion.
15371680
type: string
15381681

1682+
CreateEditRequest:
1683+
type: object
1684+
properties:
1685+
input:
1686+
description:
1687+
The input text to use as a starting point for the edit.
1688+
type: string
1689+
default: ""
1690+
nullable: true
1691+
example: "What day of the wek is it?"
1692+
instruction:
1693+
description:
1694+
The instruction that tells the model how to edit the prompt.
1695+
type: string
1696+
example: "Fix the spelling mistakes."
1697+
temperature:
1698+
type: number
1699+
minimum: 0
1700+
maximum: 2
1701+
default: 1
1702+
example: 1
1703+
nullable: true
1704+
description: *completions_temperature_description
1705+
top_p:
1706+
type: number
1707+
minimum: 0
1708+
maximum: 1
1709+
default: 1
1710+
example: 1
1711+
nullable: true
1712+
description: *completions_top_p_description
1713+
required:
1714+
- instruction
1715+
1716+
CreateEditResponse:
1717+
type: object
1718+
properties:
1719+
id:
1720+
type: string
1721+
object:
1722+
type: string
1723+
created:
1724+
type: integer
1725+
model:
1726+
type: string
1727+
choices:
1728+
type: array
1729+
items:
1730+
type: object
1731+
properties:
1732+
text:
1733+
type: string
1734+
index:
1735+
type: integer
1736+
logprobs:
1737+
type: object
1738+
nullable: true
1739+
properties:
1740+
tokens:
1741+
type: array
1742+
items:
1743+
type: string
1744+
token_logprobs:
1745+
type: array
1746+
items:
1747+
type: number
1748+
top_logprobs:
1749+
type: array
1750+
items:
1751+
type: object
1752+
text_offset:
1753+
type: array
1754+
items:
1755+
type: integer
1756+
finish_reason:
1757+
type: string
1758+
15391759
CreateSearchRequest:
15401760
type: object
15411761
properties:
@@ -2027,6 +2247,16 @@ components:
20272247
example: [0.6, 1, 1.5, 2]
20282248
default: null
20292249
nullable: true
2250+
suffix:
2251+
description: |
2252+
A string of up to 40 characters that will be added to your fine-tuned model name.
2253+
2254+
For example, a `suffix` of "custom-model-name" would produce a model name like `ada:ft-your-org:custom-model-name-2022-02-15-04-21-04`.
2255+
type: string
2256+
minLength: 1
2257+
maxLength: 40
2258+
default: null
2259+
nullable: true
20302260
required:
20312261
- training_file
20322262

@@ -2201,6 +2431,10 @@ oaiMeta:
22012431
title: Completions
22022432
description: |
22032433
Given a prompt, the model will return one or more predicted completions, and can also return the probabilities of alternative tokens at each position.
2434+
- id: edits
2435+
title: Edits
2436+
description: |
2437+
Given a prompt and an instruction, the model will return an edited version of the prompt.
22042438
- id: searches
22052439
title: Searches
22062440
description: |

0 commit comments

Comments
 (0)