Skip to content
Open
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
6 changes: 6 additions & 0 deletions src/openai/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
26 changes: 26 additions & 0 deletions src/openai/types/batch_request_input.py
Original file line number Diff line number Diff line change
@@ -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."""
36 changes: 36 additions & 0 deletions src/openai/types/batch_request_output.py
Original file line number Diff line number Diff line change
@@ -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