OpenAI kütüphanesi çalışmıyor

333825

Kilopat
Zamanın Tanığı
Katılım
12 Mayıs 2020
Mesajlar
1.187
Çözümler
7
Kod:
import openai.

openai.api_key= "Yeni aldığım key burada"

def chat_With_gpt(prompt):
 response = openai.ChatCompletion.create(
 model="gpt-3.5-turbo",
 messages=[{"role": "user", "content": prompt}]
 )

 return response.choices[0].message.content.strip()

if __name__ == "__main__":
 while True:
 user_input = input("You: ")
 if user_input.lower() in ["quit","exit","bye"]:
 break.

 response = chat_With_gpt(user_input)
 print("Chatbot: ",response)

Arkadaşlar burada kod çalışıyor yazı yazdığımda ise bu hatayı alıyorum nasıl düzeltebilirim?
You: Hello.
Traceback (most recent call last):
File "C:\yeni klasor\chatbot.py", line 20, in <module>
Response = chat_with_gpt(user_input)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\yeni klasor\chatbot.py", line 6, in chat_with_gpt.
Response = OpenAI. Chatcompletion. Create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\murat\anaconda3\Lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create.
Return super().create(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\murat\anaconda3\Lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 153, in create.
Resp, got_stream = self. _interpret_response(result, stream)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\murat\anaconda3\Lib\site-packages\openai\api_requestor.py", line 700, in _interpret_response.
Self. _interpret_response_line(
File "C:\Users\murat\anaconda3\Lib\site-packages\openai\api_requestor.py", line 765, in _interpret_response_line
Raise self. Handle_error_response(
OpenAI. Error. Ratelimiterror: You exceeded your current quota, please check your plan and billing details. For more information on this error, read the docs: https://platform.openai.com/docs/guides/error-codes/api-errors.
 
Hata mesajında o token üzerinden alabileceğiniz maximum cevap limitini doldurduğunuzu söylüyor. Bu token'ı ne zaman ürettiniz? Daha önce kullandınız mı?
Dün aldım ve hiç cevap üretmedim. Yalnızca koduma yapıştırdım ve ilk alıp yapıştırdığım günden beri aynı hatayı alıyorum.
 

Bu konuyu görüntüleyen kullanıcılar

Technopat Haberler

Yeni konular

Geri
Yukarı