vision-agent 0.2.205__tar.gz → 0.2.206__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {vision_agent-0.2.205 → vision_agent-0.2.206}/PKG-INFO +1 -1
- {vision_agent-0.2.205 → vision_agent-0.2.206}/pyproject.toml +1 -1
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/tools/planner_tools.py +12 -5
- {vision_agent-0.2.205 → vision_agent-0.2.206}/LICENSE +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/README.md +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/.sim_tools/df.csv +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/.sim_tools/embs.npy +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/__init__.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/README.md +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/__init__.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/agent.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/agent_utils.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/types.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_coder.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_coder_prompts.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_coder_prompts_v2.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_coder_v2.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_planner.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_planner_prompts.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_planner_prompts_v2.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_planner_v2.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_prompts.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_prompts_v2.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_v2.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/clients/__init__.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/clients/http.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/clients/landing_public_api.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/fonts/__init__.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/lmm/__init__.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/lmm/lmm.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/lmm/types.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/tools/__init__.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/tools/meta_tools.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/tools/prompts.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/tools/tool_utils.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/tools/tools.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/tools/tools_types.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/utils/__init__.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/utils/exceptions.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/utils/execute.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/utils/image_utils.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/utils/sim.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/utils/type_defs.py +0 -0
- {vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/utils/video.py +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
|
)
|
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
|
{vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_coder_prompts.py
RENAMED
File without changes
|
{vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_coder_prompts_v2.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_planner_prompts.py
RENAMED
File without changes
|
{vision_agent-0.2.205 → vision_agent-0.2.206}/vision_agent/agent/vision_agent_planner_prompts_v2.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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|