Skip to content

Commit b13d6fe

Browse files
feat(api): support for images in batch api
1 parent 1c6d3d2 commit b13d6fe

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 148
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-7debfce2217c66ea87bfddaa244b57de4062dd7fd766fa9a28e869614205c040.yml
3-
openapi_spec_hash: e910fc478b8449134e2af1dc15fd33f7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/openai%2Fopenai-47ef7e0aaa2f2052404041650c9b4d7d8c9c51c45ef2cb081548f329c3f81a6a.yml
3+
openapi_spec_hash: 0207b30cf74121a12c1647e25463cee9
44
config_hash: 8dca0f2dc2706c07cf2f8d0ed4dc062e

src/openai/resources/batches.py

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ def create(
4747
*,
4848
completion_window: Literal["24h"],
4949
endpoint: Literal[
50-
"/v1/responses", "/v1/chat/completions", "/v1/embeddings", "/v1/completions", "/v1/moderations"
50+
"/v1/responses",
51+
"/v1/chat/completions",
52+
"/v1/embeddings",
53+
"/v1/completions",
54+
"/v1/moderations",
55+
"/v1/images/generations",
56+
"/v1/images/edits",
5157
],
5258
input_file_id: str,
5359
metadata: Optional[Metadata] | Omit = omit,
@@ -68,9 +74,9 @@ def create(
6874
6975
endpoint: The endpoint to be used for all requests in the batch. Currently
7076
`/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`,
71-
and `/v1/moderations` are supported. Note that `/v1/embeddings` batches are also
72-
restricted to a maximum of 50,000 embedding inputs across all requests in the
73-
batch.
77+
`/v1/moderations`, `/v1/images/generations`, and `/v1/images/edits` are
78+
supported. Note that `/v1/embeddings` batches are also restricted to a maximum
79+
of 50,000 embedding inputs across all requests in the batch.
7480
7581
input_file_id: The ID of an uploaded file that contains requests for the new batch.
7682
@@ -265,7 +271,13 @@ async def create(
265271
*,
266272
completion_window: Literal["24h"],
267273
endpoint: Literal[
268-
"/v1/responses", "/v1/chat/completions", "/v1/embeddings", "/v1/completions", "/v1/moderations"
274+
"/v1/responses",
275+
"/v1/chat/completions",
276+
"/v1/embeddings",
277+
"/v1/completions",
278+
"/v1/moderations",
279+
"/v1/images/generations",
280+
"/v1/images/edits",
269281
],
270282
input_file_id: str,
271283
metadata: Optional[Metadata] | Omit = omit,
@@ -286,9 +298,9 @@ async def create(
286298
287299
endpoint: The endpoint to be used for all requests in the batch. Currently
288300
`/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`, `/v1/completions`,
289-
and `/v1/moderations` are supported. Note that `/v1/embeddings` batches are also
290-
restricted to a maximum of 50,000 embedding inputs across all requests in the
291-
batch.
301+
`/v1/moderations`, `/v1/images/generations`, and `/v1/images/edits` are
302+
supported. Note that `/v1/embeddings` batches are also restricted to a maximum
303+
of 50,000 embedding inputs across all requests in the batch.
292304
293305
input_file_id: The ID of an uploaded file that contains requests for the new batch.
294306

src/openai/types/batch_create_params.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,23 @@ class BatchCreateParams(TypedDict, total=False):
1818
"""
1919

2020
endpoint: Required[
21-
Literal["/v1/responses", "/v1/chat/completions", "/v1/embeddings", "/v1/completions", "/v1/moderations"]
21+
Literal[
22+
"/v1/responses",
23+
"/v1/chat/completions",
24+
"/v1/embeddings",
25+
"/v1/completions",
26+
"/v1/moderations",
27+
"/v1/images/generations",
28+
"/v1/images/edits",
29+
]
2230
]
2331
"""The endpoint to be used for all requests in the batch.
2432
2533
Currently `/v1/responses`, `/v1/chat/completions`, `/v1/embeddings`,
26-
`/v1/completions`, and `/v1/moderations` are supported. Note that
27-
`/v1/embeddings` batches are also restricted to a maximum of 50,000 embedding
28-
inputs across all requests in the batch.
34+
`/v1/completions`, `/v1/moderations`, `/v1/images/generations`, and
35+
`/v1/images/edits` are supported. Note that `/v1/embeddings` batches are also
36+
restricted to a maximum of 50,000 embedding inputs across all requests in the
37+
batch.
2938
"""
3039

3140
input_file_id: Required[str]

0 commit comments

Comments
 (0)