vision-agent 0.2.159__py3-none-any.whl → 0.2.161__py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- vision_agent/agent/vision_agent.py +11 -3
- vision_agent/tools/meta_tools.py +17 -2
- {vision_agent-0.2.159.dist-info → vision_agent-0.2.161.dist-info}/METADATA +1 -1
- {vision_agent-0.2.159.dist-info → vision_agent-0.2.161.dist-info}/RECORD +6 -6
- {vision_agent-0.2.159.dist-info → vision_agent-0.2.161.dist-info}/LICENSE +0 -0
- {vision_agent-0.2.159.dist-info → vision_agent-0.2.161.dist-info}/WHEEL +0 -0
@@ -197,6 +197,7 @@ class VisionAgent(Agent):
|
|
197
197
|
local_artifacts_path: Optional[Union[str, Path]] = None,
|
198
198
|
code_sandbox_runtime: Optional[str] = None,
|
199
199
|
callback_message: Optional[Callable[[Dict[str, Any]], None]] = None,
|
200
|
+
code_interpreter: Optional[CodeInterpreter] = None,
|
200
201
|
) -> None:
|
201
202
|
"""Initialize the VisionAgent.
|
202
203
|
|
@@ -207,12 +208,14 @@ class VisionAgent(Agent):
|
|
207
208
|
local_artifacts_path (Optional[Union[str, Path]]): The path to the local
|
208
209
|
artifacts file.
|
209
210
|
code_sandbox_runtime (Optional[str]): The code sandbox runtime to use.
|
211
|
+
code_interpreter (Optional[CodeInterpreter]): if not None, use this CodeInterpreter
|
210
212
|
"""
|
211
213
|
|
212
214
|
self.agent = AnthropicLMM(temperature=0.0) if agent is None else agent
|
213
215
|
self.max_iterations = 12
|
214
216
|
self.verbosity = verbosity
|
215
217
|
self.code_sandbox_runtime = code_sandbox_runtime
|
218
|
+
self.code_interpreter = code_interpreter
|
216
219
|
self.callback_message = callback_message
|
217
220
|
if self.verbosity >= 1:
|
218
221
|
_LOGGER.setLevel(logging.INFO)
|
@@ -284,9 +287,14 @@ class VisionAgent(Agent):
|
|
284
287
|
# this is setting remote artifacts path
|
285
288
|
artifacts = Artifacts(WORKSPACE / "artifacts.pkl")
|
286
289
|
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
+
code_interpreter = (
|
291
|
+
self.code_interpreter
|
292
|
+
if self.code_interpreter is not None
|
293
|
+
else CodeInterpreterFactory.new_instance(
|
294
|
+
code_sandbox_runtime=self.code_sandbox_runtime,
|
295
|
+
)
|
296
|
+
)
|
297
|
+
with code_interpreter:
|
290
298
|
orig_chat = copy.deepcopy(chat)
|
291
299
|
int_chat = copy.deepcopy(chat)
|
292
300
|
last_user_message = chat[-1]
|
vision_agent/tools/meta_tools.py
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
import base64
|
1
2
|
import difflib
|
2
3
|
import json
|
3
4
|
import os
|
@@ -27,6 +28,7 @@ CURRENT_FILE = None
|
|
27
28
|
CURRENT_LINE = 0
|
28
29
|
DEFAULT_WINDOW_SIZE = 100
|
29
30
|
ZMQ_PORT = os.environ.get("ZMQ_PORT", None)
|
31
|
+
VERBOSITY = os.environ.get("VERBOSITY", 0)
|
30
32
|
|
31
33
|
|
32
34
|
def report_progress_callback(port: int, inp: Dict[str, Any]) -> None:
|
@@ -374,7 +376,7 @@ def generate_vision_code(
|
|
374
376
|
)
|
375
377
|
)
|
376
378
|
else:
|
377
|
-
agent = va.agent.VisionAgentCoder()
|
379
|
+
agent = va.agent.VisionAgentCoder(verbosity=int(VERBOSITY))
|
378
380
|
|
379
381
|
fixed_chat: List[Message] = [{"role": "user", "content": chat, "media": media}]
|
380
382
|
response = agent.chat_with_workflow(
|
@@ -437,7 +439,7 @@ def edit_vision_code(
|
|
437
439
|
return dogs
|
438
440
|
"""
|
439
441
|
|
440
|
-
agent = va.agent.VisionAgentCoder()
|
442
|
+
agent = va.agent.VisionAgentCoder(verbosity=int(VERBOSITY))
|
441
443
|
if name not in artifacts:
|
442
444
|
print(f"[Artifact {name} does not exist]")
|
443
445
|
return f"[Artifact {name} does not exist]"
|
@@ -510,6 +512,19 @@ def write_media_artifact(
|
|
510
512
|
return f"[Invalid media type {type(media)}]"
|
511
513
|
artifacts[name] = media_bytes
|
512
514
|
print(f"[Media {name} saved]")
|
515
|
+
display(
|
516
|
+
{
|
517
|
+
MimeType.APPLICATION_ARTIFACT: json.dumps(
|
518
|
+
{
|
519
|
+
"name": name,
|
520
|
+
"action": "create",
|
521
|
+
"content": base64.b64encode(media_bytes).decode("utf-8"),
|
522
|
+
"contentType": "media_output",
|
523
|
+
}
|
524
|
+
)
|
525
|
+
},
|
526
|
+
raw=True,
|
527
|
+
)
|
513
528
|
return f"[Media {name} saved]"
|
514
529
|
|
515
530
|
|
@@ -2,7 +2,7 @@ vision_agent/__init__.py,sha256=EAb4-f9iyuEYkBrX4ag1syM8Syx8118_t0R6_C34M9w,57
|
|
2
2
|
vision_agent/agent/__init__.py,sha256=NF2LABqHixLvbsOIO-fe-VKZ7awvShLtcT0oQT4eWtI,235
|
3
3
|
vision_agent/agent/agent.py,sha256=2cjIOxEuSJrqbfPXYoV0qER5ihXsPFCoEFJa4jpqan0,597
|
4
4
|
vision_agent/agent/agent_utils.py,sha256=eIpLz2NunEqEsBBrECJaD34-2uY0bsFNnW-XKfqqohs,2518
|
5
|
-
vision_agent/agent/vision_agent.py,sha256=
|
5
|
+
vision_agent/agent/vision_agent.py,sha256=x0oSuQk-rcERUUdZp29FB77Ua-eyQD3fLi_UfmsBTV0,20761
|
6
6
|
vision_agent/agent/vision_agent_coder.py,sha256=2ZoGikn2nakGDfs20XRshZjQUyvbw6l47UhExJAYkqI,38515
|
7
7
|
vision_agent/agent/vision_agent_coder_prompts.py,sha256=BmbTMhth4v1qLexuoSeyo47QQ0kPQvL1pLbCJHMsWDw,18910
|
8
8
|
vision_agent/agent/vision_agent_prompts.py,sha256=LZ9Bnx7ZFkqbNOMqwfdiWZU4niND9Z1ArcFHNSn_jzA,11187
|
@@ -15,7 +15,7 @@ vision_agent/lmm/__init__.py,sha256=jyY1sJb_tYKg5-Wzs3p1lvwFkc-aUNZfMcLy3TOC4Zg,
|
|
15
15
|
vision_agent/lmm/lmm.py,sha256=B5ClgwvbybVCWkf9opDMLjTtJZemUU4KUkQoRxGh43I,16787
|
16
16
|
vision_agent/lmm/types.py,sha256=ZEXR_ptBL0ZwDMTDYkgxUCmSZFmBYPQd2jreNzr_8UY,221
|
17
17
|
vision_agent/tools/__init__.py,sha256=PLVbfTMjKxQlHIRWnq9b785W9a52AXQS_tOa0tkQ0ZY,2420
|
18
|
-
vision_agent/tools/meta_tools.py,sha256=
|
18
|
+
vision_agent/tools/meta_tools.py,sha256=BF5-fVshLhhpck5lJErKxnfPu9YxudBhR7ar_qA9Mjo,25889
|
19
19
|
vision_agent/tools/prompts.py,sha256=V1z4YJLXZuUl_iZ5rY0M5hHc_2tmMEUKr0WocXKGt4E,1430
|
20
20
|
vision_agent/tools/tool_utils.py,sha256=VPGqGJ2ZYEJA6AW7K9X7hQv6vRlMtAQcybE4izdToCw,8196
|
21
21
|
vision_agent/tools/tools.py,sha256=vS1yCk3Fza9eYOTHPFwwroo_ULdw2ztMQMb81x1U5f8,78524
|
@@ -27,7 +27,7 @@ vision_agent/utils/image_utils.py,sha256=rm9GfXvD4JrjnqKrP_f2gfq4SzmqYC0IdC1kKwd
|
|
27
27
|
vision_agent/utils/sim.py,sha256=ZuSS07TUXFGjipmiQoY8TKRmSes7XXCdtU9PI8PC1sw,5609
|
28
28
|
vision_agent/utils/type_defs.py,sha256=BE12s3JNQy36QvauXHjwyeffVh5enfcvd4vTzSwvEZI,1384
|
29
29
|
vision_agent/utils/video.py,sha256=xbMEoRk13l4fHeQlbvMQhLCn8RNndYmsDhUf01TUeR8,4781
|
30
|
-
vision_agent-0.2.
|
31
|
-
vision_agent-0.2.
|
32
|
-
vision_agent-0.2.
|
33
|
-
vision_agent-0.2.
|
30
|
+
vision_agent-0.2.161.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
31
|
+
vision_agent-0.2.161.dist-info/METADATA,sha256=81mQ74IJal478wgLMjkneAVg0kE89VVjX9Wa_hL0lMo,17753
|
32
|
+
vision_agent-0.2.161.dist-info/WHEEL,sha256=7Z8_27uaHI_UZAc4Uox4PpBhQ9Y5_modZXWMxtUi4NU,88
|
33
|
+
vision_agent-0.2.161.dist-info/RECORD,,
|
File without changes
|
File without changes
|