vision-agent 0.2.33__tar.gz → 0.2.35__tar.gz

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.
Files changed (36) hide show
  1. {vision_agent-0.2.33 → vision_agent-0.2.35}/PKG-INFO +1 -1
  2. {vision_agent-0.2.33 → vision_agent-0.2.35}/pyproject.toml +1 -1
  3. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/vision_agent.py +105 -50
  4. {vision_agent-0.2.33 → vision_agent-0.2.35}/LICENSE +0 -0
  5. {vision_agent-0.2.33 → vision_agent-0.2.35}/README.md +0 -0
  6. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/__init__.py +0 -0
  7. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/__init__.py +0 -0
  8. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/agent.py +0 -0
  9. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/agent_coder.py +0 -0
  10. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/agent_coder_prompts.py +0 -0
  11. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/data_interpreter.py +0 -0
  12. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/data_interpreter_prompts.py +0 -0
  13. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/easytool.py +0 -0
  14. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/easytool_prompts.py +0 -0
  15. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/easytool_v2.py +0 -0
  16. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/easytool_v2_prompts.py +0 -0
  17. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/reflexion.py +0 -0
  18. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/reflexion_prompts.py +0 -0
  19. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/agent/vision_agent_prompts.py +0 -0
  20. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/fonts/__init__.py +0 -0
  21. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
  22. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/llm/__init__.py +0 -0
  23. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/llm/llm.py +0 -0
  24. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/lmm/__init__.py +0 -0
  25. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/lmm/lmm.py +0 -0
  26. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/tools/__init__.py +0 -0
  27. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/tools/easytool_tools.py +0 -0
  28. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/tools/prompts.py +0 -0
  29. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/tools/tool_utils.py +0 -0
  30. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/tools/tools.py +0 -0
  31. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/utils/__init__.py +0 -0
  32. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/utils/execute.py +0 -0
  33. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/utils/image_utils.py +0 -0
  34. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/utils/sim.py +0 -0
  35. {vision_agent-0.2.33 → vision_agent-0.2.35}/vision_agent/utils/type_defs.py +0 -0
  36. {vision_agent-0.2.33 → vision_agent-0.2.35}/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.33
3
+ Version: 0.2.35
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.33"
7
+ version = "0.2.35"
8
8
  description = "Toolset for Vision Agent"
9
9
  authors = ["Landing AI <dev@landing.ai>"]
10
10
  readme = "README.md"
@@ -126,6 +126,12 @@ def write_and_test_code(
126
126
  max_retries: int = 3,
127
127
  input_media: Optional[Union[str, Path]] = None,
128
128
  ) -> Dict[str, Any]:
129
+ log_progress(
130
+ {
131
+ "type": "code",
132
+ "status": "started",
133
+ }
134
+ )
129
135
  code = extract_code(
130
136
  coder(CODE.format(docstring=tool_info, question=task, feedback=working_memory))
131
137
  )
@@ -141,35 +147,44 @@ def write_and_test_code(
141
147
  )
142
148
  )
143
149
 
150
+ log_progress(
151
+ {
152
+ "type": "code",
153
+ "status": "running",
154
+ "payload": {
155
+ "code": code,
156
+ "test": test,
157
+ },
158
+ }
159
+ )
144
160
  success, result = _EXECUTE.run_isolation(f"{_DEFAULT_IMPORT}\n{code}\n{test}")
161
+ log_progress(
162
+ {
163
+ "type": "code",
164
+ "status": "completed" if success else "failed",
165
+ "payload": {
166
+ "code": code,
167
+ "test": test,
168
+ "result": result,
169
+ },
170
+ }
171
+ )
145
172
  if verbosity == 2:
146
173
  _LOGGER.info("Initial code and tests:")
147
- log_progress(
148
- {
149
- "log": "Code:",
150
- "code": code,
151
- }
152
- )
153
- log_progress(
154
- {
155
- "log": "Test:",
156
- "code": test,
157
- }
158
- )
159
174
  _CONSOLE.print(
160
175
  Syntax(f"{code}\n{test}", "python", theme="gruvbox-dark", line_numbers=True)
161
176
  )
162
- log_progress(
163
- {
164
- "log": "Result:",
165
- "result": result,
166
- }
167
- )
168
177
  _LOGGER.info(f"Initial result: {result}")
169
178
 
170
179
  count = 0
171
180
  new_working_memory = []
172
181
  while not success and count < max_retries:
