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: streaming back assistant response before parse code action #276

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
23 changes: 11 additions & 12 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,19 +492,10 @@ def chat_with_artifacts(
}
)

code_action = response.get("execute_python", None)
# sometimes it gets stuck in a loop, so we force it to exit
if last_response == response:
response["let_user_respond"] = True

finished = response.get("let_user_respond", False)

code_action = response.get("execute_python", None)
if code_action is not None:
code_action = use_extra_vision_agent_args(
code_action, test_multi_plan, custom_tool_names
)

if last_response == response:
self.streaming_message(
{
"role": "assistant",
Expand All @@ -514,7 +505,7 @@ def chat_with_artifacts(
"value": "Agent is stuck in conversation loop, exited",
"traceback_raw": [],
},
"finished": finished and code_action is None,
"finished": code_action is None,
}
)
else:
Expand All @@ -524,10 +515,18 @@ def chat_with_artifacts(
"content": new_format_to_old_format(
add_step_descriptions(response)
),
"finished": finished and code_action is None,
"finished": response.get("let_user_respond", False)
and code_action is None,
}
)

finished = response.get("let_user_respond", False)

if code_action is not None:
code_action = use_extra_vision_agent_args(
code_action, test_multi_plan, custom_tool_names
)

if code_action is not None:
result, obs = execute_code_action(
artifacts,
Expand Down
Loading