Skip to content

Commit db069cd

Browse files
committed
1 parent f5247e3 commit db069cd

13 files changed

+828
-1
lines changed

.stats.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
configured_endpoints: 52
1+
configured_endpoints: 55

api.md

+14
Original file line numberDiff line numberDiff line change
@@ -361,3 +361,17 @@ Methods:
361361

362362
- <code title="get /threads/{thread_id}/messages/{message_id}/files/{file_id}">client.beta.threads.messages.files.<a href="./src/openai/resources/beta/threads/messages/files.py">retrieve</a>(file_id, \*, thread_id, message_id) -> <a href="./src/openai/types/beta/threads/messages/message_file.py">MessageFile</a></code>
363363
- <code title="get /threads/{thread_id}/messages/{message_id}/files">client.beta.threads.messages.files.<a href="./src/openai/resources/beta/threads/messages/files.py">list</a>(message_id, \*, thread_id, \*\*<a href="src/openai/types/beta/threads/messages/file_list_params.py">params</a>) -> <a href="./src/openai/types/beta/threads/messages/message_file.py">SyncCursorPage[MessageFile]</a></code>
364+
365+
# Batches
366+
367+
Types:
368+
369+
```python
370+
from openai.types import Batch, BatchError, BatchRequestCounts
371+
```
372+
373+
Methods:
374+
375+
- <code title="post /batches">client.batches.<a href="./src/openai/resources/batches.py">create</a>(\*\*<a href="src/openai/types/batch_create_params.py">params</a>) -> <a href="./src/openai/types/batch.py">Batch</a></code>
376+
- <code title="get /batches/{batch_id}">client.batches.<a href="./src/openai/resources/batches.py">retrieve</a>(batch_id) -> <a href="./src/openai/types/batch.py">Batch</a></code>
377+
- <code title="post /batches/{batch_id}/cancel">client.batches.<a href="./src/openai/resources/batches.py">cancel</a>(batch_id) -> <a href="./src/openai/types/batch.py">Batch</a></code>

src/openai/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,7 @@ def _reset_client() -> None: # type: ignore[reportUnusedFunction]
335335
files as files,
336336
images as images,
337337
models as models,
338+
batches as batches,
338339
embeddings as embeddings,
339340
completions as completions,
340341
fine_tuning as fine_tuning,

src/openai/_client.py

+8
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ class OpenAI(SyncAPIClient):
5757
models: resources.Models
5858
fine_tuning: resources.FineTuning
5959
beta: resources.Beta
60+
batches: resources.Batches
6061
with_raw_response: OpenAIWithRawResponse
6162
with_streaming_response: OpenAIWithStreamedResponse
6263

