Skip to content

Commit 8c6bef9

Browse files
authored
Add Batch API to cancel batch processing
1 parent 42068fe commit 8c6bef9

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

openapi.yaml

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3890,7 +3890,102 @@ paths:
38903890
application/json:
38913891
schema:
38923892
$ref: '#/components/schemas/BatchErrorResponse'
3893+
/batches/{id}/cancel:
3894+
post:
3895+
tags: ['Batches']
3896+
summary: Cancel a batch job
3897+
description: Cancel a batch job by ID
3898+
x-codeSamples:
3899+
- lang: Python
3900+
label: Together AI SDK (Python)
3901+
source: |
3902+
from together import Together
3903+
import os
3904+
3905+
client = Together(
3906+
api_key=os.environ.get("TOGETHER_API_KEY"),
3907+
)
3908+
3909+
batch = client.batches.cancel("batch_id")
3910+
3911+
print(batch)
3912+
- lang: TypeScript
3913+
label: Together AI SDK (TypeScript)
3914+
source: |
3915+
import Together from "together-ai";
3916+
3917+
const client = new Together({
3918+
apiKey: process.env.TOGETHER_API_KEY,
3919+
});
3920+
3921+
const batch = await client.batches.cancel("batch-id");
3922+
3923+
console.log(batch);
3924+
- lang: JavaScript
3925+
label: Together AI SDK (JavaScript)
3926+
source: |
3927+
import Together from "together-ai";
3928+
3929+
const client = new Together({
3930+
apiKey: process.env.TOGETHER_API_KEY,
3931+
});
3932+
3933+
const batch = await client.batches.cancel("batch-id");
38933934
3935+
console.log(batch);
3936+
- lang: Shell
3937+
label: cURL
3938+
source: |
3939+
curl -X POST "https://api.together.xyz/v1/batches/ID/cancel" \
3940+
-H "Authorization: Bearer $TOGETHER_API_KEY" \
3941+
-H "Content-Type: application/json"
3942+
security:
3943+
- bearerAuth: []
3944+
parameters:
3945+
- name: id
3946+
in: path
3947+
required: true
3948+
description: Job ID
3949+
schema:
3950+
type: string
3951+
example: 'batch_job_abc123def456'
3952+
responses:
3953+
'200':
3954+
description: OK
3955+
content:
3956+
application/json:
3957+
schema:
3958+
$ref: '#/components/schemas/BatchJob'
3959+
'400':
3960+
description: Bad Request
3961+
content:
3962+
application/json:
3963+
schema:
3964+
$ref: '#/components/schemas/BatchErrorResponse'
3965+
'401':
3966+
description: Unauthorized
3967+
content:
3968+
application/json:
3969+
schema:
3970+
$ref: '#/components/schemas/BatchErrorResponse'
3971+
'403':
3972+
description: Forbidden
3973+
content:
3974+
application/json:
3975+
schema:
3976+
$ref: '#/components/schemas/BatchErrorResponse'
3977+
'404':
3978+
description: Not Found
3979+
content:
3980+
application/json:
3981+
schema:
3982+
$ref: '#/components/schemas/BatchErrorResponse'
3983+
'500':
3984+
description: Internal Server Error
3985+
content:
3986+
application/json:
3987+
schema:
3988+
$ref: '#/components/schemas/BatchErrorResponse'
38943989
/evaluation:
38953990
post:
38963991
tags:

0 commit comments

Comments
 (0)