vision-agent 0.2.26__py3-none-any.whl → 0.2.27__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.
@@ -165,6 +165,7 @@ def write_and_exec_code(
165
165
  tool_info: str,
166
166
  exec: Execute,
167
167
  retrieved_ltm: str,
168
+ log_progress: Callable[..., str],
168
169
  max_retry: int = 3,
169
170
  verbosity: int = 0,
170
171
  ) -> Tuple[bool, str, str, Dict[str, List[str]]]:
@@ -178,6 +179,7 @@ def write_and_exec_code(
178
179
  success, result = exec.run_isolation(code)
179
180
  if verbosity == 2:
180
181
  _CONSOLE.print(Syntax(code, "python", theme="gruvbox-dark", line_numbers=True))
182
+ log_progress(f"\tCode success: {success}\n\tResult: {str(result)}", code)
181
183
  _LOGGER.info(f"\tCode success: {success}, result: {str(result)}")
182
184
  working_memory: Dict[str, List[str]] = {}
183
185
  while not success and counter < max_retry:
@@ -204,6 +206,7 @@ def write_and_exec_code(
204
206
  _CONSOLE.print(
205
207
  Syntax(code, "python", theme="gruvbox-dark", line_numbers=True)
206
208
  )
209
+ log_progress(f"\tDebugging reflection: {reflection}\n\tResult: {result}")
207
210
  _LOGGER.info(f"\tDebugging reflection: {reflection}, result: {result}")
208
211
 
209
212
  if success:
@@ -224,6 +227,7 @@ def run_plan(
224
227
  exec: Execute,
225
228
  code: str,
226
229
  tool_recommender: Sim,
230
+ log_progress: Callable[..., str],
227
231
  long_term_memory: Optional[Sim] = None,
228
232
  verbosity: int = 0,
229
233
  ) -> Tuple[str, str, List[Dict[str, Any]], Dict[str, List[str]]]:
@@ -234,6 +238,10 @@ def run_plan(
234
238
  working_memory: Dict[str, List[str]] = {}
235
239
 
236
240
  for task in active_plan:
241
+ log_progress(
242
+ f"""Going to run the following task(s) in sequence:
243
+ {tabulate(tabular_data=[task], headers="keys", tablefmt="mixed_grid", maxcolwidths=_MAX_TABULATE_COL_WIDTH)}"""
244
+ )
237
245
  _LOGGER.info(
238
246
  f"""
239
247
  {tabulate(tabular_data=[task], headers="keys", tablefmt="mixed_grid", maxcolwidths=_MAX_TABULATE_COL_WIDTH)}"""
@@ -242,6 +250,7 @@ def run_plan(
242
250
  tool_info = "\n".join([e["doc"] for e in tools])
243
251
 
244
252
  if verbosity == 2:
253
+ log_progress(f"Tools retrieved: {[e['desc'] for e in tools]}")
245
254
  _LOGGER.info(f"Tools retrieved: {[e['desc'] for e in tools]}")
246
255
 
247
256
  if long_term_memory is not None:
@@ -258,6 +267,7 @@ def run_plan(
258
267
  tool_info,
259
268
  exec,
260
269
  retrieved_ltm,
270
+ log_progress,
261
271
  verbosity=verbosity,
262
272
  )
263
273
  if task["type"] == "code":
@@ -271,6 +281,8 @@ def run_plan(
271
281
  _CONSOLE.print(
272
282
  Syntax(code, "python", theme="gruvbox-dark", line_numbers=True)
273
283
  )
284
+
285
+ log_progress(f"\tCode success: {success}\n\tResult: {str(result)}")
274
286
  _LOGGER.info(f"\tCode success: {success} result: {str(result)}")
275
287
 
276
288
  task["success"] = success
@@ -308,10 +320,12 @@ class VisionAgentV2(Agent):
308
320
  tool_recommender: Optional[Sim] = None,
309
321
  long_term_memory: Optional[Sim] = None,
310
322
  verbosity: int = 0,
323
+ report_progress_callback: Optional[Callable[..., Any]] = None,
311
324
  ) -> None:
312
325
  self.planner = OpenAILLM(temperature=0.0, json_mode=True)
313
326
  self.coder = OpenAILLM(temperature=0.0)
314
327
  self.exec = Execute(timeout=timeout)
328
+ self.report_progress_callback = report_progress_callback
315
329
  if tool_recommender is None:
316
330
  self.tool_recommender = Sim(TOOLS_DF, sim_key="desc")
317
331
  else:
@@ -361,6 +375,10 @@ class VisionAgentV2(Agent):
361
375
  working_code = task["code"]
362
376
 
363
377
  user_req, plan = write_plan(chat, plan, TOOL_DESCRIPTIONS, self.planner)
378
+ self.log_progress(
379
+ f"""Plan:
380
+ {tabulate(tabular_data=plan, headers="keys", tablefmt="mixed_grid", maxcolwidths=_MAX_TABULATE_COL_WIDTH)}"""
381
+ )
364
382
  _LOGGER.info(
365
383
  f"""Plan:
366
384
  {tabulate(tabular_data=plan, headers="keys", tablefmt="mixed_grid", maxcolwidths=_MAX_TABULATE_COL_WIDTH)}"""
@@ -379,6 +397,7 @@ class VisionAgentV2(Agent):
379
397
  self.exec,
380
398
  working_code,
381
399
  self.tool_recommender,
400
+ self.log_progress,
382
401
  self.long_term_memory,
383
402
  self.verbosity,
384
403
  )
@@ -393,6 +412,9 @@ class VisionAgentV2(Agent):
393
412
 
394
413
  retries += 1
395
414
 
415
+ self.log_progress("The Vision Agent V2 has concluded this chat.")
416
+ self.log_progress(f"<ANSWER>Plan success: {success}</ANSWER>")
417
+
396
418
  return {
397
419
  "code": working_code,
398
420
  "test": working_test,
@@ -401,5 +423,7 @@ class VisionAgentV2(Agent):
401
423
  "plan": plan,
402
424
  }
403
425
 
404
- def log_progress(self, description: str) -> None:
426
+ def log_progress(self, description: str, code: Optional[str] = "") -> None:
427
+ if self.report_progress_callback is not None:
428
+ self.report_progress_callback(description, code)
405
429
  pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: vision-agent
3
- Version: 0.2.26
3
+ Version: 0.2.27
4
4
  Summary: Toolset for Vision Agent
5
5
  Author: Landing AI
6
6
  Author-email: dev@landing.ai
@@ -9,7 +9,7 @@ vision_agent/agent/reflexion.py,sha256=4gz30BuFMeGxSsTzoDV4p91yE0R8LISXp28IaOI6w
9
9
  vision_agent/agent/reflexion_prompts.py,sha256=G7UAeNz_g2qCb2yN6OaIC7bQVUkda4m3z42EG8wAyfE,9342
10
10
  vision_agent/agent/vision_agent.py,sha256=pnx7gtTPazR7Dck5_kfZC3S3QWKu4e28YVigzOicOX0,27130
11
11
  vision_agent/agent/vision_agent_prompts.py,sha256=MZSIwovYgB-f-kdJ6btaNDVXptJn47bfOL3-Zn6NiC0,8573
12
- vision_agent/agent/vision_agent_v2.py,sha256=XQy9Bh-nMiBOmld4ufz-SGcGQ0ab9S060mYITsrnQEg,13230
12
+ vision_agent/agent/vision_agent_v2.py,sha256=eQS5w0aURWWCc0x1dqlApep65DKttePR-ZQPSxkWuvw,14487
13
13
  vision_agent/agent/vision_agent_v2_prompts.py,sha256=b_0BMq6GrbGfl09MHrv4mj-mqyE1FxMl3Xq44qD4S1E,6161
14
14
  vision_agent/agent/vision_agent_v3.py,sha256=EGA3zQKVIVdDlZOWwZNgueMnlqKqNwGvSc9v_XM-b34,9696
15
15
  vision_agent/agent/vision_agent_v3_prompts.py,sha256=LRZBKObeb0Bs48vo7vtB2M8loPO1lQzruH-3IiMS5ts,7484
@@ -30,7 +30,7 @@ vision_agent/utils/image_utils.py,sha256=_cdiS5YrLzqkq_ZgFUO897m5M4_SCIThwUy4lOk
30
30
  vision_agent/utils/sim.py,sha256=oUZ-6eu8Io-UNt9GXJ0XRKtP-Wc0sPWVzYGVpB2yDFk,3001
31
31
  vision_agent/utils/type_defs.py,sha256=BlI8ywWHAplC7kYWLvt4AOdnKpEW3qWEFm-GEOSkrFQ,1792
32
32
  vision_agent/utils/video.py,sha256=xTElFSFp1Jw4ulOMnk81Vxsh-9dTxcWUO6P9fzEi3AM,7653
33
- vision_agent-0.2.26.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
34
- vision_agent-0.2.26.dist-info/METADATA,sha256=4iVEn5ndUUHrEduVwmUy8IJ09YKp6k9BRSrCdpSaUtA,9212
35
- vision_agent-0.2.26.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
36
- vision_agent-0.2.26.dist-info/RECORD,,
33
+ vision_agent-0.2.27.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
34
+ vision_agent-0.2.27.dist-info/METADATA,sha256=rnWYNUve9b4hBvZp5hlNCz_B_7PMb5mhjj_zo6al-O0,9212
35
+ vision_agent-0.2.27.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
36
+ vision_agent-0.2.27.dist-info/RECORD,,