@@ -134,6 +135,7 @@ def __init__(
134135
self.models = resources.Models(self)
135136
self.fine_tuning = resources.FineTuning(self)
136137
self.beta = resources.Beta(self)
138+
self.batches = resources.Batches(self)
137139
self.with_raw_response = OpenAIWithRawResponse(self)
138140
self.with_streaming_response = OpenAIWithStreamedResponse(self)
139141

@@ -257,6 +259,7 @@ class AsyncOpenAI(AsyncAPIClient):
257259
models: resources.AsyncModels
258260
fine_tuning: resources.AsyncFineTuning
259261
beta: resources.AsyncBeta
262+
batches: resources.AsyncBatches
260263
with_raw_response: AsyncOpenAIWithRawResponse
261264
with_streaming_response: AsyncOpenAIWithStreamedResponse
262265

@@ -334,6 +337,7 @@ def __init__(
334337
self.models = resources.AsyncModels(self)
335338
self.fine_tuning = resources.AsyncFineTuning(self)
336339
self.beta = resources.AsyncBeta(self)
340+
self.batches = resources.AsyncBatches(self)
337341
self.with_raw_response = AsyncOpenAIWithRawResponse(self)
338342
self.with_streaming_response = AsyncOpenAIWithStreamedResponse(self)
339343

@@ -458,6 +462,7 @@ def __init__(self, client: OpenAI) -> None:
458462
self.models = resources.ModelsWithRawResponse(client.models)
459463
self.fine_tuning = resources.FineTuningWithRawResponse(client.fine_tuning)
460464
self.beta = resources.BetaWithRawResponse(client.beta)
465+
self.batches = resources.BatchesWithRawResponse(client.batches)
461466

462467

463468
class AsyncOpenAIWithRawResponse:
@@ -472,6 +477,7 @@ def __init__(self, client: AsyncOpenAI) -> None:
472477
self.models = resources.AsyncModelsWithRawResponse(client.models)
473478
self.fine_tuning = resources.AsyncFineTuningWithRawResponse(client.fine_tuning)
474479
self.beta = resources.AsyncBetaWithRawResponse(client.beta)
480+
self.batches = resources.AsyncBatchesWithRawResponse(client.batches)
475481

476482

477483
class OpenAIWithStreamedResponse:
@@ -486,6 +492,7 @@ def __init__(self, client: OpenAI) -> None:
486492
self.models = resources.ModelsWithStreamingResponse(client.models)
487493
self.fine_tuning = resources.FineTuningWithStreamingResponse(client.fine_tuning)
488494
self.beta = resources.BetaWithStreamingResponse(client.beta)
495+
self.batches = resources.BatchesWithStreamingResponse(client.batches)
489496

490497

491498
class AsyncOpenAIWithStreamedResponse:
@@ -500,6 +507,7 @@ def __init__(self, client: AsyncOpenAI) -> None:
500507
self.models = resources.AsyncModelsWithStreamingResponse(client.models)
501508
self.fine_tuning = resources.AsyncFineTuningWithStreamingResponse(client.fine_tuning)
502509
self.beta = resources.AsyncBetaWithStreamingResponse(client.beta)
510+
self.batches = resources.AsyncBatchesWithStreamingResponse(client.batches)
503511

504512

505513
Client = OpenAI

src/openai/_module_client.py

+7
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@ def __load__(self) -> resources.Models:
4242
return _load_client().models
4343

4444

45+
class BatchesProxy(LazyProxy[resources.Batches]):
46+
@override
47+
def __load__(self) -> resources.Batches:
48+
return _load_client().batches
49+
50+
4551
class EmbeddingsProxy(LazyProxy[resources.Embeddings]):
4652
@override
4753
def __load__(self) -> resources.Embeddings:
@@ -72,6 +78,7 @@ def __load__(self) -> resources.FineTuning:
7278
audio: resources.Audio = AudioProxy().__as_proxied__()
7379
images: resources.Images = ImagesProxy().__as_proxied__()
7480
models: resources.Models = ModelsProxy().__as_proxied__()
81+
batches: resources.Batches = BatchesProxy().__as_proxied__()
7582
embeddings: resources.Embeddings = EmbeddingsProxy().__as_proxied__()
7683
completions: resources.Completions = CompletionsProxy().__as_proxied__()
7784
moderations: resources.Moderations = ModerationsProxy().__as_proxied__()

src/openai/resources/__init__.py

+14
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,14 @@
4848
ModelsWithStreamingResponse,
4949
AsyncModelsWithStreamingResponse,
5050
)
51+
from .batches import (
52+
Batches,
53+
AsyncBatches,
54+
BatchesWithRawResponse,
55+
AsyncBatchesWithRawResponse,
56+
BatchesWithStreamingResponse,
57+
AsyncBatchesWithStreamingResponse,
58+
)
5159
from .embeddings import (
5260
Embeddings,
5361
AsyncEmbeddings,
@@ -142,4 +150,10 @@
142150
"AsyncBetaWithRawResponse",
143151
"BetaWithStreamingResponse",
144152
"AsyncBetaWithStreamingResponse",
153+
"Batches",
154+
"AsyncBatches",
155+
"BatchesWithRawResponse",
156+
"AsyncBatchesWithRawResponse",
157+
"BatchesWithStreamingResponse",
158+
"AsyncBatchesWithStreamingResponse",
145159
]

0 commit comments

Comments
 (0)