Getting retry error while running Openai embedding engine

672 views Asked by At

So, I'm running code for text embedder, using Openai Ada-002 model. Code looks something like that:

import pandas as pd
from openai.embeddings_utils import get_embedding, cosine_similarity
import openai
import os

openai.api_key = os.environ.get('API_KEY')
embedding_model = "text-embedding-ada-002"

csvfiles = os.listdir(csvpath)
for filename in csvfiles:
    if filename.endswith('.csv'):
        embfilename = embedpath + '\\' + filename
        df = pd.read_csv(csvpath + '\\' + filename)
        df['embeddings'] = df['names'].apply(lambda x: get_embedding(x, embedding_model))
        newfilename = embedpath + '\\' + 'embs_' + filename
        df.to_csv(newfilename)

I'm getting this error:

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

I tried changing API Key as someone was suggesting on GitHub but it didn't work.

Any ideas how I can debug this?

0

There are 0 answers