Skip to content

Commit

Permalink
make it easier to use custom tools
Browse files Browse the repository at this point in the history
  • Loading branch information
dillonalaird committed Apr 23, 2024
1 parent 90ad178 commit 88af0b4
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions vision_agent/agent/vision_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from PIL import Image
from tabulate import tabulate

from vision_agent.image_utils import overlay_bboxes, overlay_masks, overlay_heat_map
from vision_agent.image_utils import overlay_bboxes, overlay_heat_map, overlay_masks
from vision_agent.llm import LLM, OpenAILLM
from vision_agent.lmm import LMM, OpenAILMM
from vision_agent.tools import TOOLS
Expand Down Expand Up @@ -492,20 +492,20 @@ def chat_with_workflow(
if image:
question += f" Image name: {image}"
if reference_data:
if not (
"image" in reference_data
and ("mask" in reference_data or "bbox" in reference_data)
):
raise ValueError(
f"Reference data must contain 'image' and a visual prompt which can be 'mask' or 'bbox'. but got {reference_data}"
)
visual_prompt_data = (
f"Reference mask: {reference_data['mask']}"
question += (
f" Reference image: {reference_data['image']}"
if "image" in reference_data
else ""
)
question += (
f" Reference mask: {reference_data['mask']}"
if "mask" in reference_data
else f"Reference bbox: {reference_data['bbox']}"
else ""
)
question += (
f" Reference image: {reference_data['image']}, {visual_prompt_data}"
f" Reference bbox: {reference_data['bbox']}"
if "bbox" in reference_data
else ""
)

reflections = ""
Expand Down

0 comments on commit 88af0b4

Please sign in to comment.