I’m having trouble with the chat I created using PyCharm Editor - I’m not receiving any replies. Can anyone help me troubleshoot this issue? Here’s the code I’m using:
python
import openai
import os
openai.api_key = os.getenv("OPENAI_API_KEY")
openai.organization = "org-xxxxxxxxxxxxxxx"
# Start chat loop
while True:
# Get user input
user_input = input("You: ")
# Build the prompt and response for the chatbot
prompt = f"You: {user_input}\nJavaScript chatbot:"
# Use the OpenAI API to generate a response for the chatbot
response = openai.Completion.create(
model="text-davinci-003",
prompt=prompt,
temperature=0.5,
max_tokens=1024,
top_p=1,
frequency_penalty=0,
presence_penalty=0,
stop=["You:"]
)
# Print the chatbot's response
print("JavaScript chatbot:", response.choices[0].text.strip())
I’m receiving the following error message:
Traceback (most recent call last):
File "E:\untitled\lib\site-packages\urllib3\connectionpool.py", line 700, in urlopen
self._prepare_proxy(conn)
File "E:\untitled\lib\site-packages\urllib3\connectionpool.py", line 996, in _prepare_proxy
conn.connect()
File "E:\untitled\lib\site-packages\urllib3\connection.py", line 364, in connect
self.sock = conn = self._connect_tls_proxy(hostname, conn)
File "E:\untitled\lib\site-packages\urllib3\connection.py", line 499, in _connect_tls_proxy
socket = ssl_wrap_socket(
File "E:\untitled\lib\site-packages\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
File "E:\untitled\lib\site-packages\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 500, in wrap_socket
return self.sslsocket_class._create(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1040, in _create
self.do_handshake()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 1309, in do_handshake
self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "E:\untitled\lib\site-packages\requests\adapters.py", line 489, in send
resp = conn.urlopen(
File "E:\untitled\lib\site-packages\urllib3\connectionpool.py", line 815, in urlopen
return self.urlopen(
File "E:\untitled\lib\site-packages\urllib3\connectionpool.py", line 815,