vision-agent 0.2.205__tar.gz → 0.2.207__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. {vision_agent-0.2.205 → vision_agent-0.2.207}/PKG-INFO +1 -1
  2. {vision_agent-0.2.205 → vision_agent-0.2.207}/pyproject.toml +1 -1
  3. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_coder_v2.py +2 -2
  4. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/tools/__init__.py +1 -0
  5. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/tools/planner_tools.py +5 -5
  6. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/tools/tools.py +7 -0
  7. {vision_agent-0.2.205 → vision_agent-0.2.207}/LICENSE +0 -0
  8. {vision_agent-0.2.205 → vision_agent-0.2.207}/README.md +0 -0
  9. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/.sim_tools/df.csv +0 -0
  10. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/.sim_tools/embs.npy +0 -0
  11. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/__init__.py +0 -0
  12. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/README.md +0 -0
  13. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/__init__.py +0 -0
  14. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/agent.py +0 -0
  15. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/agent_utils.py +0 -0
  16. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/types.py +0 -0
  17. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent.py +0 -0
  18. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_coder.py +0 -0
  19. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_coder_prompts.py +0 -0
  20. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_coder_prompts_v2.py +0 -0
  21. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_planner.py +0 -0
  22. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_planner_prompts.py +0 -0
  23. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_planner_prompts_v2.py +0 -0
  24. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_planner_v2.py +0 -0
  25. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_prompts.py +0 -0
  26. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_prompts_v2.py +0 -0
  27. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/agent/vision_agent_v2.py +0 -0
  28. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/clients/__init__.py +0 -0
  29. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/clients/http.py +0 -0
  30. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/clients/landing_public_api.py +0 -0
  31. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/fonts/__init__.py +0 -0
  32. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
  33. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/lmm/__init__.py +0 -0
  34. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/lmm/lmm.py +0 -0
  35. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/lmm/types.py +0 -0
  36. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/tools/meta_tools.py +0 -0
  37. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/tools/prompts.py +0 -0
  38. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/tools/tool_utils.py +0 -0
  39. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/tools/tools_types.py +0 -0
  40. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/utils/__init__.py +0 -0
  41. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/utils/exceptions.py +0 -0
  42. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/utils/execute.py +0 -0
  43. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/utils/image_utils.py +0 -0
  44. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/utils/sim.py +0 -0
  45. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/utils/type_defs.py +0 -0
  46. {vision_agent-0.2.205 → vision_agent-0.2.207}/vision_agent/utils/video.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vision-agent
3
- Version: 0.2.205
3
+ Version: 0.2.207
4
4
  Summary: Toolset for Vision Agent
5
5
  Author: Landing AI
6
6
  Author-email: dev@landing.ai
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "vision-agent"
7
- version = "0.2.205"
7
+ version = "0.2.207"
8
8
  description = "Toolset for Vision Agent"
9
9
  authors = ["Landing AI <dev@landing.ai>"]
10
10
  readme = "README.md"
@@ -34,7 +34,7 @@ from vision_agent.utils.execute import (
34
34
  CodeInterpreterFactory,
35
35
  Execution,
36
36
  )
37
- from vision_agent.utils.sim import Sim, load_cached_sim
37
+ from vision_agent.utils.sim import Sim
38
38
 
39
39
  _CONSOLE = Console()
40
40
 
@@ -316,7 +316,7 @@ class VisionAgentCoderV2(AgentCoder):
316
316
  elif isinstance(tool_recommender, Sim):
317
317
  self.tool_recommender = tool_recommender
318
318
  else:
319
- self.tool_recommender = load_cached_sim(T.TOOLS_DF)
319
+ self.tool_recommender = T.get_tool_recommender()
320
320
 
321
321
  self.verbose = verbose
322
322
  self.code_sandbox_runtime = code_sandbox_runtime
