diff --git a/src/openai/types/__init__.py b/src/openai/types/__init__.py index 9190bc146c..bb43041437 100644 --- a/src/openai/types/__init__.py +++ b/src/openai/types/__init__.py @@ -65,6 +65,12 @@ from .video_create_error import VideoCreateError as VideoCreateError from .video_remix_params import VideoRemixParams as VideoRemixParams from .batch_create_params import BatchCreateParams as BatchCreateParams +from .batch_request_input import BatchRequestInput as BatchRequestInput +from .batch_request_output import ( + BatchRequestOutput as BatchRequestOutput, + BatchRequestOutputError as BatchRequestOutputError, + BatchRequestOutputResponse as BatchRequestOutputResponse, +) from .skill_create_params import SkillCreateParams as SkillCreateParams from .skill_update_params import SkillUpdateParams as SkillUpdateParams from .video_create_params import VideoCreateParams as VideoCreateParams diff --git a/src/openai/types/batch_request_input.py b/src/openai/types/batch_request_input.py new file mode 100644 index 0000000000..7a137efff2 --- /dev/null +++ b/src/openai/types/batch_request_input.py @@ -0,0 +1,26 @@ +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["BatchRequestInput"] + + +class BatchRequestInput(TypedDict, total=False): + custom_id: Required[str] + """A developer-provided per-request id that will be used to match outputs to inputs. + + Must be unique for each request in a batch. + """ + + method: Required[Literal["POST"]] + """The HTTP method to be used for the request. Currently only `POST` is supported.""" + + url: Required[str] + """The OpenAI API relative URL to be used for the request. + + Currently `/v1/chat/completions`, `/v1/embeddings`, and `/v1/completions` are + supported. + """ + + body: Required[object] + """The body of the request.""" diff --git a/src/openai/types/batch_request_output.py b/src/openai/types/batch_request_output.py new file mode 100644 index 0000000000..27bcf0617e --- /dev/null +++ b/src/openai/types/batch_request_output.py @@ -0,0 +1,36 @@ +from typing import Optional + +from .._models import BaseModel + +__all__ = ["BatchRequestOutput", "BatchRequestOutputError", "BatchRequestOutputResponse"] + + +class BatchRequestOutputError(BaseModel): + code: Optional[str] = None + """A machine-readable error code.""" + + message: Optional[str] = None + """A human-readable error message.""" + + +class BatchRequestOutputResponse(BaseModel): + status_code: int + """The HTTP status code of the response.""" + + request_id: str + """An unique identifier for the request.""" + + body: Optional[object] = None + """The JSON body of the response.""" + + +class BatchRequestOutput(BaseModel): + id: str + """The ID of the batch request.""" + + custom_id: str + """A developer-provided per-request id that will be used to match outputs to inputs.""" + + response: Optional[BatchRequestOutputResponse] = None + + error: Optional[BatchRequestOutputError] = None