Skip to content

Commit

Permalink
remove array types from printed tool results
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Jul 9, 2024
1 parent ad20576 commit e277003
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,16 @@ def pick_plan(
user_req = chat[-1]["content"]
context = USER_REQ.format(user_request=user_req)
# because the tool picker model gets the image as well, we have to be careful with
# how much text we send it, so we truncate the tool output to 500 characters
# how much text we send it, so we truncate the tool output to 20,000 characters
prompt = PICK_PLAN.format(
context=context,
plans=format_plans(plans),
tool_output=tool_output_str[:500],
tool_output=tool_output_str[:20_000],
)
chat[-1]["content"] = prompt
best_plan = extract_json(model(chat))
if verbosity >= 1:
_LOGGER.info(f"Best plan:\n{best_plan}")
return best_plan["best_plan"], tool_output_str


Expand Down
3 changes: 2 additions & 1 deletion vision_agent/agent/vision_agent_prompts.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
**Instructions**:
1. Write a program to load the media and call each tool and save it's output.
2. Create a dictionary where the keys are the tool name and the values are the tool outputs.
2. Create a dictionary where the keys are the tool name and the values are the tool outputs. Remove any array types from the printed dictionary.
3. Print this final dictionary.
**Example**:
Expand All @@ -87,6 +87,7 @@
owl_v2_out = owl_v2("person", image)
florencev2_out = florencev2_object_detection(image)
loca_out = loca_zero_shot_counting(image)
loca_out = loca_out["count"]
final_out = {{"owl_v2": owl_v2_out, "florencev2_object_detection": florencev2_out, "loca_zero_shot_counting": loca_out}}
print(final_out)
```
Expand Down

0 comments on commit e277003

Please sign in to comment.