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

feat: error handling for conversation agent #246

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
21 changes: 19 additions & 2 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -314,15 +314,32 @@ def chat_with_code(

# sometimes it gets stuck in a loop, so we force it to exit
if last_response == response:
response["let_user_respond"] = True
self.streaming_message(
{"role": "assistant", "error": "Stuck in loop"}
{
"role": "assistant",
"finished": True,
"content": "{}",
"error": {
"name": "Error when running conversation agent",
"value": "Agent is stuck in conversation loop, exited",
"traceback_raw": [],
},
}
)
break
elif response["let_user_respond"]:
self.streaming_message(
{"role": "assistant", "content": response, "finished": True}
)
break
else:
self.streaming_message({"role": "assistant", "content": response})

<<<<<<< Updated upstream
finished = response["let_user_respond"]

=======
>>>>>>> Stashed changes
wuyiqunLu marked this conversation as resolved.
Show resolved Hide resolved
code_action = parse_execution(
response["response"], test_multi_plan, customized_tool_names
)
Expand Down
1 change: 1 addition & 0 deletions vision_agent/tools/meta_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ def detect_dogs(image_path: str):

agent = va.agent.VisionAgentCoder()
if name not in artifacts:
print(f"[Artifact {name} does not exist]")
return f"[Artifact {name} does not exist]"

code = artifacts[name]
Expand Down
Loading