Open AI Key issue while running the code

When i am running my Code it is showing the error like Open AI QUOTE limit has exceed, but i didn’t used the my API Key that many times still it is showing error,
import openai

Set up OpenAI API key

openai.api_key = ‘INSERT_API_KEY_HERE’

def few_shot_learning():
# Define examples for few-shot learning
examples = [
[“How to bake a cake”, “Follow these steps to bake a cake: 1. Preheat the oven…”],
[“How to fix a leaky faucet”, “To fix a leaky faucet, you’ll need a wrench and plumber’s tape…”],
[“How to tie a tie”, “There are several ways to tie a tie, but the most common method is the Windsor knot…”]
]

# Define prompt and query for few-shot learning
prompt = "Title: How-to Guides\n\n"

for example in examples:
    prompt += f"Input: {example[0]}\nOutput: {example[1]}\n"

# Query for few-shot learning
response = openai.Completion.create(
    engine="gpt-3.5-turbo",
    prompt=prompt,
    max_tokens=100
)

# Print few-shot learning results
print("Few-shot learning results:")
for choice in response.choices:
    print(choice.text.strip())
print()

def zero_shot_learning():
# Define prompt and query for zero-shot learning
prompt = “Generate a summary of the article ‘The Effects of Climate Change on Marine Ecosystems’.”

# Query for zero-shot learning
response = openai.Completion.create(
    engine="text-davinci-003",
    prompt=prompt,
    max_tokens=100
)

# Print zero-shot learning result
print("Zero-shot learning result:")
print(response.choices[0].text.strip())
print()

if name == “main”:
few_shot_learning()
zero_shot_learning()

Is there any solution for this issue it will help for me please.

1 Like

Have you checked your credit balance? That would be the first place I check. :slight_smile:

Good luck!