Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
  • Loading branch information
MingruiZhang committed Jul 29, 2024
1 parent 1b32e94 commit 80e6501
Showing 1 changed file with 16 additions and 19 deletions.
35 changes: 16 additions & 19 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,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 @@ -489,11 +489,13 @@ def debug_code(
) -> tuple[str, str, Execution]:
log_progress(
{
"type": "code",
"type": "log",
"log_content": (
"Debugging code"
),
"status": "started",
}
)

fixed_code_and_test = {"code": "", "test": "", "reflections": ""}
success = False
count = 0
Expand Down Expand Up @@ -532,10 +534,13 @@ 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 @@ -546,12 +551,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 @@ -843,17 +851,6 @@ def chat_with_workflow(
plan.append({"code": code, "test": test, "plan": best_plan})

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 Down

0 comments on commit 80e6501

Please sign in to comment.