Dijital Ürün Alış ve Satışı için: Buraya Tıkla

Sesli dinle

Python kitaplığımızda döndürülen hatalar için hızlı bir kılavuz.

Bu makale, OpenAI Python Kitaplığı kullanılırken döndürülen hata türlerini özetlemektedir. Neden ve çözümün özetini okuyun veya daha fazlası için buraya tıklayın.

APIError

Cause Issue on our side.

Solution Retry your request after a brief wait and contact us if the issue persists.

Timeout

Cause Request timed out.

Solution Retry your request after a brief wait and contact us if the issue persists.

APIConnectionError

Cause Issue connecting to our services.

Solution Check your network settings, proxy configuration, SSL certificates, or firewall rules.

InvalidRequestError

Cause: Your request was malformed or missing some required parameters, such as a token or an input.

Solution: The error message should advise you on the specific error made. Check the documentation for the specific API method you are calling and make sure you are sending valid and complete parameters. You may also need to check the encoding, format, or size of your request data.

AuthenticationError

Cause Your API key or token was invalid, expired, or revoked.

Solution: Check your API key or token and make sure it is correct and active. You may need to generate a new one from your account dashboard.

PermissionError

 

Cause Your API key or token does not have the required scope or role to perform the requested action.

Solution Make sure your API key has the appropriate permissions for the action or model accessed.

RateLimitError

 

Cause You have hit your assigned rate limit.

Solution Pace your requests. 

ServiceUnavailableError

Cause Issue on our servers.

Solution Retry your request after a brief wait and contact us if the issue persists.

API tarafından döndürülen hataları programatik olarak işlemenizi tavsiye ederiz. Bunu yapmak için aşağıdaki gibi bir kod parçacığı kullanmak isteyebilirsiniz:

try:
  #Make your OpenAI API request here
  response = openai.Completion.create(model="text-davinci-003",
              prompt="Hello world")
except openai.error.Timeout as e:
  #Handle timeout error, e.g. retry or log
  print(f"OpenAI API request timed out: {e}")
  pass
except openai.error.APIError as e:
  #Handle API error, e.g. retry or log
  print(f"OpenAI API returned an API Error: {e}")
  pass
except openai.error.APIConnectionError as e:
  #Handle connection error, e.g. check network or log
  print(f"OpenAI API request failed to connect: {e}")
  pass
except openai.error.InvalidRequestError as e:
  #Handle invalid request error, e.g. validate parameters or log
  print(f"OpenAI API request was invalid: {e}")
  pass
except openai.error.AuthenticationError as e:
  #Handle authentication error, e.g. check credentials or log
  print(f"OpenAI API request was not authorized: {e}")
  pass
except openai.error.PermissionError as e:
  #Handle permission error, e.g. check scope or log
  print(f"OpenAI API request was not permitted: {e}")
  pass
except openai.error.RateLimitError as e:
  #Handle rate limit error, e.g. wait or log
  print(f"OpenAI API request exceeded rate limit: {e}")
  pass

 


Yorumlar (0)
henüz yorum yok
Tema Ayarları

Kendi özelleştirilmiş stilini belirle

Mod Seç

Uygulamanız için mükemmel renk modunu seçin.


RTL Mode

Dil yönünüzü değiştirin


Fluid Layout

Tam ekran modu aç/kapat


Navigasyon Konumu

Web sitesi için uygun bir menü sistemi seçin


Görünüm