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
18.55k stars 2.41k forks source link

latest change from commit f90da39 to 30e9828 #486

Open darrassi1 opened 7 months ago

darrassi1 commented 7 months ago

$ python devika.py Traceback (most recent call last): File "C:\Users\pc\Desktop\stream_main\devika\devika.py", line 8, in init_devika() File "C:\Users\pc\Desktop\stream_main\devika\src\init.py", line 7, in init_devika logger = Logger() ^^^^^^^^ File "C:\Users\pc\Desktop\stream_main\devika\src\logger.py", line 11, in init config = Config() ^^^^^^^^ File "C:\Users\pc\Desktop\stream_main\devika\src\config.py", line 11, in new cls._instance._load_config() File "C:\Users\pc\Desktop\stream_main\devika\src\config.py", line 38, in _load_config self.config = config ^^^^^^ UnboundLocalError: cannot access local variable 'config' where it is not associated with a value

ARajgor commented 7 months ago

can you fetch the latest changes and try it again?

darrassi1 commented 7 months ago

and i did not like this in llm.py with concurrent.futures.ThreadPoolExecutor() as executor: future = executor.submit(model.inference, self.model_id, prompt)

because its consuming tokens Alot

darrassi1 commented 7 months ago

can you fetch the latest changes and try it again?

yes i did , in fact i started all over because of merge conflict with others pending PR

ARajgor commented 7 months ago

I just pushed the patch for config. and for ThreadPoolExecutor is for calculating time taking by model nothing to do with token usage.

darrassi1 commented 7 months ago

I just pushed the patch for config. and for ThreadPoolExecutor is for calculating time taking by model nothing to do with token usage.

i got from new commit 1c8450b ->> this new bug
`$ python devika.py 24.04.25 13:01:47: root: INFO : Initializing Devika... 24.04.25 13:01:47: root: INFO : checking configurations... 24.04.25 13:01:47: root: INFO : Initializing Prerequisites Jobs... 24.04.25 13:02:23: root: INFO : Loading sentence-transformer BERT models... 24.04.25 13:02:34: root: INFO : BERT model loaded successfully. 24.04.25 13:02:46: root: INFO : Ollama available 24.04.25 13:02:55: root: INFO : Devika is up and running! 24.04.25 13:03:07: root: INFO : /api/data GET 24.04.25 13:03:07: 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":[],"OPENAI":[["GPT-4 Turbo","gpt-4-turbo"],["GPT-3.5 Turbo","gpt-3.5-turbo-0125"]]},"projects":[],"search_engines":["Bing","Google","DuckDuckGo"]}

Socket connected :: {'data': 'frontend connected!'} 24.04.25 13:03:07: root: INFO : SOCKET socket_response MESSAGE: {'data': 'Server Connected'} 24.04.25 13:03:17: root: INFO : /api/data GET 24.04.25 13:03:17: 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":[],"OPENAI":[["GPT-4 Turbo","gpt-4-turbo"],["GPT-3.5 Turbo","gpt-3.5-turbo-0125"]]},"projects":[],"search_engines":["Bing","Google","DuckDuckGo"]}

Socket connected :: {'data': 'frontend connected!'} 24.04.25 13:03:17: root: INFO : SOCKET socket_response MESSAGE: {'data': 'Server Connected'} 24.04.25 13:03:25: root: INFO : /api/create-project POST 24.04.25 13:03:25: root: DEBUG : /api/create-project POST - Response: {"message":"Project created"}

24.04.25 13:04:02: root: INFO : User message: {'message': 'create a python game of snake ', 'base_model': 'gemini-pro', 'project_name': 'test', 'search_engine': 'DuckDuckGo'} 24.04.25 13:04:02: root: INFO : SOCKET server-message MESSAGE: {'messages': {'from_devika': False, 'message': 'create a python game of snake ', 'timestamp': '2024-04-25 13:04:02'}} 24.04.25 13:04:02: 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-04-25 13:04:02'}] 24.04.25 13:04:02: root: INFO : SOCKET tokens MESSAGE: {'token_usage': 736} Model: gemini-pro, Enum: None Exception in thread Thread-3 (): Traceback (most recent call last): File "C:\Users\pc\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File "C:\Users\pc\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "C:\Users\pc\Desktop\stream_main\devika\devika.py", line 85, in thread = Thread(target=lambda: agent.execute(message, project_name)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pc\Desktop\stream_main\devika\src\agents\agent.py", line 279, in execute plan = self.planner.execute(prompt, project_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pc\Desktop\stream_main\devika\src\agents\planner\planner.py", line 70, in execute response = self.llm.inference(prompt, project_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\pc\Desktop\stream_main\devika\src\llm\llm.py", line 88, in inference raise ValueError(f"Model {self.model_id} not supported") ValueError: Model gemini-pro not supported `

darrassi1 commented 7 months ago

