keepyourmouthshut
keepyourmouthshut copied to clipboard
Application crashes - KeyError: 'choices'
Describe the bug
Crash on clicking "Generate"
(keepyourmouthshut) alan@ziggy:~/Source/rajtilakjee/keepyourmouthshut$ python app/keepyourmouthshut.py
* Serving Flask app 'keepyourmouthshut'
* Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:64215
* Running on http://10.0.25.12:64215
Press CTRL+C to quit
* Restarting with stat
* Debugger is active!
* Debugger PIN: 103-517-491
127.0.0.1 - - [26/Mar/2024 18:45:20] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [26/Mar/2024 18:45:20] "GET /static/kyms-logo.png HTTP/1.1" 200 -
127.0.0.1 - - [26/Mar/2024 18:45:21] "GET /static/kyms-logo.png HTTP/1.1" 304 -
127.0.0.1 - - [26/Mar/2024 18:46:17] "POST /generate HTTP/1.1" 500 -
Traceback (most recent call last):
File "/home/alan/Source/rajtilakjee/keepyourmouthshut/lib/python3.11/site-packages/flask/app.py", line 1478, in __call__
return self.wsgi_app(environ, start_response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alan/Source/rajtilakjee/keepyourmouthshut/lib/python3.11/site-packages/flask/app.py", line 1458, in wsgi_app
response = self.handle_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alan/Source/rajtilakjee/keepyourmouthshut/lib/python3.11/site-packages/flask/app.py", line 1455, in wsgi_app
response = self.full_dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alan/Source/rajtilakjee/keepyourmouthshut/lib/python3.11/site-packages/flask/app.py", line 869, in full_dispatch_request
rv = self.handle_user_exception(e)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alan/Source/rajtilakjee/keepyourmouthshut/lib/python3.11/site-packages/flask/app.py", line 867, in full_dispatch_request
rv = self.dispatch_request()
^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alan/Source/rajtilakjee/keepyourmouthshut/lib/python3.11/site-packages/flask/app.py", line 852, in dispatch_request
return self.ensure_sync(self.view_functions[rule.endpoint])(**view_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alan/Source/rajtilakjee/keepyourmouthshut/app/keepyourmouthshut.py", line 49, in generate
mp3_file, txt_file = generate_podcast(name, desc, topics, adverts)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alan/Source/rajtilakjee/keepyourmouthshut/app/generate_podcast.py", line 50, in generate_podcast
script_segment = llmOS_stuff.generate_response(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alan/Source/rajtilakjee/keepyourmouthshut/app/utils/llmOS_stuff.py", line 49, in generate_response
result = answer["choices"][0]["message"]["content"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'choices'
To Reproduce Steps to reproduce the behavior:
- Launched in a venv
- visited the page
- filled in the fields
- and hit "generate". It crashed.
Crash pasted above
Expected behavior
A viral podcast episode to be generated! :D
Screenshots
Desktop (please complete the following information):
- OS: Ubuntu 23.10
- Browser Microsoft Edge
- Version Version 122.0.2365.92 (Official build) (64-bit)
Additional context
I cloned the repo, and did the pip install of requirements (which is incorrect in the readme, by the way, as requirements is in the app folder, not the root).