I am using the OpenAI API to generate query embeddings for my project. Everything was working fine until yesterday. Today, I’m encountering the following error:
An unexpected error occurred: Error code: 400 - {‘error’: {‘message’: ‘This model does not support specifying dimensions.’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: None}} API
The code is as simple as this:
def generate_embeddings(input: List[str]) -> List[List[float]]:
response = client.embeddings.create(input=input, model="text-embedding-3-large", dimensions=256)
embeddings = [i.embedding for i in response.data]
return embeddings
What’s puzzling is that this error happens intermittently—around 1 in 10 times. The dimensions parameter is critical for us since our entire vector database is based on 256 dimensions.
I’ve already updated the OpenAI Python library to the latest version, but the issue persists. Does anyone have any ideas or insights on what might be causing this?
I have updated openai python library to latest version and the problem persists. Any ideas on this? I am hoping that it is a false alarm.
I am getting the same error, intermittently. This happens in production environment with no change to our backend. It seems that embeddings API just started throwing these errors.
This is most likely a transient error that will resolve itself.
As best practice for all API communication, your code should gracefully handle all types of return error codes, and where appropriate perform exponential back off and retries.
If this issue persists for more than a day or two, please comment back here and I will let OpenAI know there is an issue.
Thanks for the reply. Hoping that it would resolve itself. We are handing the errors with retries as suggested in the documentation. So, it is not breaking things that much for us.
Hi, while the errors may be transient and we have the normal retries and backoff in place, the sudden increase for multiple customers surely warrants an incident on https://status.openai.com/ ?
Also in what world is a 400 bad request a transient error?
Now, with that said, openai often doesn’t follow restful practices, but even so this sudden increase in errors suggests a real problem with openai and not a transient error. It does not seem to be subsiding either.
EDIT:
I’ve reached the reply limit as I opened a forum account for this incident, however I have contacted OpenAI support directly who are now investigating.
All depends on the application, I usually have a retry max count of 10ish with an exponential backoff, i.e. it waits longer each time there is an error and after 10 attempts I log that as an actual error and put the request into a retry queue to try again as some point if relevant.
@Foxalabs → How/why would a 400 error be a transient error? and/or why would you recommend retrying 400 errors in general? If it’s a 400, the server considers the error a client error, i.e. retrying after a 400 should never work unless you were to change the payload.
Also getting the same error - This is happening ~80% of the time for us.
We are using in a production service. We don’t really have the ability to wait multiple days to see if it ‘resolves itself’.