@ARajgor can you create new branche dev

am working on RAG things

ARajgor commented 7 months ago

check the message from the browser console?

darrassi1 commented 7 months ago
{data: 'Server Connected'}
{message: 'create snake game in python', base_model: 'gemini-pro', project_name: 'test3', search_engine: 'DuckDuckGo'}
{messages: {…}}
messages
: 
{from_devika: false, message: 'create snake game in python', timestamp: '2024-04-25 13:13:13'}
[[Prototype]]
: 
Object

and i got this in terminal


Exception in thread Thread-5 (<lambda>):
Traceback (most recent call last):
  File "C:\Users\pc\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\Users\pc\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\pc\Desktop\stream_main\devika\devika.py", line 85, in <lambda>
    thread = Thread(target=lambda: agent.execute(message, project_name))
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pc\Desktop\stream_main\devika\src\agents\agent.py", line 279, in execute
    plan = self.planner.execute(prompt, project_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pc\Desktop\stream_main\devika\src\agents\planner\planner.py", line 70, in execute
    response = self.llm.inference(prompt, project_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pc\Desktop\stream_main\devika\src\llm\llm.py", line 88, in inference
    raise ValueError(f"Model {self.model_id} not supported")
ValueError: Model gemini-pro not supported

```                          and i cannot type in text area  even if i created new projet                                                     just revert all commit and make PR for small commit to be tested 
ARajgor commented 7 months ago

Ohh I understand the problem. clear the local storage from browser

darrassi1 commented 7 months ago

unfortunately i can't

ARajgor commented 7 months ago

image remove this selectedModel

darrassi1 commented 7 months ago

gemini work but , the logic you defined making it slow

Socket connected ::  {'data': 'frontend connected!'}
24.04.25 13:48:43: root: INFO   : SOCKET socket_response MESSAGE: {'data': 'Server Connected'}
24.04.25 13:48:57: root: INFO   : User message: {'message': 'create login page in html css js\n', 'base_model': 'Gemini 1.0 Pro', 'project_name': 'xs', 'search_engine': 'DuckDuckGo'}
24.04.25 13:48:57: root: INFO   : SOCKET server-message MESSAGE: {'messages': {'from_devika': False, 'message': 'create login page in html css js\n', 'timestamp': '2024-04-25 13:48:57'}}
24.04.25 13:48:57: 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-04-25 13:48:57'}]
24.04.25 13:48:57: root: INFO   : SOCKET tokens MESSAGE: {'token_usage': 738}
Model: Gemini 1.0 Pro, Enum: GOOGLE
24.04.25 13:48:57: root: INFO   : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '0.19'}
24.04.25 13:49:03: root: INFO   : SOCKET tokens MESSAGE: {'token_usage': 955}

plan ::  Project Name: Login Page Creation

Your Reply to the Human Prompter: I will create a step-by-step plan to help build a login page in HTML, CSS, and JavaScript.

Current Focus: Structuring the login page components and styling.

Plan:
- [ ] Step 1: Create an HTML file and add basic structure, including a form for user credentials.
- [ ] Step 2: Implement CSS to style the page, enhance visual appeal, and arrange elements effectively.
- [ ] Step 3: Use JavaScript to add functionality like input validation, error handling, and form submission.
- [ ] Step 4: Add necessary HTML tags and attributes to support user interaction, such as input fields, buttons, and labels.
- [ ] Step 5: Include appropriate CSS classes and styles to control the appearance and layout of form elements.
- [ ] Step 6: Write JavaScript functions to handle user input, perform validation checks, and submit form data.
- [ ] Step 7: Test the login page functionality by entering data and observing expected behavior.
- [ ] Step 8: Make necessary adjustments to HTML, CSS, or JavaScript based on testing results to improve usability and functionality.

Summary: This plan provides a structured approach to creating a login page using HTML, CSS, and JavaScript. By following these steps, one can create a user-friendly and interactive login interface. Key considerations include proper form validation, error handling, and responsive design.

24.04.25 13:49:03: root: INFO   : SOCKET server-message MESSAGE: {'messages': {'from_devika': True, 'message': 'I will create a step-by-step plan to help build a login page in HTML, CSS, and JavaScript.', 'timestamp': '2024-04-25 13:49:03'}}
24.04.25 13:49:03: root: INFO   : SOCKET server-message MESSAGE: {'messages': {'from_devika': True, 'message': '{\n    "1": "Create an HTML file and add basic structure, including a form for user credentials.",\n    "2": "Implement CSS to style the page, enhance visual appeal, and arrange elements effectively.",\n    "3": "Use JavaScript to add functionality like input validation, error handling, and form submission.",\n    "4": "Add necessary HTML tags and attributes to support user interaction, such as input fields, buttons, and labels.",\n    "5": "Include appropriate CSS classes and styles to control the appearance and layout of form elements.",\n    "6": "Write JavaScript functions to handle user input, perform validation checks, and submit form data.",\n    "7": "Test the login page functionality by entering data and observing expected behavior.",\n    "8": "Make necessary adjustments to HTML, CSS, or JavaScript based on testing results to improve usability and functionality. "\n}', 'timestamp': '2024-04-25 13:49:03'}}

context_keywords ::  ['styling', 'login', 'components', 'page', 'structuring']

24.04.25 13:49:06: root: INFO   : SOCKET tokens MESSAGE: {'token_usage': 1496}
Model: Gemini 1.0 Pro, Enum: GOOGLE
24.04.25 13:49:06: root: INFO   : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '0.23'}
24.04.25 13:49:09: root: INFO   : SOCKET tokens MESSAGE: {'token_usage': 1135}

internal_monologue ::  Let's think about the most effective way to structure and style this login page...

24.04.25 13:49:09: 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': 1107, 'timestamp': '2024-04-25 13:48:57'}, {'internal_monologue': "Let's think about the most effective way to structure and style this login page...", '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-04-25 13:49:09'}]
24.04.25 13:49:09: root: INFO   : SOCKET tokens MESSAGE: {'token_usage': 1750}
Model: Gemini 1.0 Pro, Enum: GOOGLE
24.04.25 13:49:09: root: INFO   : SOCKET inference MESSAGE: {'type': 'time', 'elapsed_time': '0.18'}
24.04.25 13:49:11: root: INFO   : SOCKET tokens MESSAGE: {'token_usage': 933}

research ::  {'queries': ['How to structure a login page in HTML'], 'ask_user': ''}

24.04.25 13:49:11: root: INFO   : SOCKET server-message MESSAGE: {'messages': {'from_devika': True, 'message': 'I am browsing the web to research the following queries: How to structure a login page in HTML.\n If I need anything, I will make sure to ask you.', 'timestamp': '2024-04-25 13:49:11'}}
24.04.25 13:49:11: 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': 1107, 'timestamp': '2024-04-25 13:48:57'}, {'internal_monologue': "Let's think about the most effective way to structure and style this login page...", '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': 904, 'timestamp': '2024-04-25 13:49:09'}]
24.04.25 13:49:13: root: INFO   :
Search Engine :: duckduckgo

Link ::  https://www.w3schools.com/howto/howto_css_login_form.asp

TimeoutError: Page.goto: Timeout 20000ms exceeded.
Call log:
navigating to "https://www.w3schools.com/howto/howto_css_login_form.asp", waiting until "load"
 when trying to navigate to https://www.w3schools.com/howto/howto_css_login_form.asp
Exception in thread Thread-16 (<lambda>):
Traceback (most recent call last):
  File "C:\Users\pc\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\Users\pc\AppData\Local\Programs\Python\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\pc\Desktop\stream_main\devika\devika.py", line 85, in <lambda>
    thread = Thread(target=lambda: agent.execute(message, project_name))
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pc\Desktop\stream_main\devika\src\agents\agent.py", line 344, in execute
    search_results = self.search_queries(queries, project_name)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pc\Desktop\stream_main\devika\src\agents\agent.py", line 110, in search_queries
    browser, raw, data = loop.run_until_complete(self.open_page(project_name, link))
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pc\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\pc\Desktop\stream_main\devika\src\agents\agent.py", line 73, in open_page
    _, raw = await browser.screenshot(project_name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pc\Desktop\stream_main\devika\src\browser\browser.py", line 49, in screenshot
    await self.page.screenshot(path=path_to_save, full_page=True)
  File "C:\Users\pc\Desktop\stream_main\devika\.venv\Lib\site-packages\playwright\async_api\_generated.py", line 9309, in screenshot
    await self._impl_obj.screenshot(
  File "C:\Users\pc\Desktop\stream_main\devika\.venv\Lib\site-packages\playwright\_impl\_page.py", line 715, in screenshot
    encoded_binary = await self._channel.send("screenshot", params)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pc\Desktop\stream_main\devika\.venv\Lib\site-packages\playwright\_impl\_connection.py", line 59, in send
    return await self._connection.wrap_api_call(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\pc\Desktop\stream_main\devika\.venv\Lib\site-packages\playwright\_impl\_connection.py", line 513, in wrap_api_call
    raise rewrite_error(error, f"{parsed_st['apiName']}: {error}") from None
playwright._impl._errors.TimeoutError: Page.screenshot: Timeout 30000ms exceeded.
Call log:
taking page screenshot
  - waiting for fonts to load...
its stuck for good 
darrassi1 commented 7 months ago

i think complexity will consume more power , we need to invest time in new Goodie like RAG ,memory , webscraping ONLINE DOCS , optimising token usage , fixing readcode because when it come to big projet its imposible the feed the whole projet as prompt .