vision-agent 0.2.134__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.134 → vision_agent-0.2.136}/PKG-INFO +1 -1
- {vision_agent-0.2.134 → vision_agent-0.2.136}/pyproject.toml +1 -1
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/agent/vision_agent.py +2 -9
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/tools/meta_tools.py +46 -14
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/utils/execute.py +5 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/LICENSE +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/README.md +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/__init__.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/agent/__init__.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/agent/agent.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/agent/agent_utils.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/agent/vision_agent_coder.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/agent/vision_agent_coder_prompts.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/agent/vision_agent_prompts.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/clients/__init__.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/clients/http.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/clients/landing_public_api.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/fonts/__init__.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/lmm/__init__.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/lmm/lmm.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/lmm/types.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/tools/__init__.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/tools/prompts.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/tools/tool_utils.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/tools/tools.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/tools/tools_types.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/utils/__init__.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/utils/exceptions.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/utils/image_utils.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/utils/sim.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/utils/type_defs.py +0 -0
- {vision_agent-0.2.134 → vision_agent-0.2.136}/vision_agent/utils/video.py +0 -0
@@ -13,7 +13,7 @@ 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
18
|
from vision_agent.utils import CodeInterpreterFactory
|
19
19
|
from vision_agent.utils.execute import CodeInterpreter, Execution
|
@@ -222,14 +222,7 @@ class VisionAgent(Agent):
|
|
222
222
|
for chat_i in int_chat:
|
223
223
|
if "media" in chat_i:
|
224
224
|
for media in chat_i["media"]:
|
225
|
-
|
226
|
-
# TODO: Ideally we should not call VA.tools here, we should come to revisit how to better support remote image later
|
227
|
-
file_path = Path(media).name
|
228
|
-
ndarray = load_image(media)
|
229
|
-
save_image(ndarray, file_path)
|
230
|
-
media = file_path
|
231
|
-
else:
|
232
|
-
media = cast(str, media)
|
225
|
+
media = cast(str, media)
|
233
226
|
artifacts.artifacts[Path(media).name] = open(media, "rb").read()
|
234
227
|
|
235
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
|
@@ -53,25 +54,27 @@ def redisplay_results(execution: Execution) -> None:
|
|
53
54
|
"""
|
54
55
|
for result in execution.results:
|
55
56
|
if result.text is not None:
|
56
|
-
display({MimeType.TEXT_PLAIN: result.text})
|
57
|
+
display({MimeType.TEXT_PLAIN: result.text}, raw=True)
|
57
58
|
if result.html is not None:
|
58
|
-
display({MimeType.TEXT_HTML: result.html})
|
59
|
+
display({MimeType.TEXT_HTML: result.html}, raw=True)
|
59
60
|
if result.markdown is not None:
|
60
|
-
display({MimeType.TEXT_MARKDOWN: result.markdown})
|
61
|
+
display({MimeType.TEXT_MARKDOWN: result.markdown}, raw=True)
|
61
62
|
if result.svg is not None:
|
62
|
-
display({MimeType.IMAGE_SVG: result.svg})
|
63
|
+
display({MimeType.IMAGE_SVG: result.svg}, raw=True)
|
63
64
|
if result.png is not None:
|
64
|
-
display({MimeType.IMAGE_PNG: result.png})
|
65
|
+
display({MimeType.IMAGE_PNG: result.png}, raw=True)
|
65
66
|
if result.jpeg is not None:
|
66
|
-
display({MimeType.IMAGE_JPEG: result.jpeg})
|
67
|
+
display({MimeType.IMAGE_JPEG: result.jpeg}, raw=True)
|
67
68
|
if result.mp4 is not None:
|
68
|
-
display({MimeType.VIDEO_MP4_B64: result.mp4})
|
69
|
+
display({MimeType.VIDEO_MP4_B64: result.mp4}, raw=True)
|
69
70
|
if result.latex is not None:
|
70
|
-
display({MimeType.TEXT_LATEX: result.latex})
|
71
|
+
display({MimeType.TEXT_LATEX: result.latex}, raw=True)
|
71
72
|
if result.json is not None:
|
72
|
-
display({MimeType.APPLICATION_JSON: result.json})
|
73
|
+
display({MimeType.APPLICATION_JSON: result.json}, raw=True)
|
74
|
+
if result.artifact is not None:
|
75
|
+
display({MimeType.APPLICATION_ARTIFACT: result.artifact}, raw=True)
|
73
76
|
if result.extra is not None:
|
74
|
-
display(result.extra)
|
77
|
+
display(result.extra, raw=True)
|
75
78
|
|
76
79
|
|
77
80
|
class Artifacts:
|
@@ -208,7 +211,14 @@ def create_code_artifact(artifacts: Artifacts, name: str) -> str:
|
|
208
211
|
return_str = f"[Artifact {name} created]"
|
209
212
|
print(return_str)
|
210
213
|
|
211
|
-
display(
|
214
|
+
display(
|
215
|
+
{
|
216
|
+
MimeType.APPLICATION_ARTIFACT: json.dumps(
|
217
|
+
{"name": name, "content": artifacts[name]}
|
218
|
+
)
|
219
|
+
},
|
220
|
+
raw=True,
|
221
|
+
)
|
212
222
|
return return_str
|
213
223
|
|
214
224
|
|
@@ -292,7 +302,14 @@ def edit_code_artifact(
|
|
292
302
|
|
293
303
|
artifacts[name] = "".join(edited_lines)
|
294
304
|
|
295
|
-
display(
|
305
|
+
display(
|
306
|
+
{
|
307
|
+
MimeType.APPLICATION_ARTIFACT: json.dumps(
|
308
|
+
{"name": name, "content": artifacts[name]}
|
309
|
+
)
|
310
|
+
},
|
311
|
+
raw=True,
|
312
|
+
)
|
296
313
|
return open_code_artifact(artifacts, name, cur_line)
|
297
314
|
|
298
315
|
|
@@ -348,7 +365,10 @@ def generate_vision_code(
|
|
348
365
|
code_lines = code.splitlines(keepends=True)
|
349
366
|
total_lines = len(code_lines)
|
350
367
|
|
351
|
-
display(
|
368
|
+
display(
|
369
|
+
{MimeType.APPLICATION_ARTIFACT: json.dumps({"name": name, "content": code})},
|
370
|
+
raw=True,
|
371
|
+
)
|
352
372
|
return view_lines(code_lines, 0, total_lines, name, total_lines)
|
353
373
|
|
354
374
|
|
@@ -413,7 +433,10 @@ def edit_vision_code(
|
|
413
433
|
code_lines = code.splitlines(keepends=True)
|
414
434
|
total_lines = len(code_lines)
|
415
435
|
|
416
|
-
display(
|
436
|
+
display(
|
437
|
+
{MimeType.APPLICATION_ARTIFACT: json.dumps({"name": name, "content": code})},
|
438
|
+
raw=True,
|
439
|
+
)
|
417
440
|
return view_lines(code_lines, 0, total_lines, name, total_lines)
|
418
441
|
|
419
442
|
|
@@ -592,6 +615,15 @@ def use_florence2_fine_tuning(
|
|
592
615
|
|
593
616
|
diff = get_diff_with_prompts(name, code, new_code)
|
594
617
|
print(diff)
|
618
|
+
|
619
|
+
display(
|
620
|
+
{
|
621
|
+
MimeType.APPLICATION_ARTIFACT: json.dumps(
|
622
|
+
{"name": name, "content": new_code}
|
623
|
+
)
|
624
|
+
},
|
625
|
+
raw=True,
|
626
|
+
)
|
595
627
|
return diff
|
596
628
|
|
597
629
|
|
@@ -56,6 +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
|
+
APPLICATION_ARTIFACT = "application/artifact"
|
59
60
|
|
60
61
|
|
61
62
|
class FileSerializer:
|
@@ -103,6 +104,7 @@ class Result:
|
|
103
104
|
latex: Optional[str] = None
|
104
105
|
json: Optional[Dict[str, Any]] = None
|
105
106
|
javascript: Optional[str] = None
|
107
|
+
artifact_name: Optional[str] = None
|
106
108
|
extra: Optional[Dict[str, Any]] = None
|
107
109
|
"Extra data that can be included. Not part of the standard types."
|
108
110
|
|
@@ -127,6 +129,7 @@ class Result:
|
|
127
129
|
self.latex = data.pop(MimeType.TEXT_LATEX, None)
|
128
130
|
self.json = data.pop(MimeType.APPLICATION_JSON, None)
|
129
131
|
self.javascript = data.pop(MimeType.APPLICATION_JAVASCRIPT, None)
|
132
|
+
self.artifact = data.pop(MimeType.APPLICATION_ARTIFACT, None)
|
130
133
|
self.extra = data
|
131
134
|
# Only keeping the PNG representation if both PNG and JPEG are present
|
132
135
|
if self.png and self.jpeg:
|
@@ -204,6 +207,8 @@ class Result:
|
|
204
207
|
formats.append("javascript")
|
205
208
|
if self.mp4:
|
206
209
|
formats.append("mp4")
|
210
|
+
if self.artifact:
|
211
|
+
formats.append("artifact")
|
207
212
|
if self.extra:
|
208
213
|
formats.extend(iter(self.extra))
|
209
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.134 → 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
|