@@ -45,6 +45,7 @@ from .tools import (
45
45
  generate_pose_image,
46
46
  generate_soft_edge_image,
47
47
  get_tool_documentation,
48
+ get_tool_recommender,
48
49
  git_vqa_v2,
49
50
  gpt4o_image_vqa,
50
51
  gpt4o_video_vqa,
@@ -32,10 +32,8 @@ from vision_agent.utils.execute import (
32
32
  MimeType,
33
33
  )
34
34
  from vision_agent.utils.image_utils import convert_to_b64
35
- from vision_agent.utils.sim import load_cached_sim
36
35
 
37
36
  TOOL_FUNCTIONS = {tool.__name__: tool for tool in T.TOOLS}
38
- TOOL_RECOMMENDER = load_cached_sim(T.TOOLS_DF)
39
37
 
40
38
  _LOGGER = logging.getLogger(__name__)
41
39
  EXAMPLES = f"\n{TEST_TOOLS_EXAMPLE1}\n{TEST_TOOLS_EXAMPLE2}\n"
@@ -52,7 +50,7 @@ def format_tool_output(tool_thoughts: str, tool_docstring: str) -> str:
52
50
 
53
51
 
54
52
  def extract_tool_info(
55
- tool_choice_context: Dict[str, Any]
53
+ tool_choice_context: Dict[str, Any],
56
54
  ) -> Tuple[Optional[Callable], str, str, str]:
57
55
  tool_thoughts = tool_choice_context.get("thoughts", "")
58
56
  tool_docstring = ""
@@ -124,7 +122,7 @@ def run_tool_testing(
124
122
  f"I need models from the {category.strip()} category of tools. {task}"
125
123
  )
126
124
 
127
- tool_docs = TOOL_RECOMMENDER.top_k(category, k=10, thresh=0.2)
125
+ tool_docs = T.get_tool_recommender().top_k(category, k=10, thresh=0.2)
128
126
  if exclude_tools is not None and len(exclude_tools) > 0:
129
127
  cleaned_tool_docs = []
130
128
  for tool_doc in tool_docs:
@@ -246,7 +244,9 @@ def get_tool_for_task(
246
244
  context=f"<code>\n{code}\n</code>\n<tool_output>\n{tool_output_str}\n</tool_output>",
247
245
  previous_attempts=error_message,
248
246
  )
249
- tool_choice_context_dict = extract_json(lmm.generate(prompt, media=image_paths)) # type: ignore
247
+ tool_choice_context_dict = extract_json(
248
+ lmm.generate(prompt, media=image_paths) # type: ignore
249
+ )
250
250
  tool, tool_thoughts, tool_docstring, error_message = extract_tool_info(
251
251
  tool_choice_context_dict
252
252
  )
@@ -4,6 +4,7 @@ import logging
4
4
  import os
5
5
  import tempfile
6
6
  import urllib.request
7
+ from functools import lru_cache
7
8
  from importlib import resources
8
9
  from pathlib import Path
9
10
  from typing import Any, Dict, List, Optional, Tuple, Union, cast
@@ -45,6 +46,7 @@ from vision_agent.utils.image_utils import (
45
46
  rle_decode,
46
47
  rle_decode_array,
47
48
  )
49
+ from vision_agent.utils.sim import Sim, load_cached_sim
48
50
  from vision_agent.utils.video import (
49
51
  extract_frames_from_video,
50
52
  frames_to_bytes,
@@ -80,6 +82,11 @@ _OCR_URL = "https://app.landing.ai/ocr/v1/detect-text"
80
82
  _LOGGER = logging.getLogger(__name__)
81
83
 
82
84
 
85
+ @lru_cache(maxsize=1)
86
+ def get_tool_recommender() -> Sim:
87
+ return load_cached_sim(TOOLS_DF)
88
+
89
+
83
90
  def grounding_dino(
84
91
  prompt: str,
85
92
  image: np.ndarray,
File without changes
File without changes