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

[Bug] Exception in Thread #642

Open
5 tasks
okilah opened this issue Aug 25, 2024 · 0 comments
Open
5 tasks

[Bug] Exception in Thread #642

okilah opened this issue Aug 25, 2024 · 0 comments

Comments

@okilah
Copy link

okilah commented Aug 25, 2024

Describe the bug

Devika AI hanging

How To Reproduce

Steps to reproduce the behavior (example):

  1. MacOS Version 14.6.1 (23G93)
  2. "create a solution to accept URL from the user and generate a QR Code and provide the user the option to save the QR Code Image file"
  3. Generates the plan and stops executing beyond that with a message "I am browsing the web to research the following queries"

Expected behavior

Should Continue to browse the web and beyond

24.08.25 15:33:15: root: INFO : /api/data GET
24.08.25 15:33:15: root: DEBUG : /api/data GET - Response: {"models":{"CLAUDE":[["Claude 3 Opus","claude-3-opus-20240229"],["Claude 3 Sonnet","claude-3-sonnet-20240229"],["Claude 3 Haiku","claude-3-haiku-20240307"]],"GOOGLE":[["Gemini 1.0 Pro","gemini-pro"],["Gemini 1.5 Flash","gemini-1.5-flash"],["Gemini 1.5 Pro","gemini-1.5-pro"]],"GROQ":[["LLAMA3 8B","llama3-8b-8192"],["LLAMA3 70B","llama3-70b-8192"],["LLAMA2 70B","llama2-70b-4096"],["Mixtral","mixtral-8x7b-32768"],["GEMMA 7B","gemma-7b-it"]],"MISTRAL":[["Mistral 7b","open-mistral-7b"],["Mistral 8x7b","open-mixtral-8x7b"],["Mistral Medium","mistral-medium-latest"],["Mistral Small","mistral-small-latest"],["Mistral Large","mistral-large-latest"]],"OLLAMA":[["phi3:latest","phi3:latest"],["llama3.1:latest","llama3.1:latest"]],"OPENAI":[["GPT-4o","gpt-4o"],["GPT-4 Turbo","gpt-4-turbo"],["GPT-3.5 Turbo","gpt-3.5-turbo-0125"]]},"projects":["QRCodeGenerator"],"search_engines":["Bing","Google","DuckDuckGo"]}

24.08.25 15:33:15: root: INFO : /api/status GET
24.08.25 15:33:15: root: DEBUG : /api/status GET - Response: {"status":"server is running!"}

Socket connected :: {'data': 'frontend connected!'}
24.08.25 15:33:15: root: INFO : SOCKET socket_response MESSAGE: {'data': 'Server Connected'}
24.08.25 15:33:24: root: INFO : User message: {'message': 'create a solution to accept URL from the user and generate a QR Code and provide the user the option to save the QR Code Image file', 'base_model': 'Claude 3 Haiku', 'project_name': 'QRCodeGenerator', 'search_engine': 'Bing'}
24.08.25 15:33:24: root: INFO : SOCKET info MESSAGE: {'type': 'warning', 'message': "previous agent doesn't completed it's task."}
24.08.25 15:33:24: root: INFO : SOCKET server-message MESSAGE: {'messages': {'from_devika': False, 'message': 'create a solution to accept URL from the user and generate a QR Code and provide the user the option to save the QR Code Image file', 'timestamp': '2024-08-25 15:33:24'}}
24.08.25 15:33:24: root: INFO : SOCKET agent-state MESSAGE: [{'internal_monologue': "I'm starting the work...", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 1, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 0, 'timestamp': '2024-08-25 15:33:24'}]
24.08.25 15:33:24: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 1628}
Model: Claude 3 Haiku, Enum: CLAUDE
24.08.25 15:33:25: root: INFO : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '0.00'}
24.08.25 15:33:25: root: INFO : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '0.51'}
24.08.25 15:33:26: root: INFO : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '1.01'}
24.08.25 15:33:26: root: INFO : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '1.51'}
24.08.25 15:33:27: root: INFO : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '2.02'}
24.08.25 15:33:27: root: INFO : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '2.52'}
24.08.25 15:33:28: root: INFO : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '3.02'}
24.08.25 15:33:28: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 1883}

