diff --git a/vision_agent/agent/agent.py b/vision_agent/agent/agent.py index b2fccb01..135319be 100644 --- a/vision_agent/agent/agent.py +++ b/vision_agent/agent/agent.py @@ -1,6 +1,6 @@ from abc import ABC, abstractmethod from pathlib import Path -from typing import Dict, List, Optional, Union, Any +from typing import Any, Dict, List, Optional, Union class Agent(ABC): diff --git a/vision_agent/agent/agent_coder.py b/vision_agent/agent/agent_coder.py index aad3df66..0e4129ed 100644 --- a/vision_agent/agent/agent_coder.py +++ b/vision_agent/agent/agent_coder.py @@ -3,7 +3,7 @@ import os import sys from pathlib import Path -from typing import Dict, List, Optional, Union, Any +from typing import Any, Dict, List, Optional, Union from rich.console import Console from rich.syntax import Syntax diff --git a/vision_agent/agent/vision_agent_v3.py b/vision_agent/agent/vision_agent_v3.py index 6d194d9c..d9fb8821 100644 --- a/vision_agent/agent/vision_agent_v3.py +++ b/vision_agent/agent/vision_agent_v3.py @@ -3,7 +3,7 @@ import logging import sys from pathlib import Path -from typing import Any, Dict, List, Optional, Union, cast, Callable, no_type_check +from typing import Any, Callable, Dict, List, Optional, Union, cast, no_type_check from rich.console import Console from rich.syntax import Syntax @@ -14,6 +14,7 @@ CODE, FEEDBACK, FIX_BUG, + FULL_TASK, PLAN, REFLECT, SIMPLE_TEST, @@ -332,7 +333,7 @@ def chat_with_workflow( self.verbosity, ) results = write_and_test_code( - plan_i_str, + FULL_TASK.format(user_request=chat[0]["content"], subtasks=plan_i_str), tool_info, UTILITIES_DOCSTRING, format_memory(working_memory), @@ -350,7 +351,14 @@ def chat_with_workflow( plan.append({"code": code, "test": test, "plan": plan_i}) if self_reflection: - reflection = reflect(chat, plan_i_str, code, self.planner) + reflection = reflect( + chat, + FULL_TASK.format( + user_request=chat[0]["content"], subtasks=plan_i_str + ), + code, + self.planner, + ) if self.verbosity > 0: self.log_progress( { diff --git a/vision_agent/agent/vision_agent_v3_prompts.py b/vision_agent/agent/vision_agent_v3_prompts.py index 769559a4..d1e6077b 100644 --- a/vision_agent/agent/vision_agent_v3_prompts.py +++ b/vision_agent/agent/vision_agent_v3_prompts.py @@ -3,6 +3,14 @@ {user_request} """ +FULL_TASK = """ +## User Request +{user_request} + +## Subtasks +{subtasks} +""" + FEEDBACK = """ ## This contains code and feedback from previous runs and is used for providing context so you do not make the same mistake again. @@ -170,7 +178,7 @@ def find_text(image_path: str, text: str) -> str: FIX_BUG = """ -**Role** As a coder, your job is to find the error in the code and fix it. You are running in a notebook setting so feel free to run !pip install to install missing packages. +**Role** As a coder, your job is to find the error in the code and fix it. You are running in a notebook setting so you can run !pip install to install missing packages. **Instructions**: Please re-complete the code to fix the error message. Here is the previous version: