From 0629b4c92004ca43b01654ec23d4204043722ce0 Mon Sep 17 00:00:00 2001 From: shankar-landing-ai Date: Thu, 23 May 2024 17:09:38 -0700 Subject: [PATCH] fixing a bug on retries and adding prompt for logging --- vision_agent/agent/vision_agent_v3.py | 2 ++ vision_agent/agent/vision_agent_v3_prompts.py | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/vision_agent/agent/vision_agent_v3.py b/vision_agent/agent/vision_agent_v3.py index 2f7edfad..6d194d9c 100644 --- a/vision_agent/agent/vision_agent_v3.py +++ b/vision_agent/agent/vision_agent_v3.py @@ -363,6 +363,8 @@ def chat_with_workflow( success = cast(bool, reflection["success"]) working_memory.append({"code": f"{code}\n{test}", "feedback": feedback}) + retries += 1 + self.log_progress( { "log": f"The Vision Agent V3 has concluded this chat.\nSuccess: {success}", diff --git a/vision_agent/agent/vision_agent_v3_prompts.py b/vision_agent/agent/vision_agent_v3_prompts.py index 9c0eba09..769559a4 100644 --- a/vision_agent/agent/vision_agent_v3_prompts.py +++ b/vision_agent/agent/vision_agent_v3_prompts.py @@ -61,6 +61,7 @@ 2. **Algorithm/Method Selection**: Decide on the most efficient way. 3. **Pseudocode Creation**: Write down the steps you will follow in pseudocode. 4. **Code Generation**: Translate your pseudocode into executable Python code. +5. **Logging**: Log the output of the custom functions that were provided to you from `from vision_agent.tools.tools_v2 import *`. Use a debug flag in the function parameters to toggle logging on and off. """ TEST = """ @@ -161,8 +162,10 @@ def find_text(image_path: str, text: str) -> str: 2. Ensure each test case is well-documented with comments explaining the scenario it covers. 3. Your test case MUST run only on the given image which is {media} 4. DO NOT use any non-existent or dummy image or video files that are not provided by the user's instructions. -4. DO NOT mock any functions, you must test their functionality as is. -5. DO NOT assert the output value, run the code and verify it runs without any errors and assert only the output format or data structure. +5. DO NOT mock any functions, you must test their functionality as is. +6. DO NOT assert the output value, run the code and verify it runs without any errors and assert only the output format or data structure. +7. DO NOT import the testing function as it will available in the testing environment. +8. Print the output of the function that is being tested. """