vision-agent 0.2.112__tar.gz → 0.2.113__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {vision_agent-0.2.112 → vision_agent-0.2.113}/PKG-INFO +1 -1
- {vision_agent-0.2.112 → vision_agent-0.2.113}/pyproject.toml +1 -1
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/agent/vision_agent_coder.py +11 -3
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/tools/__init__.py +4 -3
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/tools/tool_utils.py +25 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/tools/tools.py +7 -1
- {vision_agent-0.2.112 → vision_agent-0.2.113}/LICENSE +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/README.md +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/__init__.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/agent/__init__.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/agent/agent.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/agent/agent_utils.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/agent/vision_agent.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/agent/vision_agent_coder_prompts.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/agent/vision_agent_prompts.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/clients/__init__.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/clients/http.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/clients/landing_public_api.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/fonts/__init__.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/lmm/__init__.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/lmm/lmm.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/lmm/types.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/tools/meta_tools.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/tools/prompts.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/tools/tools_types.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/utils/__init__.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/utils/exceptions.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/utils/execute.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/utils/image_utils.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/utils/sim.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/utils/type_defs.py +0 -0
- {vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/utils/video.py +0 -0
@@ -128,7 +128,11 @@ def write_plans(
|
|
128
128
|
|
129
129
|
user_request = chat[-1]["content"]
|
130
130
|
context = USER_REQ.format(user_request=user_request)
|
131
|
-
prompt = PLAN.format(
|
131
|
+
prompt = PLAN.format(
|
132
|
+
context=context,
|
133
|
+
tool_desc=tool_desc,
|
134
|
+
feedback=working_memory,
|
135
|
+
)
|
132
136
|
chat[-1]["content"] = prompt
|
133
137
|
return extract_json(model(chat, stream=False)) # type: ignore
|
134
138
|
|
@@ -674,6 +678,7 @@ class VisionAgentCoder(Agent):
|
|
674
678
|
chat: List[Message],
|
675
679
|
test_multi_plan: bool = True,
|
676
680
|
display_visualization: bool = False,
|
681
|
+
customized_tool_names: Optional[List[str]] = None,
|
677
682
|
) -> Dict[str, Any]:
|
678
683
|
"""Chat with VisionAgentCoder and return intermediate information regarding the
|
679
684
|
task.
|
@@ -689,6 +694,8 @@ class VisionAgentCoder(Agent):
|
|
689
694
|
with the first plan.
|
690
695
|
display_visualization (bool): If True, it opens a new window locally to
|
691
696
|
show the image(s) created by visualization code (if there is any).
|
697
|
+
customized_tool_names (List[str]): A list of customized tools for agent to pick and use.
|
698
|
+
If not provided, default to full tool set from vision_agent.tools.
|
692
699
|
|
693
700
|
Returns:
|
694
701
|
Dict[str, Any]: A dictionary containing the code, test, test result, plan,
|
@@ -742,7 +749,9 @@ class VisionAgentCoder(Agent):
|
|
742
749
|
)
|
743
750
|
plans = write_plans(
|
744
751
|
int_chat,
|
745
|
-
T.
|
752
|
+
T.get_tool_descriptions_by_names(
|
753
|
+
customized_tool_names, T.FUNCTION_TOOLS, T.UTIL_TOOLS # type: ignore
|
754
|
+
),
|
746
755
|
format_memory(working_memory),
|
747
756
|
self.planner,
|
748
757
|
)
|
@@ -754,7 +763,6 @@ class VisionAgentCoder(Agent):
|
|
754
763
|
_LOGGER.info(
|
755
764
|
f"\n{tabulate(tabular_data=p_fixed, headers='keys', tablefmt='mixed_grid', maxcolwidths=_MAX_TABULATE_COL_WIDTH)}"
|
756
765
|
)
|
757
|
-
|
758
766
|
tool_infos = retrieve_tools(
|
759
767
|
plans,
|
760
768
|
self.tool_recommender,
|
@@ -1,15 +1,16 @@
|
|
1
1
|
from typing import Callable, List, Optional
|
2
2
|
|
3
|
-
from .meta_tools import
|
4
|
-
META_TOOL_DOCSTRING,
|
5
|
-
)
|
3
|
+
from .meta_tools import META_TOOL_DOCSTRING
|
6
4
|
from .prompts import CHOOSE_PARAMS, SYSTEM_PROMPT
|
5
|
+
from .tool_utils import get_tool_descriptions_by_names
|
7
6
|
from .tools import (
|
7
|
+
FUNCTION_TOOLS,
|
8
8
|
TOOL_DESCRIPTIONS,
|
9
9
|
TOOL_DOCSTRING,
|
10
10
|
TOOLS,
|
11
11
|
TOOLS_DF,
|
12
12
|
TOOLS_INFO,
|
13
|
+
UTIL_TOOLS,
|
13
14
|
UTILITIES_DOCSTRING,
|
14
15
|
blip_image_caption,
|
15
16
|
clip,
|
@@ -142,6 +142,31 @@ def get_tool_descriptions(funcs: List[Callable[..., Any]]) -> str:
|
|
142
142
|
return descriptions
|
143
143
|
|
144
144
|
|
145
|
+
def get_tool_descriptions_by_names(
|
146
|
+
tool_name: Optional[List[str]],
|
147
|
+
funcs: List[Callable[..., Any]],
|
148
|
+
util_funcs: List[
|
149
|
+
Callable[..., Any]
|
150
|
+
], # util_funcs will always be added to the list of functions
|
151
|
+
) -> str:
|
152
|
+
if tool_name is None:
|
153
|
+
return get_tool_descriptions(funcs + util_funcs)
|
154
|
+
|
155
|
+
invalid_names = [
|
156
|
+
name for name in tool_name if name not in {func.__name__ for func in funcs}
|
157
|
+
]
|
158
|
+
|
159
|
+
if invalid_names:
|
160
|
+
raise ValueError(f"Invalid customized tool names: {', '.join(invalid_names)}")
|
161
|
+
|
162
|
+
filtered_funcs = (
|
163
|
+
funcs
|
164
|
+
if not tool_name
|
165
|
+
else [func for func in funcs if func.__name__ in tool_name]
|
166
|
+
)
|
167
|
+
return get_tool_descriptions(filtered_funcs + util_funcs)
|
168
|
+
|
169
|
+
|
145
170
|
def get_tools_df(funcs: List[Callable[..., Any]]) -> pd.DataFrame:
|
146
171
|
data: Dict[str, List[str]] = {"desc": [], "doc": []}
|
147
172
|
|
@@ -1650,7 +1650,7 @@ def florencev2_fine_tuned_object_detection(
|
|
1650
1650
|
return return_data
|
1651
1651
|
|
1652
1652
|
|
1653
|
-
|
1653
|
+
FUNCTION_TOOLS = [
|
1654
1654
|
owl_v2,
|
1655
1655
|
extract_frames,
|
1656
1656
|
ocr,
|
@@ -1671,6 +1671,9 @@ TOOLS = [
|
|
1671
1671
|
generate_pose_image,
|
1672
1672
|
closest_mask_distance,
|
1673
1673
|
closest_box_distance,
|
1674
|
+
]
|
1675
|
+
|
1676
|
+
UTIL_TOOLS = [
|
1674
1677
|
save_json,
|
1675
1678
|
load_image,
|
1676
1679
|
save_image,
|
@@ -1679,6 +1682,9 @@ TOOLS = [
|
|
1679
1682
|
overlay_segmentation_masks,
|
1680
1683
|
overlay_heat_map,
|
1681
1684
|
]
|
1685
|
+
|
1686
|
+
TOOLS = FUNCTION_TOOLS + UTIL_TOOLS
|
1687
|
+
|
1682
1688
|
TOOLS_DF = get_tools_df(TOOLS) # type: ignore
|
1683
1689
|
TOOL_DESCRIPTIONS = get_tool_descriptions(TOOLS) # type: ignore
|
1684
1690
|
TOOL_DOCSTRING = get_tool_documentation(TOOLS) # type: ignore
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{vision_agent-0.2.112 → vision_agent-0.2.113}/vision_agent/agent/vision_agent_coder_prompts.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|