Skip to content

Commit ae21114

Browse files
authored
add batch API
1 parent b4f6961 commit ae21114

1 file changed

Lines changed: 208 additions & 0 deletions

File tree

openapi.yaml

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1166,6 +1166,129 @@ 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/Job'
1185+
'401':
1186+
description: Unauthorized
1187+
content:
1188+
application/json:
1189+
schema:
1190+
$ref: '#/components/schemas/ErrorResponse'
1191+
'500':
1192+
description: Internal Server Error
1193+
content:
1194+
application/json:
1195+
schema:
1196+
$ref: '#/components/schemas/ErrorResponse'
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/JobWithWarning'
1216+
'400':
1217+
description: Bad Request
1218+
content:
1219+
application/json:
1220+
schema:
1221+
$ref: '#/components/schemas/ErrorResponse'
1222+
'401':
1223+
description: Unauthorized
1224+
content:
1225+
application/json:
1226+
schema:
1227+
$ref: '#/components/schemas/ErrorResponse'
1228+
'429':
1229+
description: Too Many Requests
1230+
content:
1231+
application/json:
1232+
schema:
1233+
$ref: '#/components/schemas/ErrorResponse'
1234+
'500':
1235+
description: Internal Server Error
1236+
content:
1237+
application/json:
1238+
schema:
1239+
$ref: '#/components/schemas/ErrorResponse'
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+
responses:
1256+
'200':
1257+
description: OK
1258+
content:
1259+
application/json:
1260+
schema:
1261+
$ref: '#/components/schemas/Job'
1262+
'400':
1263+
description: Bad Request
1264+
content:
1265+
application/json:
1266+
schema:
1267+
$ref: '#/components/schemas/ErrorResponse'
1268+
'401':
1269+
description: Unauthorized
1270+
content:
1271+
application/json:
1272+
schema:
1273+
$ref: '#/components/schemas/ErrorResponse'
1274+
'403':
1275+
description: Forbidden
1276+
content:
1277+
application/json:
1278+
schema:
1279+
$ref: '#/components/schemas/ErrorResponse'
1280+
'404':
1281+
description: Not Found
1282+
content:
1283+
application/json:
1284+
schema:
1285+
$ref: '#/components/schemas/ErrorResponse'
1286+
'500':
1287+
description: Internal Server Error
1288+
content:
1289+
application/json:
1290+
schema:
1291+
$ref: '#/components/schemas/ErrorResponse'
11691292

11701293
components:
11711294
securitySchemes:
@@ -3787,3 +3910,88 @@ components:
37873910
- type
37883911
- data
37893912
title: StreamOutput
3913+
3914+
CreateBatchRequest:
3915+
type: object
3916+
required: [endpoint, input_file_id]
3917+
properties:
3918+
endpoint:
3919+
type: string
3920+
input_file_id:
3921+
type: string
3922+
completion_window:
3923+
type: string
3924+
ErrorResponse:
3925+
type: object
3926+
properties:
3927+
error:
3928+
type: string
3929+
JobWithWarning:
3930+
type: object
3931+
properties:
3932+
job:
3933+
$ref: '#/components/schemas/Job'
3934+
warning:
3935+
type: string
3936+
Job:
3937+
type: object
3938+
properties:
3939+
id:
3940+
type: string
3941+
user_id:
3942+
type: string
3943+
endpoint:
3944+
type: string
3945+
input_file_id:
3946+
type: string
3947+
output_file_id:
3948+
type: string
3949+
error_file_id:
3950+
type: string
3951+
status:
3952+
$ref: '#/components/schemas/JobStatus'
3953+
created_at:
3954+
type: string
3955+
updated_at:
3956+
type: string
3957+
completed_at:
3958+
type: string
3959+
heartbeat_at:
3960+
type: string
3961+
job_deadline:
3962+
type: string
3963+
tokens_reserved_at:
3964+
type: string
3965+
tokens_released_at:
3966+
type: string
3967+
priority:
3968+
type: integer
3969+
file_size_bytes:
3970+
type: integer
3971+
total_chunks:
3972+
type: integer
3973+
total_tokens:
3974+
type: integer
3975+
request_count:
3976+
type: integer
3977+
retry_count:
3978+
type: integer
3979+
model_id:
3980+
type: string
3981+
progress:
3982+
type: number
3983+
error:
3984+
type: string
3985+
JobStatus:
3986+
type: string
3987+
enum:
3988+
- VALIDATING
3989+
- QUEUED
3990+
- CHUNKING
3991+
- CHUNKS_QUEUED
3992+
- AGGREGATION_QUEUED
3993+
- AGGREGATING
3994+
- COMPLETED
3995+
- FAILED
3996+
- EXPIRED
3997+
- CANCELLED

0 commit comments

Comments
 (0)