* @deprecated The Edits API is deprecated; please use Chat Completions instead.
(
key: IntegrationTaskKey,
params: Prettify<OpenAI.EditCreateParams>,
options: OpenAIRequestOptions = {}
)
| 16 | * @deprecated The Edits API is deprecated; please use Chat Completions instead. |
| 17 | */ |
| 18 | create( |
| 19 | key: IntegrationTaskKey, |
| 20 | params: Prettify<OpenAI.EditCreateParams>, |
| 21 | options: OpenAIRequestOptions = {} |
| 22 | ): Promise<OpenAI.Edit> { |
| 23 | let properties = [ |
| 24 | { |
| 25 | label: "Model", |
| 26 | text: params.model, |
| 27 | }, |
| 28 | ]; |
| 29 | |
| 30 | if (params.input) { |
| 31 | properties.push({ |
| 32 | label: "Input", |
| 33 | text: truncate(params.input, 40), |
| 34 | }); |
| 35 | } |
| 36 | |
| 37 | properties.push({ |
| 38 | label: "Instruction", |
| 39 | text: truncate(params.instruction, 40), |
| 40 | }); |
| 41 | |
| 42 | return this.runTask( |
| 43 | key, |
| 44 | async (client, task) => { |
| 45 | const { data, response } = await client.edits |
| 46 | .create(params, { |
| 47 | idempotencyKey: task.idempotencyKey, |
| 48 | ...options, |
| 49 | }) |
| 50 | .withResponse(); |
| 51 | task.outputProperties = createTaskOutputProperties(data.usage, response.headers); |
| 52 | return data; |
| 53 | }, |
| 54 | { |
| 55 | name: "Create edit", |
| 56 | params, |
| 57 | properties, |
| 58 | }, |
| 59 | handleOpenAIError |
| 60 | ); |
| 61 | } |
| 62 | } |
nothing calls this directly
no test coverage detected