stitionai / devika

Devika is an Agentic AI Software Engineer that can understand high-level human instructions, break them down into steps, research relevant information, and write code to achieve the given objective. Devika aims to be a competitive open-source alternative to Devin by Cognition AI.
MIT License
17.95k stars 2.32k forks source link

fetch the latest changes - TypeError: 'NoneType' object is not subscriptable #464

Open Simsk8er opened 2 months ago

Simsk8er commented 2 months ago
          fetch the latest changes

Originally posted by @ARajgor in https://github.com/stitionai/devika/issues/47#issuecomment-2035254587

I'm having this same issue and ironically I was doing a simple tic tac to as a test. But I'm up to date as of this-morning and this was closed 2 weeks ago I think.

Search Engine :: bing Exception in thread Thread-6 (): Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64qbz5n2kfra8p0\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64qbz5n2kfra8p0\Lib\threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "D:\Github\devika\devika.py", line 94, in thread = Thread(target=lambda: agent.execute(message, project_name)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Github\devika\src\agents\agent.py", line 346, in execute search_results = self.search_queries(queries, project_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Github\devika\src\agents\agent.py", line 106, in search_queries link = web_search.get_first_link() ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Github\devika\src\browser\search.py", line 32, in get_first_link return self.query_result["webPages"]["value"][0]["url"]


TypeError: 'NoneType' object is not subscriptable           
nalaso commented 2 months ago

Which one did u use? Bing or duckduckgo

ARajgor commented 2 months ago

Can you share backend log.

Simsk8er commented 2 months ago

Which one did u use? Bing or duckduckgo

I used bing with ollama codeqwen, its not a one time thing either happens every time the same error.

@ARajgor is this sufficient? The is all from the cmd window I do see a log devika_agent.log is that what you are referring to or is there another log?

24.04.20 08:42:03: root: INFO : /api/data GET 24.04.20 08:42:03: 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"]],"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":[["codeqwen","codeqwen:7b"],["cuda","cuda:latest"],["dolphincoder","dolphincoder:15b"],["llama2-uncensored","llama2-uncensored:latest"],["llama3","llama3:8b"]],"OPENAI":[["GPT-4 Turbo","gpt-4-turbo"],["GPT-3.5 Turbo","gpt-3.5-turbo-0125"]]},"projects":[],"search_engines":["Bing","Google","DuckDuckGo"]}

24.04.20 08:42:08: root: INFO : /api/create-project POST 24.04.20 08:42:08: root: DEBUG : /api/create-project POST - Response: {"message":"Project created"}

24.04.20 08:42:08: root: INFO : /api/get-agent-state POST 24.04.20 08:42:08: root: DEBUG : /api/get-agent-state POST - Response: {"state":null}

24.04.20 08:42:28: root: INFO : SOCKET server-message MESSAGE: {'messages': {'from_devika': False, 'message': 'create simple tic tac to in python', 'timestamp': '2024-04-20 08:42:28'}} 24.04.20 08:42:28: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 738} Model: codeqwen:7b, Enum: OLLAMA 24.04.20 08:42:53: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 837}

plan :: Project Name: TicTacToe

Your Reply to the Human Prompter: I am going to create a simple Tic Tac Toe game in Python using command line interface.

Current Focus: Implementing the game logic and user input handling.

Plan:

Summary: This plan will create a simple Tic Tac Toe game in Python using command line interface. It will include functions for initializing the board, printing the current state of the board, input validation, game rules, and handling the game loop.

24.04.20 08:42:53: root: INFO : SOCKET agent-state MESSAGE: [{'internal_monologue': None, 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': None, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 603, 'timestamp': '2024-04-20 08:42:28'}] 24.04.20 08:42:53: root: INFO : SOCKET server-message MESSAGE: {'messages': {'from_devika': True, 'message': 'I am going to create a simple Tic Tac Toe game in Python using command line interface.', 'timestamp': '2024-04-20 08:42:53'}} 24.04.20 08:42:53: root: INFO : SOCKET server-message MESSAGE: {'messages': {'from_devika': True, 'message': '{\n "1": "Define the board size (3x3).",\n "2": "Create a function to initialize the board with empty spaces.",\n "3": "Create a function to print the current state of the board.",\n "4": "Implement user input validation for each move, ensuring that the player inputs a valid row and column number (1-3).",\n "5": "Implement game rules to determine when a player has won or if it\'s a tie.",\n "6": "Create a function to handle the game loop, allowing players to take turns until a winner or a tie is detected. "\n}', 'timestamp': '2024-04-20 08:42:53'}}

context_keywords :: ['input', 'logic', 'implementing', 'game', 'handling']

24.04.20 08:42:54: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 1319} Model: codeqwen:7b, Enum: OLLAMA 24.04.20 08:42:56: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 1005}

internal_monologue :: Sure, I can start by initializing the board with empty spaces.

24.04.20 08:42:56: root: INFO : SOCKET agent-state MESSAGE: [{'internal_monologue': None, 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': None, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 983, 'timestamp': '2024-04-20 08:42:28'}, {'internal_monologue': 'Sure, I can start by initializing the board with empty spaces.', 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': None, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 0, 'timestamp': '2024-04-20 08:42:56'}] 24.04.20 08:42:56: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 1630} Model: codeqwen:7b, Enum: OLLAMA 24.04.20 08:43:00: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 889}

research :: {'queries': ['How to implement Tic Tac Toe in Python', 'Understanding game logic for Tic Tac Toe'], 'ask_user': ''}

24.04.20 08:43:00: root: INFO : SOCKET server-message MESSAGE: {'messages': {'from_devika': True, 'message': 'I am browsing the web to research the following queries: How to implement Tic Tac Toe in Python, Understanding game logic for Tic Tac Toe.\n If I need anything, I will make sure to ask you.', 'timestamp': '2024-04-20 08:43:00'}} 24.04.20 08:43:00: root: INFO : SOCKET agent-state MESSAGE: [{'internal_monologue': None, 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': None, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 983, 'timestamp': '2024-04-20 08:42:28'}, {'internal_monologue': 'Sure, I can start by initializing the board with empty spaces.', 'browser_session': {'url': None, 'screenshot': None}, 'terminal_session': {'command': None, 'output': None, 'title': None}, 'step': None, 'message': None, 'completed': False, 'agent_is_active': True, 'token_usage': 852, 'timestamp': '2024-04-20 08:42:56'}] 24.04.20 08:43:00: root: INFO : Search Engine :: bing Exception in thread Thread-3 (): Traceback (most recent call last): File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64qbz5n2kfra8p0\Lib\threading.py", line 1073, in _bootstrap_inner self.run() File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1008.0_x64qbz5n2kfra8p0\Lib\threading.py", line 1010, in run self._target(*self._args, **self._kwargs) File "D:\Github\devika\devika.py", line 94, in thread = Thread(target=lambda: agent.execute(message, project_name)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Github\devika\src\agents\agent.py", line 346, in execute search_results = self.search_queries(queries, project_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Github\devika\src\agents\agent.py", line 106, in search_queries link = web_search.get_first_link() ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\Github\devika\src\browser\search.py", line 32, in get_first_link return self.query_result["webPages"]["value"][0]["url"]


TypeError: 'NoneType' object is not subscriptable
ARajgor commented 2 months ago

Here Bing api didn't return web result that's why it can't find the url