vision-agent 0.2.33__tar.gz → 0.2.34__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.34}/PKG-INFO +1 -1
  2. {vision_agent-0.2.33 → vision_agent-0.2.34}/pyproject.toml +1 -1
  3. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/vision_agent.py +101 -50
  4. {vision_agent-0.2.33 → vision_agent-0.2.34}/LICENSE +0 -0
  5. {vision_agent-0.2.33 → vision_agent-0.2.34}/README.md +0 -0
  6. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/__init__.py +0 -0
  7. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/__init__.py +0 -0
  8. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/agent.py +0 -0
  9. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/agent_coder.py +0 -0
  10. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/agent_coder_prompts.py +0 -0
  11. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/data_interpreter.py +0 -0
  12. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/data_interpreter_prompts.py +0 -0
  13. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/easytool.py +0 -0
  14. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/easytool_prompts.py +0 -0
  15. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/easytool_v2.py +0 -0
  16. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/easytool_v2_prompts.py +0 -0
  17. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/reflexion.py +0 -0
  18. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/reflexion_prompts.py +0 -0
  19. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/agent/vision_agent_prompts.py +0 -0
  20. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/fonts/__init__.py +0 -0
  21. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
  22. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/llm/__init__.py +0 -0
  23. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/llm/llm.py +0 -0
  24. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/lmm/__init__.py +0 -0
  25. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/lmm/lmm.py +0 -0
  26. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/tools/__init__.py +0 -0
  27. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/tools/easytool_tools.py +0 -0
  28. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/tools/prompts.py +0 -0
  29. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/tools/tool_utils.py +0 -0
  30. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/tools/tools.py +0 -0
  31. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/utils/__init__.py +0 -0
  32. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/utils/execute.py +0 -0
  33. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/utils/image_utils.py +0 -0
  34. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/utils/sim.py +0 -0
  35. {vision_agent-0.2.33 → vision_agent-0.2.34}/vision_agent/utils/type_defs.py +0 -0
  36. {vision_agent-0.2.33 → vision_agent-0.2.34}/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.34
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.34"
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,26 @@ 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 = []
237
267
  for task in plan:
238
268
  tools = tool_recommender.top_k(task["instructions"], k=2, thresh=0.3)
239
269
  tool_info.extend([e["doc"] for e in tools])
240
270
  tool_desc.extend([e["desc"] for e in tools])
271
+ log_progress(
272
+ {
273
+ "type": "tools",
274
+ "status": "completed",
275
+ "payload": tools,
276
+ }
277
+ )
241
278
  if verbosity == 2:
242
- log_progress(
243
- {
244
- "log": "Retrieved tools:",
245
- "tools": tool_desc,
246
- }
247
- )
248
279
  _LOGGER.info(f"Tools: {tool_desc}")
249
280
  tool_info_set = set(tool_info)
250
281
  return "\n\n".join(tool_info_set)
@@ -372,6 +403,12 @@ class VisionAgent(Agent):
372
403
  retries = 0
373
404
 
374
405
  while not success and retries < self.max_retries:
406
+ self.log_progress(
407
+ {
408
+ "type": "plans",
409
+ "status": "started",
410
+ }
411
+ )
375
412
  plan_i = write_plan(
376
413
  chat,
377
414
  T.TOOL_DESCRIPTIONS,
@@ -380,13 +417,15 @@ class VisionAgent(Agent):
380
417
  media=[media] if media else None,
381
418
  )
382
419
  plan_i_str = "\n-".join([e["instructions"] for e in plan_i])
420
+
421
+ self.log_progress(
422
+ {
423
+ "type": "plans",
424
+ "status": "completed",
425
+ "payload": plan_i,
426
+ }
427
+ )
383
428
  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
429
 
391
430
  _LOGGER.info(
392
431
  f"""
@@ -418,6 +457,12 @@ class VisionAgent(Agent):
418
457
  plan.append({"code": code, "test": test, "plan": plan_i})
419
458
 
420
459
  if self_reflection:
460
+ self.log_progress(
461
+ {
462
+ "type": "self_reflection",
463
+ "status": "started",
464
+ }
465
+ )
421
466
  reflection = reflect(
422
467
  chat,
423
468
  FULL_TASK.format(
@@ -427,23 +472,29 @@ class VisionAgent(Agent):
427
472
  self.planner,
428
473
  )
429
474
  if self.verbosity > 0:
430
- self.log_progress(
431
- {
432
- "log": "Reflection:",
433
- "reflection": reflection,
434
- }
435
- )
436
475
  _LOGGER.info(f"Reflection: {reflection}")
437
476
  feedback = cast(str, reflection["feedback"])
438
477
  success = cast(bool, reflection["success"])
478
+ self.log_progress(
479
+ {
480
+ "type": "self_reflection",
481
+ "status": "completed" if success else "failed",
482
+ "payload": reflection,
483
+ }
484
+ )
439
485
  working_memory.append({"code": f"{code}\n{test}", "feedback": feedback})
440
486
 
441
487
  retries += 1
442
488
 
443
489
  self.log_progress(
444
490
  {
445
- "log": f"Vision Agent has concluded this chat.\nSuccess: {success}",
446
- "finished": True,
491
+ "type": "final_code",
492
+ "status": "completed" if success else "failed",
493
+ "payload": {
494
+ "code": code,
495
+ "test": test,
496
+ "result": results["test_result"],
497
+ },
447
498
  }
448
499
  )
449
500
 
File without changes
File without changes