vision-agent 0.2.135__tar.gz → 0.2.136__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {vision_agent-0.2.135 → vision_agent-0.2.136}/PKG-INFO +1 -1
- {vision_agent-0.2.135 → vision_agent-0.2.136}/pyproject.toml +1 -1
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/agent/vision_agent.py +2 -21
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/tools/meta_tools.py +35 -8
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/utils/execute.py +4 -4
- {vision_agent-0.2.135 → vision_agent-0.2.136}/LICENSE +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/README.md +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/__init__.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/agent/__init__.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/agent/agent.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/agent/agent_utils.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/agent/vision_agent_coder.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/agent/vision_agent_coder_prompts.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/agent/vision_agent_prompts.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/clients/__init__.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/clients/http.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/clients/landing_public_api.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/fonts/__init__.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/lmm/__init__.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/lmm/lmm.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/lmm/types.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/tools/__init__.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/tools/prompts.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/tools/tool_utils.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/tools/tools.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/tools/tools_types.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/utils/__init__.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/utils/exceptions.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/utils/image_utils.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/utils/sim.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/utils/type_defs.py +0 -0
- {vision_agent-0.2.135 → vision_agent-0.2.136}/vision_agent/utils/video.py +0 -0
@@ -13,9 +13,8 @@ from vision_agent.agent.vision_agent_prompts import (
|
|
13
13
|
VA_CODE,
|
14
14
|
)
|
15
15
|
from vision_agent.lmm import LMM, Message, OpenAILMM
|
16
|
-
from vision_agent.tools import META_TOOL_DOCSTRING
|
16
|
+
from vision_agent.tools import META_TOOL_DOCSTRING
|
17
17
|
from vision_agent.tools.meta_tools import Artifacts, use_extra_vision_agent_args
|
18
|
-
from vision_agent.tools.tools import extract_frames, save_video
|
19
18
|
from vision_agent.utils import CodeInterpreterFactory
|
20
19
|
from vision_agent.utils.execute import CodeInterpreter, Execution
|
21
20
|
|
@@ -223,25 +222,7 @@ class VisionAgent(Agent):
|
|
223
222
|
for chat_i in int_chat:
|
224
223
|
if "media" in chat_i:
|
225
224
|
for media in chat_i["media"]:
|
226
|
-
|
227
|
-
# TODO: Ideally we should not call VA.tools here, we should come to revisit how to better support remote image later
|
228
|
-
file_path = str(
|
229
|
-
Path(self.local_artifacts_path).parent
|
230
|
-
/ Path(media).name
|
231
|
-
)
|
232
|
-
if file_path.lower().endswith(
|
233
|
-
".mp4"
|
234
|
-
) or file_path.lower().endswith(".mov"):
|
235
|
-
video_frames = extract_frames(media)
|
236
|
-
save_video(
|
237
|
-
[frame for frame, _ in video_frames], file_path
|
238
|
-
)
|
239
|
-
else:
|
240
|
-
ndarray = load_image(media)
|
241
|
-
save_image(ndarray, file_path)
|
242
|
-
media = file_path
|
243
|
-
else:
|
244
|
-
media = cast(str, media)
|
225
|
+
media = cast(str, media)
|
245
226
|
artifacts.artifacts[Path(media).name] = open(media, "rb").read()
|
246
227
|
|
247
228
|
media_remote_path = (
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import difflib
|
2
|
+
import json
|
2
3
|
import os
|
3
4
|
import pickle as pkl
|
4
5
|
import re
|
@@ -70,8 +71,8 @@ def redisplay_results(execution: Execution) -> None:
|
|
70
71
|
display({MimeType.TEXT_LATEX: result.latex}, raw=True)
|
71
72
|
if result.json is not None:
|
72
73
|
display({MimeType.APPLICATION_JSON: result.json}, raw=True)
|
73
|
-
if result.
|
74
|
-
display({MimeType.
|
74
|
+
if result.artifact is not None:
|
75
|
+
display({MimeType.APPLICATION_ARTIFACT: result.artifact}, raw=True)
|
75
76
|
if result.extra is not None:
|
76
77
|
display(result.extra, raw=True)
|
77
78
|
|
@@ -210,7 +211,14 @@ def create_code_artifact(artifacts: Artifacts, name: str) -> str:
|
|
210
211
|
return_str = f"[Artifact {name} created]"
|
211
212
|
print(return_str)
|
212
213
|
|
213
|
-
display(
|
214
|
+
display(
|
215
|
+
{
|
216
|
+
MimeType.APPLICATION_ARTIFACT: json.dumps(
|
217
|
+
{"name": name, "content": artifacts[name]}
|
218
|
+
)
|
219
|
+
},
|
220
|
+
raw=True,
|
221
|
+
)
|
214
222
|
return return_str
|
215
223
|
|
216
224
|
|
@@ -294,7 +302,14 @@ def edit_code_artifact(
|
|
294
302
|
|
295
303
|
artifacts[name] = "".join(edited_lines)
|
296
304
|
|
297
|
-
display(
|
305
|
+
display(
|
306
|
+
{
|
307
|
+
MimeType.APPLICATION_ARTIFACT: json.dumps(
|
308
|
+
{"name": name, "content": artifacts[name]}
|
309
|
+
)
|
310
|
+
},
|
311
|
+
raw=True,
|
312
|
+
)
|
298
313
|
return open_code_artifact(artifacts, name, cur_line)
|
299
314
|
|
300
315
|
|
@@ -350,7 +365,10 @@ def generate_vision_code(
|
|
350
365
|
code_lines = code.splitlines(keepends=True)
|
351
366
|
total_lines = len(code_lines)
|
352
367
|
|
353
|
-
display(
|
368
|
+
display(
|
369
|
+
{MimeType.APPLICATION_ARTIFACT: json.dumps({"name": name, "content": code})},
|
370
|
+
raw=True,
|
371
|
+
)
|
354
372
|
return view_lines(code_lines, 0, total_lines, name, total_lines)
|
355
373
|
|
356
374
|
|
@@ -415,7 +433,10 @@ def edit_vision_code(
|
|
415
433
|
code_lines = code.splitlines(keepends=True)
|
416
434
|
total_lines = len(code_lines)
|
417
435
|
|
418
|
-
display(
|
436
|
+
display(
|
437
|
+
{MimeType.APPLICATION_ARTIFACT: json.dumps({"name": name, "content": code})},
|
438
|
+
raw=True,
|
439
|
+
)
|
419
440
|
return view_lines(code_lines, 0, total_lines, name, total_lines)
|
420
441
|
|
421
442
|
|
@@ -429,7 +450,6 @@ def write_media_artifact(artifacts: Artifacts, local_path: str) -> str:
|
|
429
450
|
with open(local_path, "rb") as f:
|
430
451
|
media = f.read()
|
431
452
|
artifacts[Path(local_path).name] = media
|
432
|
-
display({MimeType.TEXT_ARTIFACT_NAME: Path(local_path).name}, raw=True)
|
433
453
|
return f"[Media {Path(local_path).name} saved]"
|
434
454
|
|
435
455
|
|
@@ -596,7 +616,14 @@ def use_florence2_fine_tuning(
|
|
596
616
|
diff = get_diff_with_prompts(name, code, new_code)
|
597
617
|
print(diff)
|
598
618
|
|
599
|
-
display(
|
619
|
+
display(
|
620
|
+
{
|
621
|
+
MimeType.APPLICATION_ARTIFACT: json.dumps(
|
622
|
+
{"name": name, "content": new_code}
|
623
|
+
)
|
624
|
+
},
|
625
|
+
raw=True,
|
626
|
+
)
|
600
627
|
return diff
|
601
628
|
|
602
629
|
|
@@ -56,7 +56,7 @@ class MimeType(str, Enum):
|
|
56
56
|
TEXT_LATEX = "text/latex"
|
57
57
|
APPLICATION_JSON = "application/json"
|
58
58
|
APPLICATION_JAVASCRIPT = "application/javascript"
|
59
|
-
|
59
|
+
APPLICATION_ARTIFACT = "application/artifact"
|
60
60
|
|
61
61
|
|
62
62
|
class FileSerializer:
|
@@ -129,7 +129,7 @@ class Result:
|
|
129
129
|
self.latex = data.pop(MimeType.TEXT_LATEX, None)
|
130
130
|
self.json = data.pop(MimeType.APPLICATION_JSON, None)
|
131
131
|
self.javascript = data.pop(MimeType.APPLICATION_JAVASCRIPT, None)
|
132
|
-
self.
|
132
|
+
self.artifact = data.pop(MimeType.APPLICATION_ARTIFACT, None)
|
133
133
|
self.extra = data
|
134
134
|
# Only keeping the PNG representation if both PNG and JPEG are present
|
135
135
|
if self.png and self.jpeg:
|
@@ -207,8 +207,8 @@ class Result:
|
|
207
207
|
formats.append("javascript")
|
208
208
|
if self.mp4:
|
209
209
|
formats.append("mp4")
|
210
|
-
if self.
|
211
|
-
formats.append("
|
210
|
+
if self.artifact:
|
211
|
+
formats.append("artifact")
|
212
212
|
if self.extra:
|
213
213
|
formats.extend(iter(self.extra))
|
214
214
|
return formats
|
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.135 → vision_agent-0.2.136}/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
|