Skip to content

Commit

Permalink
pass verbosity to VisionAgentCoder
Browse files Browse the repository at this point in the history
  • Loading branch information
yzld2002 committed Oct 10, 2024
1 parent b93d62f commit 22e62a3
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions vision_agent/tools/meta_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ def generate_vision_code(
chat: str,
media: List[str],
test_multi_plan: bool = True,
verbosity: int = 0,
custom_tool_names: Optional[List[str]] = None,
) -> str:
"""Generates python code to solve vision based tasks.
Expand All @@ -353,6 +354,7 @@ def generate_vision_code(
chat (str): The chat message from the user.
media (List[str]): The media files to use.
test_multi_plan (bool): Do not change this parameter.
verbosity (int): Do not change this parameter.
custom_tool_names (Optional[List[str]]): Do not change this parameter.
Returns:
Expand All @@ -375,7 +377,7 @@ def detect_dogs(image_path: str):
)
)
else:
agent = va.agent.VisionAgentCoder()
agent = va.agent.VisionAgentCoder(verbosity=verbosity)

fixed_chat: List[Message] = [{"role": "user", "content": chat, "media": media}]
response = agent.chat_with_workflow(
Expand Down Expand Up @@ -410,6 +412,7 @@ def edit_vision_code(
name: str,
chat_history: List[str],
media: List[str],
verbosity: int = 0,
customized_tool_names: Optional[List[str]] = None,
) -> str:
"""Edits python code to solve a vision based task.
Expand All @@ -418,6 +421,7 @@ def edit_vision_code(
artifacts (Artifacts): The artifacts object to save the code to.
name (str): The file path to the code.
chat_history (List[str]): The chat history to used to generate the code.
verbosity (int): Do not change this parameter.
customized_tool_names (Optional[List[str]]): Do not change this parameter.
Returns:
Expand All @@ -438,7 +442,7 @@ def detect_dogs(image_path: str):
return dogs
"""

agent = va.agent.VisionAgentCoder()
agent = va.agent.VisionAgentCoder(verbosity=verbosity)
if name not in artifacts:
print(f"[Artifact {name} does not exist]")
return f"[Artifact {name} does not exist]"
Expand Down Expand Up @@ -641,7 +645,7 @@ def use_extra_vision_agent_args(

def generate_replacer(match: re.Match) -> str:
arg = match.group(1)
out_str = f"generate_vision_code({arg}, test_multi_plan={test_multi_plan}"
out_str = f"generate_vision_code({arg}, verbosity=2, test_multi_plan={test_multi_plan}"
if customized_tool_names is not None:
out_str += f", custom_tool_names={customized_tool_names})"
else:
Expand All @@ -652,7 +656,7 @@ def generate_replacer(match: re.Match) -> str:

def edit_replacer(match: re.Match) -> str:
arg = match.group(1)
out_str = f"edit_vision_code({arg}"
out_str = f"edit_vision_code({arg}, verbosity=2"
if customized_tool_names is not None:
out_str += f", custom_tool_names={customized_tool_names})"
else:
Expand Down

0 comments on commit 22e62a3

Please sign in to comment.