vision-agent 0.2.159__tar.gz → 0.2.161__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {vision_agent-0.2.159 → vision_agent-0.2.161}/PKG-INFO +1 -1
- {vision_agent-0.2.159 → vision_agent-0.2.161}/pyproject.toml +1 -1
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/agent/vision_agent.py +11 -3
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/tools/meta_tools.py +17 -2
- {vision_agent-0.2.159 → vision_agent-0.2.161}/LICENSE +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/README.md +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/__init__.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/agent/__init__.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/agent/agent.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/agent/agent_utils.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/agent/vision_agent_coder.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/agent/vision_agent_coder_prompts.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/agent/vision_agent_prompts.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/clients/__init__.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/clients/http.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/clients/landing_public_api.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/fonts/__init__.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/lmm/__init__.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/lmm/lmm.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/lmm/types.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/tools/__init__.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/tools/prompts.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/tools/tool_utils.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/tools/tools.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/tools/tools_types.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/utils/__init__.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/utils/exceptions.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/utils/execute.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/utils/image_utils.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/utils/sim.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/utils/type_defs.py +0 -0
- {vision_agent-0.2.159 → vision_agent-0.2.161}/vision_agent/utils/video.py +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]
|
@@ -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
|
|
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.159 → vision_agent-0.2.161}/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
|
File without changes
|