Skip to content

Commit 2ad6f78

Browse files
committed
add list batch
1 parent d3f8430 commit 2ad6f78

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

openapi.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2413,6 +2413,79 @@ paths:
24132413
"batch_description": "Nightly eval job",
24142414
}
24152415
}
2416+
get:
2417+
operationId: listBatches
2418+
tags:
2419+
- Batch
2420+
summary: List your organization's batches.
2421+
parameters:
2422+
- in: query
2423+
name: after
2424+
required: false
2425+
schema:
2426+
type: string
2427+
description: Identifier for the last batch from the previous pagination request.
2428+
- name: limit
2429+
in: query
2430+
description: Number of batches to retrieve.
2431+
required: false
2432+
schema:
2433+
type: integer
2434+
default: 20
2435+
responses:
2436+
'200':
2437+
description: Batch listed successfully.
2438+
content:
2439+
application/json:
2440+
schema:
2441+
$ref: '#/components/schemas/ListBatchesResponse'
2442+
x-oaiMeta:
2443+
name: List batch
2444+
group: batch
2445+
returns: A list of paginated [Batch](/docs/api-reference/batch/object) objects.
2446+
examples:
2447+
request:
2448+
curl: |
2449+
curl https://api.openai.com/v1/batches?limit=2 \
2450+
-H "Authorization: Bearer $OPENAI_API_KEY" \
2451+
-H "Content-Type: application/json"
2452+
response: &batch_object |
2453+
{
2454+
"object": "list",
2455+
"data": [
2456+
{
2457+
"id": "batch_abc123",
2458+
"object": "batch",
2459+
"endpoint": "/v1/completions",
2460+
"errors": null,
2461+
"input_file_id": "file-abc123",
2462+
"completion_window": "24h",
2463+
"status": "completed",
2464+
"output_file_id": "file-cvaTdG",
2465+
"error_file_id": "file-HOWS94",
2466+
"created_at": 1711471533,
2467+
"in_progress_at": 1711471538,
2468+
"expires_at": 1711557933,
2469+
"finalizing_at": 1711493133,
2470+
"completed_at": 1711493163,
2471+
"failed_at": null,
2472+
"expired_at": null,
2473+
"cancelling_at": null,
2474+
"cancelled_at": null,
2475+
"request_counts": {
2476+
"total": 100,
2477+
"completed": 95,
2478+
"failed": 5
2479+
},
2480+
"metadata": {
2481+
"customer_id": "user_123456789",
2482+
"batch_description": "Nightly job",
2483+
}
2484+
},
2485+
{ ... },
2486+
],
2487+
"has_more": true
2488+
}
24162489

24172490
/batches/{batch_id}:
24182491
get:
@@ -12587,6 +12660,22 @@ components:
1258712660
name: The request output object
1258812661
example: |
1258912662
{"id": "batch_req_wnaDys", "custom_id": "request-2", "response": {"status_code": 200, "request_id": "req_c187b3", "body": {"id": "chatcmpl-9758Iw", "object": "chat.completion", "created": 1711475054, "model": "gpt-3.5-turbo", "choices": [{"index": 0, "message": {"role": "assistant", "content": "2 + 2 equals 4."}, "finish_reason": "stop"}], "usage": {"prompt_tokens": 24, "completion_tokens": 15, "total_tokens": 39}, "system_fingerprint": null}}, "error": null}
12663+
ListBatchesResponse:
12664+
type: object
12665+
properties:
12666+
data:
12667+
type: array
12668+
items:
12669+
$ref: "#/components/schemas/Batch"
12670+
has_more:
12671+
type: boolean
12672+
object:
12673+
type: string
12674+
enum: [list]
12675+
required:
12676+
- object
12677+
- data
12678+
- has_more
1259012679

1259112680
security:
1259212681
- ApiKeyAuth: []
@@ -12725,6 +12814,9 @@ x-oaiMeta:
1272512814
- type: endpoint
1272612815
key: cancelBatch
1272712816
path: cancel
12817+
- type: endpoint
12818+
key: listBatches
12819+
path: list
1272812820
- type: object
1272912821
key: Batch
1273012822
path: object

0 commit comments

Comments
 (0)