The error message returns from embedding.create does not point to the exact element in the input array that us not valid. This is really annoying when you pass large array and need to debug what element is not valid.
My suggestion here is to point to the specific element in the input array that is not valid instead of returning the whole array.
Running this code in python:
from openai.utils import get_embeddings
will return the following error message
ERROR: openai.error.InvalidRequestError: ['', 'a'] is not valid under any of the given schemas - 'input'
A better error message in this case will be
`ERROR: openai.error.InvalidRequestError: [''] is not valid under any of the given schemas - 'input'`
Yes, the API is officially a beta and your feedback is very important. Thank you @roy-pstr
Regarding your embedding prompt, I tried two versions and both worked for me. Here is an incomplete snapshot (not showing the entire 1024 long vector, in the interest of saving space, haha ):
from openai.embeddings_utils import get_embeddings
raise the following error:
openai.error.InvalidRequestError: ['', 'a'] is not valid under any of the given schemas - 'input'
It worths mention that the default engine is used here: “text-similarity-davinci-001”
And make sure the input you are using is list of prompts. not a single prompt which is a string of list.
Anyway. I’m 100% sure that this raising an error, and my suggestion is to point to the element in the array that cause the error.
I had the same error and couldn’t figure out what’s wrong as I have big volume of data. Strangely, when I worked without batching (passing only a list of length 1 each time) it worked