I saw the example from openAI’s docs, when I setting down everything,
from openai import OpenAI, APIError, APITimeoutError
client = OpenAI()
try:
completion = client.chat.completions.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},
{"role": "user", "content": "Compose a poem that explains the concept of recursion in programming."}
],
timeout=60
)
print(completion['choices'][0]['message']['content'])
except APITimeoutError as err:
print(f"API Timeout Error: {err}")
except APIError as err:
print(f"API Error: {err}")
except Exception as err:
print(f"An unexpected error occurred: {err}")
its’s callback me those codes :
API Timeout Error: Request timed out.
I wanna know how to debug my program and why?