Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Application crashes - KeyError: 'choices' #14

Open
popey opened this issue Mar 26, 2024 · 1 comment
Open

Application crashes - KeyError: 'choices' #14

popey opened this issue Mar 26, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@popey
Copy link

popey commented Mar 26, 2024

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

image

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).

@rajtilakjee rajtilakjee self-assigned this Mar 27, 2024
@rajtilakjee rajtilakjee added the bug Something isn't working label Mar 27, 2024
@rajtilakjee
Copy link
Owner

@popey Have updated the README.md and made the necessary changes. Could you please check once again. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants