Skip to content

Commit 5117090

Browse files
authored
Merge pull request #53 from MetaGLM/feature/batch-expire-0904
Feature/batch expire 0904
2 parents bf1e444 + 4d93b98 commit 5117090

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

tests/integration_tests/test_batches.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ def test_batch_create(logging_conf) -> None:
3737
completion_window="24h",
3838
metadata={
3939
"description": "job test"
40-
}
40+
},
41+
auto_delete_input_file=True
4142
)
4243
print(create)
4344
# Batch(id='batch_1790292763050508288', completion_window='24h', created_at=1715674031399, endpoint='/v4/chat/completions', input_file_id='20240514_ea19d21b-d256-4586-b0df-e80a45e3c286', object='batch', status='validating', cancelled_at=None, cancelling_at=None, completed_at=None, error_file_id=None, errors=None, expired_at=None, expires_at=None, failed_at=None, finalizing_at=None, in_progress_at=None, metadata={'description': 'job test'}, output_file_id=None, request_counts=BatchRequestCounts(completed=None, failed=None, total=None))

zhipuai/api_resource/batches.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@ def __init__(self, client: "ZhipuAI") -> None:
2020
def create(
2121
self,
2222
*,
23-
completion_window: Literal["24h"],
23+
completion_window: str | None = None,
2424
endpoint: Literal["/v1/chat/completions", "/v1/embeddings"],
2525
input_file_id: str,
2626
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
27+
auto_delete_input_file: bool = True,
2728
extra_headers: Headers | None = None,
2829
extra_body: Body | None = None,
2930
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
@@ -36,6 +37,7 @@ def create(
3637
"endpoint": endpoint,
3738
"input_file_id": input_file_id,
3839
"metadata": metadata,
40+
"auto_delete_input_file":auto_delete_input_file
3941
},
4042
batch_create_params.BatchCreateParams,
4143
),

zhipuai/types/batch_create_params.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class BatchCreateParams(TypedDict, total=False):
10-
completion_window: Required[Literal["24h"]]
10+
completion_window: Required[str]
1111
"""The time frame within which the batch should be processed.
1212
1313
Currently only `24h` is supported.
@@ -32,3 +32,5 @@ class BatchCreateParams(TypedDict, total=False):
3232

3333
metadata: Optional[Dict[str, str]]
3434
"""Optional custom metadata for the batch."""
35+
36+
auto_delete_input_file: Optional[bool]

0 commit comments

Comments
 (0)