How to solve the RetryError while trying to create embeddings for a dataset

df is a Restaurant reviews dataset with text column

def get_embedding(text: str, model=“text-embedding-ada-002”) → list[float]:
return openai.Embedding.create(input=[text], model=model)[“data”][0][“embedding”]
df[‘ada_embedding’] = df.text.apply(lambda x: get_embedding(x, model=‘text-embedding-ada-002’))

I am getting an error-RetryError: RetryError[<Future at 0x7fb92f4af550 state=finished raised RateLimitError>] and not able to get a separate column for embeddings.How to resolve this error?

Welcome to the forum. Seems you might be running into a Rate Limit problem?

You can find more here…

1 Like

I’m having this same issue. I’m getting an error like this

RetryError: RetryError[<Future at 0x21b768841f0 state=finished raised AttributeError>]

All I’m trying to do is get an embedding for one string:

get_embedding(['1194 Race Cars'], model='text-embedding-ada-002')

I have used only a total of 2 requests with a total of 66,488 tokens. It’s been over 30 minutes since I had a successful request. I’ve tried getting a new API key, which didn’t fix it. How do I get past this?

Never mind. It fixed itself when I reran my code from the top. :person_shrugging:

1 Like