openai-python icon indicating copy to clipboard operation
openai-python copied to clipboard

types: Missing type for batch request input and output objects

Open alugowski opened this issue 1 year ago • 0 comments

Confirm this is a feature request for the Python library and not the underlying OpenAI API.

  • [X] This is a feature request for the Python library

Describe the feature or improvement you're requesting

Batch input files are a list of up to 50,000 request input objects, where each one looks like this:

{"custom_id": "request-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "gpt-4o-mini", "messages": [{"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "What is 2+2?"}]}}

https://platform.openai.com/docs/api-reference/batch/request-input

I don't see this anywhere in openai.types. It should be there to make it easier to use batches.

Same for the output object, https://platform.openai.com/docs/api-reference/batch/request-output

Additional context

AFAIK the body element's type is Union[EmbeddingCreateParams, CompletionCreateParams]

alugowski avatar Dec 11 '24 00:12 alugowski