Skip to content

Commit

Permalink
fix: remove the code execution result from logs in pick_plan (#189)
Browse files Browse the repository at this point in the history
* log + execution sequence

* add code
  • Loading branch information
yzld2002 authored Aug 6, 2024
1 parent d794281 commit 50ec0b9
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions vision_agent/agent/vision_agent_coder.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def format_plans(plans: Dict[str, Any]) -> str:


def extract_image(
media: Optional[Sequence[Union[str, Path]]]
media: Optional[Sequence[Union[str, Path]]],
) -> Optional[Sequence[Union[str, Path]]]:
if media is None:
return None
Expand Down Expand Up @@ -186,7 +186,8 @@ def pick_plan(
if tool_output.success
else "Code execution failed"
),
"payload": tool_output.to_json(),
"code": DefaultImports.prepend_imports(code),
# "payload": tool_output.to_json(),
"status": "completed" if tool_output.success else "failed",
}
)
Expand All @@ -211,6 +212,9 @@ def pick_plan(
}
)
code = extract_code(model(prompt))
tool_output = code_interpreter.exec_isolation(
DefaultImports.prepend_imports(code)
)
log_progress(
{
"type": "log",
Expand All @@ -220,13 +224,10 @@ def pick_plan(
else "Code execution failed"
),
"code": DefaultImports.prepend_imports(code),
"payload": tool_output.to_json(),
# "payload": tool_output.to_json(),
"status": "completed" if tool_output.success else "failed",
}
)
tool_output = code_interpreter.exec_isolation(
DefaultImports.prepend_imports(code)
)
tool_output_str = ""
if len(tool_output.logs.stdout) > 0:
tool_output_str = tool_output.logs.stdout[0]
Expand Down

0 comments on commit 50ec0b9

Please sign in to comment.