Hi, I am having trouble in using open ai, to get summary of emails stored in a pandas dataframe. I used the following function #Standard function to get summaries, currently running into errors potentially due to api key
def generate_summary(email):
prompt = “Summarize the following email:\n\n” + email + “\n\nSummary:”
response = client.chat.completions.create(
model=“text-davinci-004”, # You can also use “text-davinci-004” for GPT-3.5-turbo
prompt=prompt,
max_tokens=150
)
return response.choices[0].text.strip()
I ended up with either Name errors or that the version is not available or the error APIRemovedInV1 . I am using gpt 3.5 turbo with api keys. can someone help me with a finction, that I can apply to a pandas column to get email summaries stored in the dataset?