为什么文档中异常处理要调用OpenAI?
hanlintao opened this issue · 2 comments
hanlintao commented
import openai
from openai import OpenAI
client = OpenAI()
try:
client.fine_tunes.create(
training_file="file-XGinujblHPwGLSztz8cPS8XY",
)
except openai.APIConnectionError as e:
print("The server could not be reached")
print(e.cause) # an underlying Exception, likely raised within httpx.
except openai.RateLimitError as e:
print("A 429 status code was received; we should back off a bit.")
except openai.APIStatusError as e:
print("Another non-200-range status code was received")
print(e.status_code)
print(e.response)
zRzRzRzRzRzRzR commented
什么?
glide-the commented
readme中存在的openai的调用示例,是由于开发人员的疏忽