Skip to content

Commit 47038a9

Browse files
authored
Merge pull request #100 from togethercomputer/batchAPI
add batch API
2 parents 29aab51 + 17e499b commit 47038a9

1 file changed

Lines changed: 224 additions & 0 deletions

File tree

openapi.yaml

Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,130 @@ paths:
11661166
schema:
11671167
$ref: '#/components/schemas/SessionListResponse'
11681168
description: List Response
1169+
/batches:
1170+
get:
1171+
tags: ['batches']
1172+
summary: List batch jobs
1173+
description: List all batch jobs for the authenticated user
1174+
security:
1175+
- bearerAuth: []
1176+
responses:
1177+
'200':
1178+
description: OK
1179+
content:
1180+
application/json:
1181+
schema:
1182+
type: array
1183+
items:
1184+
$ref: '#/components/schemas/BatchJob'
1185+
'401':
1186+
description: Unauthorized
1187+
content:
1188+
application/json:
1189+
schema:
1190+
$ref: '#/components/schemas/BatchErrorResponse'
1191+
'500':
1192+
description: Internal Server Error
1193+
content:
1194+
application/json:
1195+
schema:
1196+
$ref: '#/components/schemas/BatchErrorResponse'
1197+
post:
1198+
tags: ['batches']
1199+
summary: Create a batch job
1200+
description: Create a new batch job with the given input file and endpoint
1201+
security:
1202+
- bearerAuth: []
1203+
requestBody:
1204+
required: true
1205+
content:
1206+
application/json:
1207+
schema:
1208+
$ref: '#/components/schemas/CreateBatchRequest'
1209+
responses:
1210+
'201':
1211+
description: Job created (potentially with warnings)
1212+
content:
1213+
application/json:
1214+
schema:
1215+
$ref: '#/components/schemas/BatchJobWithWarning'
1216+
'400':
1217+
description: Bad Request
1218+
content:
1219+
application/json:
1220+
schema:
1221+
$ref: '#/components/schemas/BatchErrorResponse'
1222+
'401':
1223+
description: Unauthorized
1224+
content:
1225+
application/json:
1226+
schema:
1227+
$ref: '#/components/schemas/BatchErrorResponse'
1228+
'429':
1229+
description: Too Many Requests
1230+
content:
1231+
application/json:
1232+
schema:
1233+
$ref: '#/components/schemas/BatchErrorResponse'
1234+
'500':
1235+
description: Internal Server Error
1236+
content:
1237+
application/json:
1238+
schema:
1239+
$ref: '#/components/schemas/BatchErrorResponse'
1240+
1241+
/batches/{id}:
1242+
get:
1243+
tags: ['batches']
1244+
summary: Get a batch job
1245+
description: Get details of a batch job by ID
1246+
security:
1247+
- bearerAuth: []
1248+
parameters:
1249+
- name: id
1250+
in: path
1251+
required: true
1252+
description: Job ID
1253+
schema:
1254+
type: string
1255+
example: "batch_job_abc123def456"
1256+
responses:
1257+
'200':
1258+
description: OK
1259+
content:
1260+
application/json:
1261+
schema:
1262+
$ref: '#/components/schemas/BatchJob'
1263+
'400':
1264+
description: Bad Request
1265+
content:
1266+
application/json:
1267+
schema:
1268+
$ref: '#/components/schemas/BatchErrorResponse'
1269+
'401':
1270+
description: Unauthorized
1271+
content:
1272+
application/json:
1273+
schema:
1274+
$ref: '#/components/schemas/BatchErrorResponse'
1275+
'403':
1276+
description: Forbidden
1277+
content:
1278+
application/json:
1279+
schema:
1280+
$ref: '#/components/schemas/BatchErrorResponse'
1281+
'404':
1282+
description: Not Found
1283+
content:
1284+
application/json:
1285+
schema:
1286+
$ref: '#/components/schemas/BatchErrorResponse'
1287+
'500':
1288+
description: Internal Server Error
1289+
content:
1290+
application/json:
1291+
schema:
1292+
$ref: '#/components/schemas/BatchErrorResponse'
11691293

11701294
components:
11711295
securitySchemes:
@@ -3799,3 +3923,103 @@ components:
37993923
- type
38003924
- data
38013925
title: StreamOutput
3926+
3927+
CreateBatchRequest:
3928+
type: object
3929+
required: [endpoint, input_file_id]
3930+
properties:
3931+
endpoint:
3932+
type: string
3933+
description: The endpoint to use for batch processing
3934+
example: "/v1/chat/completions"
3935+
input_file_id:
3936+
type: string
3937+
description: ID of the uploaded input file containing batch requests
3938+
example: "file-abc123def456ghi789"
3939+
completion_window:
3940+
type: string
3941+
description: Time window for batch completion (optional)
3942+
example: "24h"
3943+
priority:
3944+
type: integer
3945+
description: Priority for batch processing (optional)
3946+
example: 1
3947+
model_id:
3948+
type: string
3949+
description: "Model to use for processing batch requests"
3950+
example: "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo"
3951+
BatchErrorResponse:
3952+
type: object
3953+
properties:
3954+
error:
3955+
type: string
3956+
BatchJobWithWarning:
3957+
type: object
3958+
properties:
3959+
job:
3960+
$ref: '#/components/schemas/BatchJob'
3961+
warning:
3962+
type: string
3963+
BatchJob:
3964+
type: object
3965+
properties:
3966+
id:
3967+
type: string
3968+
format: uuid
3969+
example: "01234567-8901-2345-6789-012345678901"
3970+
user_id:
3971+
type: string
3972+
example: "user_789xyz012"
3973+
input_file_id:
3974+
type: string
3975+
example: "file-input123abc456def"
3976+
file_size_bytes:
3977+
type: integer
3978+
format: int64
3979+
example: 1048576
3980+
description: "Size of input file in bytes"
3981+
status:
3982+
$ref: '#/components/schemas/BatchJobStatus'
3983+
job_deadline:
3984+
type: string
3985+
format: date-time
3986+
example: "2024-01-15T15:30:00Z"
3987+
created_at:
3988+
type: string
3989+
format: date-time
3990+
example: "2024-01-15T14:30:00Z"
3991+
endpoint:
3992+
type: string
3993+
example: "/v1/chat/completions"
3994+
progress:
3995+
type: number
3996+
format: float64
3997+
example: 75.0
3998+
description: "Completion progress (0.0 to 100)"
3999+
model_id:
4000+
type: string
4001+
example: "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo"
4002+
description: "Model used for processing requests"
4003+
output_file_id:
4004+
type: string
4005+
example: "file-output789xyz012ghi"
4006+
error_file_id:
4007+
type: string
4008+
example: "file-errors456def789jkl"
4009+
error:
4010+
type: string
4011+
completed_at:
4012+
type: string
4013+
format: date-time
4014+
example: "2024-01-15T15:45:30Z"
4015+
BatchJobStatus:
4016+
type: string
4017+
enum:
4018+
- VALIDATING
4019+
- IN_PROGRESS
4020+
- COMPLETED
4021+
- FAILED
4022+
- EXPIRED
4023+
- CANCELLED
4024+
example: "IN_PROGRESS"
4025+
description: "Current status of the batch job"

0 commit comments

Comments
 (0)