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: add func name to florencev2 fine tune #248

Merged
merged 4 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
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
19 changes: 5 additions & 14 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,6 @@
if str(WORKSPACE) != "":
os.environ["PYTHONPATH"] = f"{WORKSPACE}:{os.getenv('PYTHONPATH', '')}"

STUCK_IN_LOOP_ERROR_MESSAGE = {
"name": "Error when running conversation agent",
"value": "Agent is stuck in conversation loop, exited",
"traceback_raw": [],
}


class BoilerplateCode:
pre_code = [
Expand Down Expand Up @@ -298,13 +292,6 @@ 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",
"content": "{}",
"error": STUCK_IN_LOOP_ERROR_MESSAGE,
}
)

finished = response["let_user_respond"]

Expand All @@ -317,7 +304,11 @@ def chat_with_code(
{
"role": "assistant",
"content": "{}",
"error": STUCK_IN_LOOP_ERROR_MESSAGE,
"error": {
"name": "Error when running conversation agent",
"value": "Agent is stuck in conversation loop, exited",
"traceback_raw": [],
},
"finished": finished and code_action is None,
}
)
Expand Down
7 changes: 6 additions & 1 deletion vision_agent/tools/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,12 @@ def florence2_phrase_grounding(
fine_tuning=FineTuning(job_id=UUID(fine_tune_id)),
)
data = data_obj.model_dump(by_alias=True)
detections = send_inference_request(data, "tools", v2=False)
detections = send_inference_request(
data,
"tools",
v2=False,
metadata_payload={"function_name": "florence2_phrase_grounding"},
)
else:
data = {
"image": image_b64,
Expand Down
Loading