When i am trying to run this code it is throwing an error
import openai
Set up OpenAI API key
openai.api_key = ‘[api-key]LIrqIpOx’
def generate_story(prompt):
try:
# Generate the story using ChatGPT
response = openai.Completion.create(
engine=“text-embedding-3-small”,
prompt=prompt,
max_tokens=150
)
return response.choices[0].text.strip()
except Exception as e:
print(“Error:”, e)
return None
def main():
# Prompt for the story
prompt = “Once upon a time, in a faraway land, there was a brave knight named Sir Lancelot.”
# Generate the story
story = generate_story(prompt)
# Print the generated story
print("Generated Story:")
print(story)
if name == “main”:
main()
and the result is
PS C:\Mygenai> py llm3.py
Error: You are not allowed to sample from this model
Generated Story:
None
How i can solve this
