I'm on a Windows x64 machine (Version 22H2, OS build 19045.3693).
I'm able to make it work on WSL, but not on PowerShell.
API key stored both into ~/.config/openai.token & env variable OPENAI_API_KEY for both these environments.
(The API key is correct, and starts with sk as can be seen below. I believe the issue lies in the string that's sent as a request)
Please tell me how to resolve this.
ERROR LOG
Error detected while processing function vim_ai#AIRun:
line 19:
Traceback (most recent call last):
File "", line 1, in <module>
File "C:\Users\me\vimfiles\plugged\vim-ai/py/complete.py", line 57, in <module>
handle_completion_error(error)
File "C:\Users\me\vimfiles\plugged\vim-ai/py/utils.py", line 195, in handle_completion_error
raise error
File "C:\Users\me\vimfiles\plugged\vim-ai/py/complete.py", line 54, in <module>
render_text_chunks(text_chunks)
File "C:\Users\me\vimfiles\plugged\vim-ai/py/utils.py", line 68, in render_text_chunks
for text in chunks:
File "C:\Users\me\vimfiles\plugged\vim-ai/py/utils.py", line 157, in openai_request
with urllib.request.urlopen(req, timeout=request_timeout) as response:
File "C:\Users\me\AppData\Local\Programs\Python\Python310\Lib\urllib\request.py", line 216, in urlopen
return opener.open(url, data, timeout)
File "C:\Users\me\AppData\Local\Programs\Python\Python310\Lib\urllib\request.py", line 519, in open
response = self._open(req, data)
File "C:\Users\me\AppData\Local\Programs\Python\Python310\Lib\urllib\request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "C:\Users\me\AppData\Local\Programs\Python\Python310\Lib\urllib\request.py", line 496, in _call_chain
result = func(*args)
File "C:\Users\me\AppData\Local\Programs\Python\Python310\Lib\urllib\request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "C:\Users\me\AppData\Local\Programs\Python\Python310\Lib\urllib\request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers,
File "C:\Users\me\AppData\Local\Programs\Python\Python310\Lib\http\client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked)
File "C:\Users\me\AppData\Local\Programs\Python\Python310\Lib\http\client.py", line 1323, in _send_request
self.putheader(hdr, value)
File "C:\Users\me\AppData\Local\Programs\Python\Python310\Lib\http\client.py", line 1260, in putheader
raise ValueError('Invalid header value %r' % (values[i],))
ValueError: Invalid header value b'Bearer \xff\xfes\x00k\x00-\x00m\x006 ...'
I'm on a Windows x64 machine (Version 22H2, OS build 19045.3693). I'm able to make it work on WSL, but not on PowerShell. API key stored both into
~/.config/openai.token
& env variableOPENAI_API_KEY
for both these environments. (The API key is correct, and starts withsk
as can be seen below. I believe the issue lies in the string that's sent as a request) Please tell me how to resolve this.ERROR LOG
SPECIFICATIONS