[Fix] Correct OpenAI batch response format (#5554)

This commit is contained in:
zifeitong
2024-06-15 16:57:54 -07:00
committed by GitHub
parent 1c0afa13c5
commit 3ce2c050dd
2 changed files with 25 additions and 5 deletions
+12 -1
View File
@@ -672,6 +672,17 @@ class BatchRequestInput(OpenAIBaseModel):
body: Union[ChatCompletionRequest, ]
class BatchResponseData(OpenAIBaseModel):
# HTTP status code of the response.
status_code: int = 200
# An unique identifier for the API request.
request_id: str
# The body of the response.
body: Union[ChatCompletionResponse, ]
class BatchRequestOutput(OpenAIBaseModel):
"""
The per-line object of the batch output and error files
@@ -683,7 +694,7 @@ class BatchRequestOutput(OpenAIBaseModel):
# inputs.
custom_id: str
response: Optional[ChatCompletionResponse]
response: Optional[BatchResponseData]
# For requests that failed with a non-HTTP error, this will contain more
# information on the cause of the failure.