Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/batch expire 0904 #53

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/integration_tests/test_batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ def test_batch_create(logging_conf) -> None:
completion_window="24h",
metadata={
"description": "job test"
}
},
auto_delete_input_file=True
)
print(create)
# 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))
Expand Down
4 changes: 3 additions & 1 deletion zhipuai/api_resource/batches.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ def __init__(self, client: "ZhipuAI") -> None:
def create(
self,
*,
completion_window: Literal["24h"],
completion_window: str | None = None,
endpoint: Literal["/v1/chat/completions", "/v1/embeddings"],
input_file_id: str,
metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN,
auto_delete_input_file: bool = True,
extra_headers: Headers | None = None,
extra_body: Body | None = None,
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
Expand All @@ -36,6 +37,7 @@ def create(
"endpoint": endpoint,
"input_file_id": input_file_id,
"metadata": metadata,
"auto_delete_input_file":auto_delete_input_file
},
batch_create_params.BatchCreateParams,
),
Expand Down
4 changes: 3 additions & 1 deletion zhipuai/types/batch_create_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


class BatchCreateParams(TypedDict, total=False):
completion_window: Required[Literal["24h"]]
completion_window: Required[str]
"""The time frame within which the batch should be processed.

Currently only `24h` is supported.
Expand All @@ -32,3 +32,5 @@ class BatchCreateParams(TypedDict, total=False):

metadata: Optional[Dict[str, str]]
"""Optional custom metadata for the batch."""

auto_delete_input_file: Optional[bool]