plan :: ```
Project Name: QR Code Generator

Your Reply to the Human Prompter: I'd be happy to create a plan to generate a QR code from a user-provided URL and allow the user to save the QR code image. Let me outline the steps to accomplish this task.

Current Focus: Develop a web-based application that can generate a QR code from a user-provided URL and provide the option to save the QR code image.

Plan:

  • Step 1: Research and select a suitable QR code generation library or API that can be integrated into the web application.
  • Step 2: Create a simple web interface with an input field for the user to enter the URL and a button to generate the QR code.
  • Step 3: Implement the QR code generation functionality using the selected library or API, passing the user-provided URL as the input.
  • Step 4: Display the generated QR code image on the web page.
  • Step 5: Implement a "Save" button or link that allows the user to download the QR code image to their local device.

Summary: This plan outlines the necessary steps to create a web-based QR code generator that can accept a URL from the user, generate the corresponding QR code, and provide the user with the option to save the QR code image. The key considerations are selecting a reliable QR code generation library or API, designing a user-friendly interface, and ensuring the save functionality works seamlessly. With these steps, the user should be able to easily generate and save QR codes for their desired URLs.


24.08.25 15:33:28: root: INFO   : SOCKET server-message MESSAGE: {'messages': {'from_devika': True, 'message': "I'd be happy to create a plan to generate a QR code from a user-provided URL and allow the user to save the QR code image. Let me outline the steps to accomplish this task.", 'timestamp': '2024-08-25 15:33:28'}}
24.08.25 15:33:28: root: INFO   : SOCKET server-message MESSAGE: {'messages': {'from_devika': True, 'message': '{\n    "1": "Research and select a suitable QR code generation library or API that can be integrated into the web application.",\n    "2": "Create a simple web interface with an input field for the user to enter the URL and a button to generate the QR code.",\n    "3": "Implement the QR code generation functionality using the selected library or API, passing the user-provided URL as the input.",\n    "4": "Display the generated QR code image on the web page.",\n    "5": "Implement a \\"Save\\" button or link that allows the user to download the QR code image to their local device. "\n}', 'timestamp': '2024-08-25 15:33:28'}}

context_keywords ::  ['qr', 'generate', 'application', 'url', 'based'] 

24.08.25 15:33:28: root: INFO   : SOCKET tokens MESSAGE: {'token_usage': 2455}
Model: Claude 3 Haiku, Enum: CLAUDE
24.08.25 15:33:28: root: INFO   : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '0.00'}
24.08.25 15:33:29: root: INFO   : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '0.50'}
24.08.25 15:33:29: root: INFO   : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '1.01'}
24.08.25 15:33:30: root: INFO   : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '1.51'}
24.08.25 15:33:30: root: INFO   : SOCKET tokens MESSAGE: {'token_usage': 2198}
first <class 'dict'>
------------------->  {'internal_monologue': "Okay, let's think through this step-by-step plan to create a QR code generator. First, I need to research and find the best QR code library or API to use. Then I can build a simple web interface for the user to input a URL and generate the QR code. Displaying the QR code image and adding a save functionality will be the final pieces. This sounds like a straightforward project that I can tackle efficiently."}
#### <class 'dict'>

internal_monologue ::  Okay, let's think through this step-by-step plan to create a QR code generator. First, I need to research and find the best QR code library or API to use. Then I can build a simple web interface for the user to input a URL and generate the QR code. Displaying the QR code image and adding a save functionality will be the final pieces. This sounds like a straightforward project that I can tackle efficiently. 

24.08.25 15:33:30: root: INFO   : SOCKET agent-state MESSAGE: [{'internal_monologue': "I'm starting the work...", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 1, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 2763, 'timestamp': '2024-08-25 14:42:13'}, {'internal_monologue': "Okay, let's think through this step-by-step plan to create a QR code generator. First, I need to research and find the best QR code library or API to use. Then I can build a simple web interface for the user to input a URL and generate the QR code. Displaying the QR code image and adding a save functionality will be the final pieces. This sounds like a straightforward project that I can tackle efficiently.", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 0, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 2103, 'timestamp': '2024-08-25 15:15:44'}, {'internal_monologue': "Okay, let's think through this step-by-step plan to create a QR code generator. First, I need to research and find the best QR code library or API to use. Then I can build a simple web interface for the user to input a URL and generate the QR code. Displaying the QR code image and adding a save functionality will be the final pieces. This sounds like a straightforward project that I can tackle efficiently.", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 0, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 2103, 'timestamp': '2024-08-25 15:28:20'}, {'internal_monologue': "Okay, let's think through this step-by-step plan to create a QR code generator. First, I need to research and find the best QR code library or API to use. Then I can build a simple web interface for the user to input a URL and generate the QR code. Displaying the QR code image and adding a save functionality will be the final pieces. This sounds like a straightforward project that I can tackle efficiently.", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 0, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 2103, 'timestamp': '2024-08-25 15:32:22'}, {'internal_monologue': "Okay, let's think through this step-by-step plan to create a QR code generator. First, I need to research and find the best QR code library or API to use. Then I can build a simple web interface for the user to input a URL and generate the QR code. Displaying the QR code image and adding a save functionality will be the final pieces. This sounds like a straightforward project that I can tackle efficiently.", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 0, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 0, 'timestamp': '2024-08-25 15:33:30'}]
24.08.25 15:33:30: root: INFO   : SOCKET tokens MESSAGE: {'token_usage': 1608}
Model: Claude 3 Haiku, Enum: CLAUDE
24.08.25 15:33:30: root: INFO   : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '0.00'}
24.08.25 15:33:31: root: INFO   : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '0.51'}
24.08.25 15:33:31: root: INFO   : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '1.01'}
24.08.25 15:33:31: root: INFO   : SOCKET tokens MESSAGE: {'token_usage': 896}
first <class 'dict'>

research ::  {'queries': ['QR code generation library or API for web applications', 'How to display QR code image on a web page', 'How to implement download functionality for QR code image'], 'ask_user': ''} 

24.08.25 15:33:31: root: INFO   : SOCKET server-message MESSAGE: {'messages': {'from_devika': True, 'message': 'I am browsing the web to research the following queries: QR code generation library or API for web applications, How to display QR code image on a web page, How to implement download functionality for QR code image.\n If I need anything, I will make sure to ask you.', 'timestamp': '2024-08-25 15:33:31'}}
24.08.25 15:33:31: root: INFO   : SOCKET agent-state MESSAGE: [{'internal_monologue': "I'm starting the work...", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 1, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 2763, 'timestamp': '2024-08-25 14:42:13'}, {'internal_monologue': "Okay, let's think through this step-by-step plan to create a QR code generator. First, I need to research and find the best QR code library or API to use. Then I can build a simple web interface for the user to input a URL and generate the QR code. Displaying the QR code image and adding a save functionality will be the final pieces. This sounds like a straightforward project that I can tackle efficiently.", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 0, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 2103, 'timestamp': '2024-08-25 15:15:44'}, {'internal_monologue': "Okay, let's think through this step-by-step plan to create a QR code generator. First, I need to research and find the best QR code library or API to use. Then I can build a simple web interface for the user to input a URL and generate the QR code. Displaying the QR code image and adding a save functionality will be the final pieces. This sounds like a straightforward project that I can tackle efficiently.", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 0, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 2103, 'timestamp': '2024-08-25 15:28:20'}, {'internal_monologue': "Okay, let's think through this step-by-step plan to create a QR code generator. First, I need to research and find the best QR code library or API to use. Then I can build a simple web interface for the user to input a URL and generate the QR code. Displaying the QR code image and adding a save functionality will be the final pieces. This sounds like a straightforward project that I can tackle efficiently.", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 0, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 2103, 'timestamp': '2024-08-25 15:32:22'}, {'internal_monologue': "Okay, let's think through this step-by-step plan to create a QR code generator. First, I need to research and find the best QR code library or API to use. Then I can build a simple web interface for the user to input a URL and generate the QR code. Displaying the QR code image and adding a save functionality will be the final pieces. This sounds like a straightforward project that I can tackle efficiently.", 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': 0, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 850, 'timestamp': '2024-08-25 15:33:30'}]
24.08.25 15:33:31: root: INFO   : 
Search Engine :: bing
Exception in thread Thread-5 (<lambda>):
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/threading.py", line 1012, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/devika/devika.py", line 99, in <lambda>
    thread = Thread(target=lambda: agent.execute(message, project_name))
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/devika/src/agents/agent.py", line 344, in execute
    search_results = self.search_queries(queries, project_name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/devika/src/agents/agent.py", line 106, in search_queries
    link = web_search.get_first_link()
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/gdevika/src/browser/search.py", line 30, in get_first_link
    return self.query_result["webPages"]["value"][0]["url"]
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
TypeError: 'NoneType' object is not subscriptable


### Configuration
  • OS: MacOS Version 14.6.1 (23G93)
  • Python version: Python 3.12.5
  • Node version: Node.js v20.17.0
  • bun version: bun 1.1.26
  • search engine: bing
  • Model: Claude 3 Haiku
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant