Bug#1064469: debgpt: does not handle errors
Package: debgpt
Version: 0.4.94
Severity: minor
debgpt does not handle errors:
qaa:~> debgpt -Q -A "who are you?"
[19:06:24] OpenAIFrontend> Starting conversation frontend.py:66
[...]
LLM[2]> Traceback (most recent call last):
File "/bin/debgpt", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/lib/python3/dist-packages/debgpt/cli.py", line 455, in main
frontend.query_once(f, msg)
File "/usr/lib/python3/dist-packages/debgpt/frontend.py", line 218, in query_once
reply = f(text)
^^^^^^^
File "/usr/lib/python3/dist-packages/debgpt/frontend.py", line 96, in __call__
return self.query(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/debgpt/frontend.py", line 131, in query
completion = self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/openai/_utils/_utils.py", line 275, in wrapper
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/openai/resources/chat/completions.py", line 663, in create
return self._post(
^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/openai/_base_client.py", line 1200, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/openai/_base_client.py", line 889, in request
return self._request(
^^^^^^^^^^^^^^
File "/usr/lib/python3/dist-packages/openai/_base_client.py", line 980, in _request
raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: empty. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}
I would expect just a clear error message.
-- System Information:
Debian Release: trixie/sid
APT prefers unstable-debug
APT policy: (500, 'unstable-debug'), (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable-debug'), (500, 'proposed-updates-debug'), (500, 'unstable'), (500, 'testing'), (500, 'stable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 6.6.15-amd64 (SMP w/16 CPU threads; PREEMPT)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages debgpt depends on:
ii python3 3.11.6-1
ii python3-bs4 4.12.3-1
ii python3-openai 1.12.0-1
ii python3-prompt-toolkit 3.0.43-1
ii python3-requests 2.31.0+dfsg-1
ii python3-rich 13.3.1-2
ii python3-tomli 2.0.1-2
Versions of packages debgpt recommends:
ii git 1:2.43.0-1
ii man-db 2.12.0-3
ii python3-zmq 24.0.1-5+b1
ii tldr 0.9.2-5
Versions of packages debgpt suggests:
pn python3-torch | python3-torch-cuda | python3-torch-rocm <none>
pn python3-transformers <none>
-- no debconf information
--
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
Reply to: