From 22e62a36d029061306b27310bdd40214a25bb333 Mon Sep 17 00:00:00 2001 From: Zhichao Date: Thu, 10 Oct 2024 22:45:27 +0800 Subject: [PATCH] pass verbosity to VisionAgentCoder --- vision_agent/tools/meta_tools.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/vision_agent/tools/meta_tools.py b/vision_agent/tools/meta_tools.py index 024d4230..a9f41e80 100644 --- a/vision_agent/tools/meta_tools.py +++ b/vision_agent/tools/meta_tools.py @@ -343,6 +343,7 @@ def generate_vision_code( chat: str, media: List[str], test_multi_plan: bool = True, + verbosity: int = 0, custom_tool_names: Optional[List[str]] = None, ) -> str: """Generates python code to solve vision based tasks. @@ -353,6 +354,7 @@ def generate_vision_code( chat (str): The chat message from the user. media (List[str]): The media files to use. test_multi_plan (bool): Do not change this parameter. + verbosity (int): Do not change this parameter. custom_tool_names (Optional[List[str]]): Do not change this parameter. Returns: @@ -375,7 +377,7 @@ def detect_dogs(image_path: str): ) ) else: - agent = va.agent.VisionAgentCoder() + agent = va.agent.VisionAgentCoder(verbosity=verbosity) fixed_chat: List[Message] = [{"role": "user", "content": chat, "media": media}] response = agent.chat_with_workflow( @@ -410,6 +412,7 @@ def edit_vision_code( name: str, chat_history: List[str], media: List[str], + verbosity: int = 0, customized_tool_names: Optional[List[str]] = None, ) -> str: """Edits python code to solve a vision based task. @@ -418,6 +421,7 @@ def edit_vision_code( artifacts (Artifacts): The artifacts object to save the code to. name (str): The file path to the code. chat_history (List[str]): The chat history to used to generate the code. + verbosity (int): Do not change this parameter. customized_tool_names (Optional[List[str]]): Do not change this parameter. Returns: @@ -438,7 +442,7 @@ def detect_dogs(image_path: str): return dogs """ - agent = va.agent.VisionAgentCoder() + agent = va.agent.VisionAgentCoder(verbosity=verbosity) if name not in artifacts: print(f"[Artifact {name} does not exist]") return f"[Artifact {name} does not exist]" @@ -641,7 +645,7 @@ def use_extra_vision_agent_args( def generate_replacer(match: re.Match) -> str: arg = match.group(1) - out_str = f"generate_vision_code({arg}, test_multi_plan={test_multi_plan}" + out_str = f"generate_vision_code({arg}, verbosity=2, test_multi_plan={test_multi_plan}" if customized_tool_names is not None: out_str += f", custom_tool_names={customized_tool_names})" else: @@ -652,7 +656,7 @@ def generate_replacer(match: re.Match) -> str: def edit_replacer(match: re.Match) -> str: arg = match.group(1) - out_str = f"edit_vision_code({arg}" + out_str = f"edit_vision_code({arg}, verbosity=2" if customized_tool_names is not None: out_str += f", custom_tool_names={customized_tool_names})" else: