main
 1# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
 2
 3from __future__ import annotations
 4
 5from typing import Optional
 6from typing_extensions import Literal, Required, TypedDict
 7
 8from .shared_params.metadata import Metadata
 9
10__all__ = ["BatchCreateParams", "OutputExpiresAfter"]
11
12
13class BatchCreateParams(TypedDict, total=False):
14    completion_window: Required[Literal["24h"]]
15    """The time frame within which the batch should be processed.
16
17    Currently only `24h` is supported.
18    """
19
20    endpoint: Required[
21        Literal["/v1/responses", "/v1/chat/completions", "/v1/embeddings", "/v1/completions", "/v1/moderations"]
22    ]
23    """The endpoint to be used for all requests in the batch.
24
25    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.
29    """
30
31    input_file_id: Required[str]
32    """The ID of an uploaded file that contains requests for the new batch.
33
34    See [upload file](https://platform.openai.com/docs/api-reference/files/create)
35    for how to upload a file.
36
37    Your input file must be formatted as a
38    [JSONL file](https://platform.openai.com/docs/api-reference/batch/request-input),
39    and must be uploaded with the purpose `batch`. The file can contain up to 50,000
40    requests, and can be up to 200 MB in size.
41    """
42
43    metadata: Optional[Metadata]
44    """Set of 16 key-value pairs that can be attached to an object.
45
46    This can be useful for storing additional information about the object in a
47    structured format, and querying for objects via API or the dashboard.
48
49    Keys are strings with a maximum length of 64 characters. Values are strings with
50    a maximum length of 512 characters.
51    """
52
53    output_expires_after: OutputExpiresAfter
54    """
55    The expiration policy for the output and/or error file that are generated for a
56    batch.
57    """
58
59
60class OutputExpiresAfter(TypedDict, total=False):
61    anchor: Required[Literal["created_at"]]
62    """Anchor timestamp after which the expiration policy applies.
63
64    Supported anchors: `created_at`. Note that the anchor is the file creation time,
65    not the time the batch is created.
66    """
67
68    seconds: Required[int]
69    """The number of seconds after the anchor time that the file will expire.
70
71    Must be between 3600 (1 hour) and 2592000 (30 days).
72    """