Skip to content

Commit

Permalink
feat: add log for debug code and test
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyiqunLu committed May 27, 2024
1 parent 242f85c commit 6ff57ed
Showing 1 changed file with 39 additions and 1 deletion.
40 changes: 39 additions & 1 deletion vision_agent/agent/vision_agent_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,18 @@ def write_and_test_code(
"result": fixed_code_and_test["reflections"],
}
)
log_progress(
{
"log": "Debug code:",
"code": code,
}
)
log_progress(
{
"log": "Debug test:",
"code": test,
}
)
_LOGGER.info(
f"Debug attempt {count + 1}, reflection: {fixed_code_and_test['reflections']}"
)
Expand All @@ -208,6 +220,32 @@ def write_and_test_code(
_CONSOLE.print(
Syntax(f"{code}\n{test}", "python", theme="gruvbox-dark", line_numbers=True)
)

if count == max_retries:
log_progress(
{
"log": f"{max_retries} max retries reached.",
}
)

log_progress(
{
"log": "Final code:",
"code": code,
}
)
log_progress(
{
"log": "Final test:",
"code": test,
}
)
log_progress(
{
"log": "Final result:",
"result": result,
}
)
_LOGGER.info(f"Final Result: {result}")

return {
Expand Down Expand Up @@ -367,7 +405,7 @@ def chat_with_workflow(

self.log_progress(
{
"log": f"The Vision Agent V3 has concluded this chat.\nSuccess: {success}",
"log": f"The Vision Agent V3 has concluded this chat.",
"finished": True,
}
)
Expand Down

0 comments on commit 6ff57ed

Please sign in to comment.