182
+ log_progress(
183
+ {
184
+ "type": "code",
185
+ "status": "started",
186
+ }
187
+ )
173
188
  fixed_code_and_test = extract_json(
174
189
  debugger(
175
190
  FIX_BUG.format(
@@ -181,18 +196,33 @@ def write_and_test_code(
181
196
  code = extract_code(fixed_code_and_test["code"])
182
197
  if fixed_code_and_test["test"].strip() != "":
183
198
  test = extract_code(fixed_code_and_test["test"])
199
+ log_progress(
200
+ {
201
+ "type": "code",
202
+ "status": "running",
203
+ "payload": {
204
+ "code": code,
205
+ "test": test,
206
+ },
207
+ }
208
+ )
184
209
  new_working_memory.append(
185
210
  {"code": f"{code}\n{test}", "feedback": fixed_code_and_test["reflections"]}
186
211
  )
187
212
 
188
213
  success, result = _EXECUTE.run_isolation(f"{_DEFAULT_IMPORT}\n{code}\n{test}")
214
+ log_progress(
215
+ {
216
+ "type": "code",
217
+ "status": "completed" if success else "failed",
218
+ "payload": {
219
+ "code": code,
220
+ "test": test,
221
+ "result": result,
222
+ },
223
+ }
224
+ )
189
225
  if verbosity == 2:
190
- log_progress(
191
- {
192
- "log": f"Debug attempt {count + 1}, reflection:",
193
- "result": fixed_code_and_test["reflections"],
194
- }
195
- )
196
226
  _LOGGER.info(
197
227
  f"Debug attempt {count + 1}, reflection: {fixed_code_and_test['reflections']}"
198
228
  )
@@ -201,12 +231,6 @@ def write_and_test_code(
201
231
  f"{code}\n{test}", "python", theme="gruvbox-dark", line_numbers=True
202
232
  )
203
233
  )
204
- log_progress(
205
- {
206
- "log": "Debug result:",
207
- "result": result,
208
- }
209
- )
210
234
  _LOGGER.info(f"Debug result: {result}")
211
235
  count += 1
212
236
 
@@ -232,19 +256,30 @@ def retrieve_tools(
232
256
  log_progress: Callable[[Dict[str, Any]], None],
233
257
  verbosity: int = 0,
234
258
  ) -> str:
259
+ log_progress(
260
+ {
261
+ "type": "tools",
262
+ "status": "started",
263
+ }
264
+ )
235
265
  tool_info = []
236
266
  tool_desc = []
267
+ tool_list: List[Dict[str, str]] = []
237
268
  for task in plan:
238
269
  tools = tool_recommender.top_k(task["instructions"], k=2, thresh=0.3)
239
270
  tool_info.extend([e["doc"] for e in tools])
240
271
  tool_desc.extend([e["desc"] for e in tools])
241
- if verbosity == 2:
242
- log_progress(
243
- {
244
- "log": "Retrieved tools:",
245
- "tools": tool_desc,
246
- }
272
+ tool_list.extend(
273
+ {"description": e["desc"], "documentation": e["doc"]} for e in tools
247
274
  )
275
+ log_progress(
276
+ {
277
+ "type": "tools",
278
+ "status": "completed",
279
+ "payload": tool_list,
280
+ }
281
+ )
282
+ if verbosity == 2:
248
283
  _LOGGER.info(f"Tools: {tool_desc}")
249
284
  tool_info_set = set(tool_info)
250
285
  return "\n\n".join(tool_info_set)
@@ -372,6 +407,12 @@ class VisionAgent(Agent):
372
407
  retries = 0
373
408
 
374
409
  while not success and retries < self.max_retries:
410
+ self.log_progress(
411
+ {
412
+ "type": "plans",
413
+ "status": "started",
414
+ }
415
+ )
375
416
  plan_i = write_plan(
376
417
  chat,
377
418
  T.TOOL_DESCRIPTIONS,
@@ -380,13 +421,15 @@ class VisionAgent(Agent):
380
421
  media=[media] if media else None,
381
422
  )
382
423
  plan_i_str = "\n-".join([e["instructions"] for e in plan_i])
424
+
425
+ self.log_progress(
426
+ {
427
+ "type": "plans",
428
+ "status": "completed",
429
+ "payload": plan_i,
430
+ }
431
+ )
383
432
  if self.verbosity >= 1:
384
- self.log_progress(
385
- {
386
- "log": "Going to run the following plan(s) in sequence:\n",
387
- "plan": plan_i,
388
- }
389
- )
390
433
 
391
434
  _LOGGER.info(
392
435
  f"""
@@ -418,6 +461,12 @@ class VisionAgent(Agent):
418
461
  plan.append({"code": code, "test": test, "plan": plan_i})
419
462
 
420
463
  if self_reflection:
464
+ self.log_progress(
465
+ {
466
+ "type": "self_reflection",
467
+ "status": "started",
468
+ }
469
+ )
421
470
  reflection = reflect(
422
471
  chat,
423
472
  FULL_TASK.format(
@@ -427,23 +476,29 @@ class VisionAgent(Agent):
427
476
  self.planner,
428
477
  )
429
478
  if self.verbosity > 0:
430
- self.log_progress(
431
- {
432
- "log": "Reflection:",
433
- "reflection": reflection,
434
- }
435
- )
436
479
  _LOGGER.info(f"Reflection: {reflection}")
437
480
  feedback = cast(str, reflection["feedback"])
438
481
  success = cast(bool, reflection["success"])
482
+ self.log_progress(
483
+ {
484
+ "type": "self_reflection",
485
+ "status": "completed" if success else "failed",
486
+ "payload": reflection,
487
+ }
488
+ )
439
489
  working_memory.append({"code": f"{code}\n{test}", "feedback": feedback})
440
490
 
441
491
  retries += 1
442
492
 
443
493
  self.log_progress(
444
494
  {
445
- "log": f"Vision Agent has concluded this chat.\nSuccess: {success}",
446
- "finished": True,
495
+ "type": "final_code",
496
+ "status": "completed" if success else "failed",
497
+ "payload": {
498
+ "code": code,
499
+ "test": test,
500
+ "result": results["test_result"],
501
+ },
447
502
  }
448
503
  )
449
504
 
File without changes
File without changes