vision-agent 0.2.205__py3-none-any.whl → 0.2.206__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vision_agent/tools/planner_tools.py +12 -5
- {vision_agent-0.2.205.dist-info → vision_agent-0.2.206.dist-info}/METADATA +1 -1
- {vision_agent-0.2.205.dist-info → vision_agent-0.2.206.dist-info}/RECORD +5 -5
- {vision_agent-0.2.205.dist-info → vision_agent-0.2.206.dist-info}/LICENSE +0 -0
- {vision_agent-0.2.205.dist-info → vision_agent-0.2.206.dist-info}/WHEEL +0 -0
@@ -2,6 +2,7 @@ import inspect
|
|
2
2
|
import logging
|
3
3
|
import shutil
|
4
4
|
import tempfile
|
5
|
+
from functools import lru_cache
|
5
6
|
from typing import Any, Callable, Dict, List, Optional, Tuple, cast
|
6
7
|
|
7
8
|
import libcst as cst
|
@@ -32,15 +33,19 @@ from vision_agent.utils.execute import (
|
|
32
33
|
MimeType,
|
33
34
|
)
|
34
35
|
from vision_agent.utils.image_utils import convert_to_b64
|
35
|
-
from vision_agent.utils.sim import load_cached_sim
|
36
|
+
from vision_agent.utils.sim import Sim, load_cached_sim
|
36
37
|
|
37
38
|
TOOL_FUNCTIONS = {tool.__name__: tool for tool in T.TOOLS}
|
38
|
-
TOOL_RECOMMENDER = load_cached_sim(T.TOOLS_DF)
|
39
39
|
|
40
40
|
_LOGGER = logging.getLogger(__name__)
|
41
41
|
EXAMPLES = f"\n{TEST_TOOLS_EXAMPLE1}\n{TEST_TOOLS_EXAMPLE2}\n"
|
42
42
|
|
43
43
|
|
44
|
+
@lru_cache(maxsize=1)
|
45
|
+
def get_tool_recommender() -> Sim:
|
46
|
+
return load_cached_sim(T.TOOLS_DF)
|
47
|
+
|
48
|
+
|
44
49
|
def format_tool_output(tool_thoughts: str, tool_docstring: str) -> str:
|
45
50
|
return_str = "[get_tool_for_task output]\n"
|
46
51
|
if tool_thoughts.strip() != "":
|
@@ -52,7 +57,7 @@ def format_tool_output(tool_thoughts: str, tool_docstring: str) -> str:
|
|
52
57
|
|
53
58
|
|
54
59
|
def extract_tool_info(
|
55
|
-
tool_choice_context: Dict[str, Any]
|
60
|
+
tool_choice_context: Dict[str, Any],
|
56
61
|
) -> Tuple[Optional[Callable], str, str, str]:
|
57
62
|
tool_thoughts = tool_choice_context.get("thoughts", "")
|
58
63
|
tool_docstring = ""
|
@@ -124,7 +129,7 @@ def run_tool_testing(
|
|
124
129
|
f"I need models from the {category.strip()} category of tools. {task}"
|
125
130
|
)
|
126
131
|
|
127
|
-
tool_docs =
|
132
|
+
tool_docs = get_tool_recommender().top_k(category, k=10, thresh=0.2)
|
128
133
|
if exclude_tools is not None and len(exclude_tools) > 0:
|
129
134
|
cleaned_tool_docs = []
|
130
135
|
for tool_doc in tool_docs:
|
@@ -246,7 +251,9 @@ def get_tool_for_task(
|
|
246
251
|
context=f"<code>\n{code}\n</code>\n<tool_output>\n{tool_output_str}\n</tool_output>",
|
247
252
|
previous_attempts=error_message,
|
248
253
|
)
|
249
|
-
tool_choice_context_dict = extract_json(
|
254
|
+
tool_choice_context_dict = extract_json(
|
255
|
+
lmm.generate(prompt, media=image_paths) # type: ignore
|
256
|
+
)
|
250
257
|
tool, tool_thoughts, tool_docstring, error_message = extract_tool_info(
|
251
258
|
tool_choice_context_dict
|
252
259
|
)
|
@@ -28,7 +28,7 @@ vision_agent/lmm/lmm.py,sha256=x_nIyDNDZwq4-pfjnJTmcyyJZ2_B7TjkA5jZp88YVO8,17103
|
|
28
28
|
vision_agent/lmm/types.py,sha256=ZEXR_ptBL0ZwDMTDYkgxUCmSZFmBYPQd2jreNzr_8UY,221
|
29
29
|
vision_agent/tools/__init__.py,sha256=xuNt5e4syQH28Vr6EdjLmO9ni9i00yav9yqcPMUx1oo,2878
|
30
30
|
vision_agent/tools/meta_tools.py,sha256=TPeS7QWnc_PmmU_ndiDT03dXbQ5yDSP33E7U8cSj7Ls,28660
|
31
|
-
vision_agent/tools/planner_tools.py,sha256=
|
31
|
+
vision_agent/tools/planner_tools.py,sha256=zlzyCv7tzSOs9W-MjsptaOeM-i4eoA6HxXQWuMc1KkY,13548
|
32
32
|
vision_agent/tools/prompts.py,sha256=V1z4YJLXZuUl_iZ5rY0M5hHc_2tmMEUKr0WocXKGt4E,1430
|
33
33
|
vision_agent/tools/tool_utils.py,sha256=AT7rMcpKwZgIErfgfSvHS0gmtvd8KMHJoHnu5aMlgO0,10259
|
34
34
|
vision_agent/tools/tools.py,sha256=vavzmDuIBHI-g13RMDnr9NALfWpiIvJWkXhD0pnhCuk,87576
|
@@ -40,7 +40,7 @@ vision_agent/utils/image_utils.py,sha256=rRWcxKggPXIRXIY_XT9rZt30ECDRq8zq7FDeXRD
|
|
40
40
|
vision_agent/utils/sim.py,sha256=NZc9QGD6BTY5O29NVbHH7oxDePL_QMnylT1lYcDUn1Y,7437
|
41
41
|
vision_agent/utils/type_defs.py,sha256=BE12s3JNQy36QvauXHjwyeffVh5enfcvd4vTzSwvEZI,1384
|
42
42
|
vision_agent/utils/video.py,sha256=tRcGp4vEnaDycigL1hBO9k0FBPtDH35fCQciVr9GqYI,6013
|
43
|
-
vision_agent-0.2.
|
44
|
-
vision_agent-0.2.
|
45
|
-
vision_agent-0.2.
|
46
|
-
vision_agent-0.2.
|
43
|
+
vision_agent-0.2.206.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
44
|
+
vision_agent-0.2.206.dist-info/METADATA,sha256=3QLRuQR4YwcTTU1y6phpkl7hLXtCIKqxYlYjF1_oNzM,19026
|
45
|
+
vision_agent-0.2.206.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
46
|
+
vision_agent-0.2.206.dist-info/RECORD,,
|
File without changes
|
File without changes
|