vision-agent 0.2.223__py3-none-any.whl → 0.2.224__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25,6 +25,10 @@ _LND_API_URL = f"{_LND_BASE_URL}/v1/agent/model"
25
25
  _LND_API_URL_v2 = f"{_LND_BASE_URL}/v1/tools"
26
26
 
27
27
 
28
+ def should_report_tool_traces() -> bool:
29
+ return bool(os.environ.get("REPORT_TOOL_TRACES", False))
30
+
31
+
28
32
  class ToolCallTrace(BaseModel):
29
33
  endpoint_url: str
30
34
  type: str
@@ -251,7 +255,7 @@ def _call_post(
251
255
  tool_call_trace.response = result
252
256
  return result
253
257
  finally:
254
- if tool_call_trace is not None:
258
+ if tool_call_trace is not None and should_report_tool_traces():
255
259
  trace = tool_call_trace.model_dump()
256
260
  display({MimeType.APPLICATION_JSON: trace}, raw=True)
257
261
 
@@ -32,6 +32,7 @@ from vision_agent.tools.tool_utils import (
32
32
  nms,
33
33
  send_inference_request,
34
34
  send_task_inference_request,
35
+ should_report_tool_traces,
35
36
  single_nms,
36
37
  )
37
38
  from vision_agent.tools.tools_types import JobStatus
@@ -94,6 +95,9 @@ def _display_tool_trace(
94
95
  # such as video bytes, which can be slow. Since this is calculated inside the
95
96
  # function we can't capture it with a decarator without adding it as a return value
96
97
  # which would change the function signature and affect the agent.
98
+ if not should_report_tool_traces():
99
+ return
100
+
97
101
  files_in_b64: List[Tuple[str, str]]
98
102
  if isinstance(files, str):
99
103
  files_in_b64 = [("images", files)]
@@ -264,7 +268,7 @@ def od_sam2_video_tracking(
264
268
  image_size = frames[0].shape[:2]
265
269
 
266
270
  def _transform_detections(
267
- input_list: List[Optional[List[Dict[str, Any]]]]
271
+ input_list: List[Optional[List[Dict[str, Any]]]],
268
272
  ) -> List[Optional[Dict[str, Any]]]:
269
273
  output_list: List[Optional[Dict[str, Any]]] = []
270
274
 
@@ -2243,15 +2247,17 @@ def save_image(image: np.ndarray, file_path: str) -> None:
2243
2247
  >>> save_image(image)
2244
2248
  """
2245
2249
  Path(file_path).parent.mkdir(parents=True, exist_ok=True)
2246
- from IPython.display import display
2247
-
2248
2250
  if not isinstance(image, np.ndarray) or (
2249
2251
  image.shape[0] == 0 and image.shape[1] == 0
2250
2252
  ):
2251
2253
  raise ValueError("The image is not a valid NumPy array with shape (H, W, C)")
2252
2254
 
2253
2255
  pil_image = Image.fromarray(image.astype(np.uint8)).convert("RGB")
2254
- display(pil_image)
2256
+ if should_report_tool_traces():
2257
+ from IPython.display import display
2258
+
2259
+ display(pil_image)
2260
+
2255
2261
  pil_image.save(file_path)
2256
2262
 
2257
2263
 
@@ -2302,6 +2308,9 @@ def save_video(
2302
2308
 
2303
2309
  def _save_video_to_result(video_uri: str) -> None:
2304
2310
  """Saves a video into the result of the code execution (as an intermediate output)."""
2311
+ if not should_report_tool_traces():
2312
+ return
2313
+
2305
2314
  from IPython.display import display
2306
2315
 
2307
2316
  serializer = FileSerializer(video_uri)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vision-agent
3
- Version: 0.2.223
3
+ Version: 0.2.224
4
4
  Summary: Toolset for Vision Agent
5
5
  Author: Landing AI
6
6
  Author-email: dev@landing.ai
@@ -30,8 +30,8 @@ vision_agent/tools/__init__.py,sha256=15O7eQVn0bitmzUO5OxKdA618PoiLt6Z02gmKsSNMF
30
30
  vision_agent/tools/meta_tools.py,sha256=TPeS7QWnc_PmmU_ndiDT03dXbQ5yDSP33E7U8cSj7Ls,28660
31
31
  vision_agent/tools/planner_tools.py,sha256=CvaJ2vGM8O_CYvsoSk1avxAMqpIu3tv4C2bY0p1X-X4,13519
32
32
  vision_agent/tools/prompts.py,sha256=V1z4YJLXZuUl_iZ5rY0M5hHc_2tmMEUKr0WocXKGt4E,1430
33
- vision_agent/tools/tool_utils.py,sha256=LAnrb_nY6PNVamqJahRN-J0cuOy4gsKvCtSuXJf0RsI,10075
34
- vision_agent/tools/tools.py,sha256=0v7EgsLEN19RoTQIamwXVFdmLZpSIE5mLNNQJMJLWEE,91117
33
+ vision_agent/tools/tool_utils.py,sha256=q9cqXO2AvigUdO1krjnOy8o0goYhgS6eILl6-F5Kxyk,10211
34
+ vision_agent/tools/tools.py,sha256=60S5ItFG9yKzVb8FU8oLFj_aouDg2-4vlieDbSgfPdQ,91306
35
35
  vision_agent/tools/tools_types.py,sha256=8hYf2OZhI58gvf65KGaeGkt4EQ56nwLFqIQDPHioOBc,2339
36
36
  vision_agent/utils/__init__.py,sha256=QKk4zVjMwGxQI0MQ-aZZA50N-qItxRY4EB9CwQkZ2HY,185
37
37
  vision_agent/utils/exceptions.py,sha256=booSPSuoULF7OXRr_YbC4dtKt6gM_HyiFQHBuaW86C4,2052
@@ -40,7 +40,7 @@ vision_agent/utils/image_utils.py,sha256=z_ONgcza125B10NkoGwPOzXnL470bpTWZbkB16N
40
40
  vision_agent/utils/sim.py,sha256=znsInUDrsyBi3OlgAlV3rDn5UQQRfJAWXTXm7D7eJA8,9125
41
41
  vision_agent/utils/type_defs.py,sha256=BE12s3JNQy36QvauXHjwyeffVh5enfcvd4vTzSwvEZI,1384
42
42
  vision_agent/utils/video.py,sha256=e1VwKhXzzlC5LcFMyrcQYrPnpnX4wxDpnQ-76sB4jgM,6001
43
- vision_agent-0.2.223.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
44
- vision_agent-0.2.223.dist-info/METADATA,sha256=BFEkk8Vrf-Q7xG9OrGWdw84Kr9F8x2l-qAIGcsN7zhE,20039
45
- vision_agent-0.2.223.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
46
- vision_agent-0.2.223.dist-info/RECORD,,
43
+ vision_agent-0.2.224.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
44
+ vision_agent-0.2.224.dist-info/METADATA,sha256=wT49_byW9-Oz6-1eSlP3cW_AFGbWaxtKrYsGB4nT62o,20039
45
+ vision_agent-0.2.224.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
46
+ vision_agent-0.2.224.dist-info/RECORD,,