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

Missing response struct types for batch requests #951

Open
pjuhasz opened this issue Mar 9, 2025 · 0 comments
Open

Missing response struct types for batch requests #951

pjuhasz opened this issue Mar 9, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@pjuhasz
Copy link
Contributor

pjuhasz commented Mar 9, 2025

The support for batch requests is incomplete. Specifically, the OpenAI API reference specifies that the output files containing the results of the batched operations contain request output objects in the format described here: https://platform.openai.com/docs/api-reference/batch/request-output

However, the struct types corresponding to these objects are missing from this library.

Draft solution

type BatchRequestOutputError struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

type BatchRequestChatCompletionResponse struct {
	StatusCode int                     `json:"status_code"`
	RequestId  string                  `json:"request_id"`
	Body       ChatCompletionResponse  `json:"body"`
}

type BatchRequestChatCompletionOutput {
	Id       string                               `json:"id"`
	CustomId string                               `json:"custom_id"`
	Response *BatchRequestChatCompletionResponse  `json:"response"`
	Error    *BatchRequestOutputError             `json:"error"` 
}

and similarly for any other supported batch request types.

Alternatively, these wrapper types could be implemented with generics (they were invented for this, after all), but AFAIK generics are not used elsewhere in the project, so you may not want to introduce them for such a trivial addition.

@pjuhasz pjuhasz added the enhancement New feature or request label Mar 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant