vision-agent 0.2.142__tar.gz → 0.2.144__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {vision_agent-0.2.142 → vision_agent-0.2.144}/PKG-INFO +1 -1
- {vision_agent-0.2.142 → vision_agent-0.2.144}/pyproject.toml +1 -1
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/agent/vision_agent.py +62 -30
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/tools/meta_tools.py +1 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/utils/execute.py +1 -3
- {vision_agent-0.2.142 → vision_agent-0.2.144}/LICENSE +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/README.md +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/__init__.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/agent/__init__.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/agent/agent.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/agent/agent_utils.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/agent/vision_agent_coder.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/agent/vision_agent_coder_prompts.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/agent/vision_agent_prompts.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/clients/__init__.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/clients/http.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/clients/landing_public_api.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/fonts/__init__.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/lmm/__init__.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/lmm/lmm.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/lmm/types.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/tools/__init__.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/tools/prompts.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/tools/tool_utils.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/tools/tools.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/tools/tools_types.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/utils/__init__.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/utils/exceptions.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/utils/image_utils.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/utils/sim.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/utils/type_defs.py +0 -0
- {vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/utils/video.py +0 -0
@@ -30,6 +30,12 @@ WORKSPACE.mkdir(parents=True, exist_ok=True)
|
|
30
30
|
if str(WORKSPACE) != "":
|
31
31
|
os.environ["PYTHONPATH"] = f"{WORKSPACE}:{os.getenv('PYTHONPATH', '')}"
|
32
32
|
|
33
|
+
STUCK_IN_LOOP_ERROR_MESSAGE = {
|
34
|
+
"name": "Error when running conversation agent",
|
35
|
+
"value": "Agent is stuck in conversation loop, exited",
|
36
|
+
"traceback_raw": [],
|
37
|
+
}
|
38
|
+
|
33
39
|
|
34
40
|
class BoilerplateCode:
|
35
41
|
pre_code = [
|
@@ -229,7 +235,7 @@ class VisionAgent(Agent):
|
|
229
235
|
) as code_interpreter:
|
230
236
|
orig_chat = copy.deepcopy(chat)
|
231
237
|
int_chat = copy.deepcopy(chat)
|
232
|
-
|
238
|
+
last_user_message = chat[-1]
|
233
239
|
media_list = []
|
234
240
|
for chat_i in int_chat:
|
235
241
|
if "media" in chat_i:
|
@@ -278,32 +284,9 @@ class VisionAgent(Agent):
|
|
278
284
|
orig_chat.append({"role": "observation", "content": artifacts_loaded})
|
279
285
|
self.streaming_message({"role": "observation", "content": artifacts_loaded})
|
280
286
|
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
if user_code_action is not None:
|
285
|
-
user_result, user_obs = run_code_action(
|
286
|
-
user_code_action, code_interpreter, str(remote_artifacts_path)
|
287
|
-
)
|
288
|
-
if self.verbosity >= 1:
|
289
|
-
_LOGGER.info(user_obs)
|
290
|
-
int_chat.append({"role": "observation", "content": user_obs})
|
291
|
-
orig_chat.append(
|
292
|
-
{
|
293
|
-
"role": "observation",
|
294
|
-
"content": user_obs,
|
295
|
-
"execution": user_result,
|
296
|
-
}
|
297
|
-
)
|
298
|
-
self.streaming_message(
|
299
|
-
{
|
300
|
-
"role": "observation",
|
301
|
-
"content": user_obs,
|
302
|
-
"execution": user_result,
|
303
|
-
"finished": True,
|
304
|
-
}
|
305
|
-
)
|
306
|
-
finished = True
|
287
|
+
finished = self.execute_user_code_action(
|
288
|
+
last_user_message, code_interpreter, remote_artifacts_path
|
289
|
+
)
|
307
290
|
|
308
291
|
while not finished and iterations < self.max_iterations:
|
309
292
|
response = run_conversation(self.agent, int_chat)
|
@@ -316,10 +299,12 @@ class VisionAgent(Agent):
|
|
316
299
|
if last_response == response:
|
317
300
|
response["let_user_respond"] = True
|
318
301
|
self.streaming_message(
|
319
|
-
{
|
302
|
+
{
|
303
|
+
"role": "assistant",
|
304
|
+
"content": "{}",
|
305
|
+
"error": STUCK_IN_LOOP_ERROR_MESSAGE,
|
306
|
+
}
|
320
307
|
)
|
321
|
-
else:
|
322
|
-
self.streaming_message({"role": "assistant", "content": response})
|
323
308
|
|
324
309
|
finished = response["let_user_respond"]
|
325
310
|
|
@@ -327,6 +312,24 @@ class VisionAgent(Agent):
|
|
327
312
|
response["response"], test_multi_plan, customized_tool_names
|
328
313
|
)
|
329
314
|
|
315
|
+
if last_response == response:
|
316
|
+
self.streaming_message(
|
317
|
+
{
|
318
|
+
"role": "assistant",
|
319
|
+
"content": "{}",
|
320
|
+
"error": STUCK_IN_LOOP_ERROR_MESSAGE,
|
321
|
+
"finished": finished and code_action is None,
|
322
|
+
}
|
323
|
+
)
|
324
|
+
else:
|
325
|
+
self.streaming_message(
|
326
|
+
{
|
327
|
+
"role": "assistant",
|
328
|
+
"content": response,
|
329
|
+
"finished": finished and code_action is None,
|
330
|
+
}
|
331
|
+
)
|
332
|
+
|
330
333
|
if code_action is not None:
|
331
334
|
result, obs = run_code_action(
|
332
335
|
code_action, code_interpreter, str(remote_artifacts_path)
|
@@ -353,6 +356,7 @@ class VisionAgent(Agent):
|
|
353
356
|
"role": "observation",
|
354
357
|
"content": obs,
|
355
358
|
"execution": result,
|
359
|
+
"finished": finished,
|
356
360
|
}
|
357
361
|
)
|
358
362
|
|
@@ -367,6 +371,34 @@ class VisionAgent(Agent):
|
|
367
371
|
artifacts.save()
|
368
372
|
return orig_chat, artifacts
|
369
373
|
|
374
|
+
def execute_user_code_action(
|
375
|
+
self,
|
376
|
+
last_user_message: Message,
|
377
|
+
code_interpreter: CodeInterpreter,
|
378
|
+
remote_artifacts_path: Path,
|
379
|
+
) -> bool:
|
380
|
+
if last_user_message["role"] != "user":
|
381
|
+
return False
|
382
|
+
user_code_action = parse_execution(
|
383
|
+
cast(str, last_user_message.get("content", "")), False
|
384
|
+
)
|
385
|
+
if user_code_action is not None:
|
386
|
+
user_result, user_obs = run_code_action(
|
387
|
+
user_code_action, code_interpreter, str(remote_artifacts_path)
|
388
|
+
)
|
389
|
+
if self.verbosity >= 1:
|
390
|
+
_LOGGER.info(user_obs)
|
391
|
+
self.streaming_message(
|
392
|
+
{
|
393
|
+
"role": "observation",
|
394
|
+
"content": user_obs,
|
395
|
+
"execution": user_result,
|
396
|
+
"finished": True,
|
397
|
+
}
|
398
|
+
)
|
399
|
+
return True
|
400
|
+
return False
|
401
|
+
|
370
402
|
def streaming_message(self, message: Dict[str, Any]) -> None:
|
371
403
|
if self.callback_message:
|
372
404
|
self.callback_message(message)
|
@@ -464,9 +464,7 @@ print(f"Vision Agent version: {va_version}")"""
|
|
464
464
|
_LOGGER.info(
|
465
465
|
f"E2BCodeInterpreter (sandbox id: {self.interpreter.sandbox_id}) initialized:\n{sys_versions}"
|
466
466
|
)
|
467
|
-
self.remote_path = Path(
|
468
|
-
remote_path if remote_path is not None else "/home/user"
|
469
|
-
)
|
467
|
+
self.remote_path = Path(remote_path if remote_path is not None else WORKSPACE)
|
470
468
|
|
471
469
|
def close(self, *args: Any, **kwargs: Any) -> None:
|
472
470
|
try:
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{vision_agent-0.2.142 → vision_agent-0.2.144}/vision_agent/agent/vision_agent_coder_prompts.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|