I'm trying to generate academic papers using OpenAI's API in Google Colab. However, I'm encountering a RateLimitError that says "You exceeded your current quota, please check your plan and billing details." Here's the code I'm using:
!pip install openai
# Import the necessary libraries and set up the API key
import openai
openai.api_key = "your_openai_api_key"
# Define the prompts
prompts = [
"List"# List of prompts for generating academic papers
]
# Function to generate an academic paper
def generate_academic_paper(prompt):
model_engine = "text-davinci-003"
max_tokens = 2048
completion = openai.chat.completions.create(
model=model_engine,
messages=[{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": prompt}],
max_tokens=max_tokens,
temperature=0.8,
top_p=1,
frequency_penalty=0,
presence_penalty=0 )
return completion
import time
# Function to generate academic papers for given prompts
def generate_papers(prompts):
for prompt in prompts:
response = generate_academic_paper(prompt)
print(response)
print("loop")
time.sleep(2)
# Generate academic papers for the given prompts
generate_papers(prompts)
I've already checked my OpenAI account and I'm sure that I haven't exceeded the quotaas you can see at below:
I've also tried adding a delay between requests using time.sleep(2), but I'm still encountering the error. I've also attached a screenshot of my OpenAI account showing that I haven't exceeded the quota. Any suggestions on how to fix this issue?