Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Fix debugging log + remove final_code (try 2) #185

Merged
merged 3 commits into from
Jul 30, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 15 additions & 19 deletions vision_agent/agent/vision_agent_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def write_and_test_code(
"code": DefaultImports.prepend_imports(code),
"payload": {
"test": test,
"result": result.to_json(),
# "result": result.to_json(),
},
}
)
Expand Down Expand Up @@ -426,7 +426,8 @@ def debug_code(
) -> tuple[str, str, Execution]:
log_progress(
{
"type": "code",
"type": "log",
"log_content": ("Debugging code"),
"status": "started",
}
)
Expand Down Expand Up @@ -469,10 +470,11 @@ def debug_code(
)
log_progress(
{
"type": "code",
"type": "log",
"log_content": ("Running code"),
"status": "running",
"code": DefaultImports.prepend_imports(code),
"payload": {
"code": DefaultImports.prepend_imports(code),
"test": test,
},
}
Expand All @@ -483,12 +485,15 @@ def debug_code(
)
log_progress(
{
"type": "code",
"type": "log",
"log_content": (
"Code execution succeed" if result.success else "Code execution failed"
),
"status": "completed" if result.success else "failed",
"code": DefaultImports.prepend_imports(code),
"payload": {
"code": DefaultImports.prepend_imports(code),
"test": test,
"result": result.to_json(),
# "result": result.to_json(),
},
}
)
Expand Down Expand Up @@ -525,7 +530,8 @@ def retrieve_tools(
) -> Dict[str, str]:
log_progress(
{
"type": "tools",
"type": "log",
"log_content": ("Retrieving tools for each plan"),
"status": "started",
}
)
Expand Down Expand Up @@ -802,17 +808,6 @@ def chat_with_workflow(
plan.append({"code": code, "test": test, "plan": plan_i})

execution_result = cast(Execution, results["test_result"])
self.log_progress(
{
"type": "final_code",
"status": "completed" if success else "failed",
"payload": {
"code": DefaultImports.prepend_imports(code),
"test": test,
"result": execution_result.to_json(),
},
}
)

if display_visualization:
for res in execution_result.results:
Expand All @@ -822,6 +817,7 @@ def chat_with_workflow(
play_video(res.mp4)

return {
"status": "completed" if success else "failed",
"code": DefaultImports.prepend_imports(code),
"test": test,
"test_result": execution_result,
Expand Down
Loading