We get back this 400 error when using the chat.completions.create() function in the OpenAI Python API:
{
'error': {
'message': 'We are currently processing your JSON schema to be used for structured outputs. Please try again in a few moments.',
'type': 'invalid_request_error',
'param': None,
'code': None
}
}
Does it make sense to return an error in this case? Also, this issue is not caused by the client and therefore the response status code should not be 400.
Hi OAI staff here. Thanks for the feedback. This error could happen if a user sends a large number of requests with the same schema and the schema happens to be very complex and takes a long time for us to build the artifact.
For most of the schemas, we were able to finish building the artifact in a few seconds and users won’t see this error message even if they send us a large amount of requests with that same schema. But if the artifact takes too long (>~1m) to build, we return this error. Once the artifact finishes building, all subsequent requests would be able to use the cached artifact and finish quickly.
You are correct that the underlying issue is technically not a client error but we’d like to indicate to the user that in such cases, they shouldn’t immediately retry the requests as it would most likely result in similar failures.
This response is very helpful. If we submit a complex schema across multiple batches, will the system retain it? So if I submit a complex schema, wait 5 minutes, and then send my real batch, will it work much better?