vision-agent 0.2.175__tar.gz → 0.2.176__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {vision_agent-0.2.175 → vision_agent-0.2.176}/PKG-INFO +10 -10
- {vision_agent-0.2.175 → vision_agent-0.2.176}/README.md +9 -9
- {vision_agent-0.2.175 → vision_agent-0.2.176}/pyproject.toml +1 -1
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/vision_agent.py +16 -4
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/tools/meta_tools.py +37 -11
- {vision_agent-0.2.175 → vision_agent-0.2.176}/LICENSE +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/__init__.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/__init__.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/agent.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/agent_utils.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/vision_agent_coder.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/vision_agent_coder_prompts.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/vision_agent_planner.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/vision_agent_planner_prompts.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/vision_agent_prompts.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/clients/__init__.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/clients/http.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/clients/landing_public_api.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/fonts/__init__.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/fonts/default_font_ch_en.ttf +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/lmm/__init__.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/lmm/lmm.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/lmm/types.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/tools/__init__.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/tools/prompts.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/tools/tool_utils.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/tools/tools.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/tools/tools_types.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/utils/__init__.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/utils/exceptions.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/utils/execute.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/utils/image_utils.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/utils/sim.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/utils/type_defs.py +0 -0
- {vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/utils/video.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: vision-agent
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.176
|
4
4
|
Summary: Toolset for Vision Agent
|
5
5
|
Author: Landing AI
|
6
6
|
Author-email: dev@landing.ai
|
@@ -53,25 +53,25 @@ Description-Content-Type: text/markdown
|
|
53
53
|
![version](https://img.shields.io/pypi/pyversions/vision-agent)
|
54
54
|
</div>
|
55
55
|
|
56
|
-
|
56
|
+
VisionAgent is a library that helps you utilize agent frameworks to generate code to
|
57
57
|
solve your vision task. Many current vision problems can easily take hours or days to
|
58
58
|
solve, you need to find the right model, figure out how to use it and program it to
|
59
|
-
accomplish the task you want.
|
59
|
+
accomplish the task you want. VisionAgent aims to provide an in-seconds experience by
|
60
60
|
allowing users to describe their problem in text and have the agent framework generate
|
61
61
|
code to solve the task for them. Check out our discord for updates and roadmaps!
|
62
62
|
|
63
63
|
## Table of Contents
|
64
64
|
- [🚀Quick Start](#quick-start)
|
65
65
|
- [📚Documentation](#documentation)
|
66
|
-
- [🔍🤖
|
66
|
+
- [🔍🤖VisionAgent](#vision-agent-basic-usage)
|
67
67
|
- [🛠️Tools](#tools)
|
68
68
|
- [🤖LMMs](#lmms)
|
69
|
-
- [💻🤖
|
69
|
+
- [💻🤖VisionAgent Coder](#vision-agent-coder)
|
70
70
|
- [🏗️Additional Backends](#additional-backends)
|
71
71
|
|
72
72
|
## Quick Start
|
73
73
|
### Web Application
|
74
|
-
The fastest way to test out
|
74
|
+
The fastest way to test out VisionAgent is to use our web application. You can find it
|
75
75
|
[here](https://va.landing.ai/).
|
76
76
|
|
77
77
|
|
@@ -108,9 +108,9 @@ be images or video files.
|
|
108
108
|
|
109
109
|
## Documentation
|
110
110
|
|
111
|
-
[
|
111
|
+
[VisionAgent Library Docs](https://landing-ai.github.io/vision-agent/)
|
112
112
|
|
113
|
-
##
|
113
|
+
## VisionAgent Basic Usage
|
114
114
|
### Chatting and Message Formats
|
115
115
|
`VisionAgent` is an agent that can chat with you and call other tools or agents to
|
116
116
|
write vision code for you. You can interact with it like you would ChatGPT or any other
|
@@ -292,7 +292,7 @@ response = lmm(
|
|
292
292
|
)
|
293
293
|
```
|
294
294
|
|
295
|
-
##
|
295
|
+
## VisionAgent Coder
|
296
296
|
Underneath the hood, `VisionAgent` uses `VisionAgentCoder` to generate code to solve
|
297
297
|
vision tasks. You can use `VisionAgentCoder` directly to generate code if you want:
|
298
298
|
|
@@ -488,7 +488,7 @@ export AZURE_OPENAI_EMBEDDING_MODEL_DEPLOYMENT_NAME="your_embedding_model_deploy
|
|
488
488
|
|
489
489
|
> NOTE: make sure your Azure model deployment have enough quota (token per minute) to support it. The default value 8000TPM is not enough.
|
490
490
|
|
491
|
-
You can then run
|
491
|
+
You can then run VisionAgent using the Azure OpenAI models:
|
492
492
|
|
493
493
|
```python
|
494
494
|
import vision_agent as va
|
@@ -11,25 +11,25 @@
|
|
11
11
|
![version](https://img.shields.io/pypi/pyversions/vision-agent)
|
12
12
|
</div>
|
13
13
|
|
14
|
-
|
14
|
+
VisionAgent is a library that helps you utilize agent frameworks to generate code to
|
15
15
|
solve your vision task. Many current vision problems can easily take hours or days to
|
16
16
|
solve, you need to find the right model, figure out how to use it and program it to
|
17
|
-
accomplish the task you want.
|
17
|
+
accomplish the task you want. VisionAgent aims to provide an in-seconds experience by
|
18
18
|
allowing users to describe their problem in text and have the agent framework generate
|
19
19
|
code to solve the task for them. Check out our discord for updates and roadmaps!
|
20
20
|
|
21
21
|
## Table of Contents
|
22
22
|
- [🚀Quick Start](#quick-start)
|
23
23
|
- [📚Documentation](#documentation)
|
24
|
-
- [🔍🤖
|
24
|
+
- [🔍🤖VisionAgent](#vision-agent-basic-usage)
|
25
25
|
- [🛠️Tools](#tools)
|
26
26
|
- [🤖LMMs](#lmms)
|
27
|
-
- [💻🤖
|
27
|
+
- [💻🤖VisionAgent Coder](#vision-agent-coder)
|
28
28
|
- [🏗️Additional Backends](#additional-backends)
|
29
29
|
|
30
30
|
## Quick Start
|
31
31
|
### Web Application
|
32
|
-
The fastest way to test out
|
32
|
+
The fastest way to test out VisionAgent is to use our web application. You can find it
|
33
33
|
[here](https://va.landing.ai/).
|
34
34
|
|
35
35
|
|
@@ -66,9 +66,9 @@ be images or video files.
|
|
66
66
|
|
67
67
|
## Documentation
|
68
68
|
|
69
|
-
[
|
69
|
+
[VisionAgent Library Docs](https://landing-ai.github.io/vision-agent/)
|
70
70
|
|
71
|
-
##
|
71
|
+
## VisionAgent Basic Usage
|
72
72
|
### Chatting and Message Formats
|
73
73
|
`VisionAgent` is an agent that can chat with you and call other tools or agents to
|
74
74
|
write vision code for you. You can interact with it like you would ChatGPT or any other
|
@@ -250,7 +250,7 @@ response = lmm(
|
|
250
250
|
)
|
251
251
|
```
|
252
252
|
|
253
|
-
##
|
253
|
+
## VisionAgent Coder
|
254
254
|
Underneath the hood, `VisionAgent` uses `VisionAgentCoder` to generate code to solve
|
255
255
|
vision tasks. You can use `VisionAgentCoder` directly to generate code if you want:
|
256
256
|
|
@@ -446,7 +446,7 @@ export AZURE_OPENAI_EMBEDDING_MODEL_DEPLOYMENT_NAME="your_embedding_model_deploy
|
|
446
446
|
|
447
447
|
> NOTE: make sure your Azure model deployment have enough quota (token per minute) to support it. The default value 8000TPM is not enough.
|
448
448
|
|
449
|
-
You can then run
|
449
|
+
You can then run VisionAgent using the Azure OpenAI models:
|
450
450
|
|
451
451
|
```python
|
452
452
|
import vision_agent as va
|
@@ -212,6 +212,19 @@ def add_step_descriptions(response: Dict[str, Any]) -> Dict[str, Any]:
|
|
212
212
|
return response
|
213
213
|
|
214
214
|
|
215
|
+
def setup_artifacts() -> Artifacts:
|
216
|
+
# this is setting remote artifacts path
|
217
|
+
sandbox = os.environ.get("CODE_SANDBOX_RUNTIME", None)
|
218
|
+
if sandbox is None or sandbox == "local":
|
219
|
+
remote = WORKSPACE / "artifacts.pkl"
|
220
|
+
elif sandbox == "e2b":
|
221
|
+
remote = Path("/home/user/artifacts.pkl")
|
222
|
+
else:
|
223
|
+
raise ValueError(f"Unknown code sandbox runtime {sandbox}")
|
224
|
+
artifacts = Artifacts(remote, Path(os.getcwd()) / "artifacts.pkl")
|
225
|
+
return artifacts
|
226
|
+
|
227
|
+
|
215
228
|
def new_format_to_old_format(new_format: Dict[str, Any]) -> Dict[str, Any]:
|
216
229
|
thoughts = new_format["thinking"] if new_format["thinking"] is not None else ""
|
217
230
|
response = new_format["response"] if new_format["response"] is not None else ""
|
@@ -384,8 +397,7 @@ class VisionAgent(Agent):
|
|
384
397
|
raise ValueError("chat cannot be empty")
|
385
398
|
|
386
399
|
if not artifacts:
|
387
|
-
|
388
|
-
artifacts = Artifacts("", "")
|
400
|
+
artifacts = setup_artifacts()
|
389
401
|
|
390
402
|
# NOTE: each chat should have a dedicated code interpreter instance to avoid concurrency issues
|
391
403
|
code_interpreter = (
|
@@ -400,7 +412,7 @@ class VisionAgent(Agent):
|
|
400
412
|
|
401
413
|
if code_interpreter.remote_path != artifacts.remote_save_path.parent:
|
402
414
|
raise ValueError(
|
403
|
-
f"Code interpreter remote path {code_interpreter.remote_path} does not match {artifacts.remote_save_path.parent}"
|
415
|
+
f"Code interpreter remote path {code_interpreter.remote_path} does not match artifacts remote path {artifacts.remote_save_path.parent}"
|
404
416
|
)
|
405
417
|
|
406
418
|
with code_interpreter:
|
@@ -415,7 +427,7 @@ class VisionAgent(Agent):
|
|
415
427
|
artifacts.artifacts[Path(media).name] = open(media, "rb").read()
|
416
428
|
|
417
429
|
media_remote_path = (
|
418
|
-
Path(
|
430
|
+
Path(artifacts.remote_save_path.parent) / Path(media).name
|
419
431
|
)
|
420
432
|
chat_i["content"] += f" Media name {media_remote_path}" # type: ignore
|
421
433
|
media_list.append(media_remote_path)
|
@@ -76,6 +76,14 @@ class Artifacts:
|
|
76
76
|
def __init__(
|
77
77
|
self, remote_save_path: Union[str, Path], local_save_path: Union[str, Path]
|
78
78
|
) -> None:
|
79
|
+
"""Initializes the Artifacts object with it's remote and local save paths.
|
80
|
+
|
81
|
+
Parameters:
|
82
|
+
remote_save_path (Union[str, Path]): The path to save the artifacts in the
|
83
|
+
remote environment. For example "/home/user/artifacts.pkl".
|
84
|
+
local_save_path (Union[str, Path]): The path to save the artifacts in the
|
85
|
+
local environment. For example "/Users/my_user/workspace/artifacts.pkl".
|
86
|
+
"""
|
79
87
|
self.remote_save_path = Path(remote_save_path)
|
80
88
|
self.local_save_path = Path(local_save_path)
|
81
89
|
self.artifacts: Dict[str, Any] = {}
|
@@ -85,31 +93,46 @@ class Artifacts:
|
|
85
93
|
def load(
|
86
94
|
self,
|
87
95
|
artifacts_path: Union[str, Path],
|
88
|
-
|
96
|
+
load_to_dir: Optional[Union[str, Path]] = None,
|
89
97
|
) -> None:
|
90
|
-
"""Loads are artifacts into the
|
91
|
-
into remote_save_path. If an artifact value is None it
|
98
|
+
"""Loads are artifacts into the load_to_dir directory. If load_to_dir is None,
|
99
|
+
it will load into remote_save_path directory. If an artifact value is None it
|
100
|
+
will skip loading it.
|
92
101
|
|
93
102
|
Parameters:
|
94
|
-
artifacts_path (Union[str, Path]): The file path to load the artifacts from
|
103
|
+
artifacts_path (Union[str, Path]): The file path to load the artifacts from.
|
104
|
+
If you are in the remote environment this would be remote_save_path, if
|
105
|
+
you are in the local environment this would be local_save_path.
|
106
|
+
load_to_dir (Optional[Union[str, Path]): The directory to load the artifacts
|
107
|
+
into. If None, it will load into remote_save_path directory.
|
95
108
|
"""
|
96
109
|
with open(artifacts_path, "rb") as f:
|
97
110
|
self.artifacts = pkl.load(f)
|
98
111
|
|
99
|
-
|
112
|
+
load_to_dir = (
|
113
|
+
self.remote_save_path.parent if load_to_dir is None else Path(load_to_dir)
|
114
|
+
)
|
100
115
|
|
101
116
|
for k, v in self.artifacts.items():
|
102
117
|
if v is not None:
|
103
118
|
mode = "w" if isinstance(v, str) else "wb"
|
104
|
-
with open(
|
119
|
+
with open(load_to_dir / k, mode) as f:
|
105
120
|
f.write(v)
|
106
121
|
|
107
|
-
def show(self,
|
108
|
-
"""
|
122
|
+
def show(self, uploaded_file_dir: Optional[Union[str, Path]] = None) -> str:
|
123
|
+
"""Prints out the artifacts and the directory they have been loaded to. If you
|
124
|
+
pass in upload_file_dir, it will show the artifacts have been loaded to the
|
125
|
+
upload_file_dir directory. If you don't pass in upload_file_dir, it will show
|
126
|
+
the artifacts have been loaded to the remote_save_path directory.
|
127
|
+
|
128
|
+
Parameters:
|
129
|
+
uploaded_file_dir (Optional[Union[str, Path]): The directory the artifacts
|
130
|
+
have been loaded to.
|
131
|
+
"""
|
109
132
|
loaded_path = (
|
110
|
-
Path(
|
111
|
-
if
|
112
|
-
else self.remote_save_path
|
133
|
+
Path(uploaded_file_dir)
|
134
|
+
if uploaded_file_dir is not None
|
135
|
+
else self.remote_save_path.parent
|
113
136
|
)
|
114
137
|
output_str = "[Artifacts loaded]\n"
|
115
138
|
for k in self.artifacts.keys():
|
@@ -121,6 +144,9 @@ class Artifacts:
|
|
121
144
|
return output_str
|
122
145
|
|
123
146
|
def save(self, local_path: Optional[Union[str, Path]] = None) -> None:
|
147
|
+
"""Saves the artifacts to the local_save_path directory. If local_path is None,
|
148
|
+
it will save to the local_save_path directory.
|
149
|
+
"""
|
124
150
|
save_path = Path(local_path) if local_path is not None else self.local_save_path
|
125
151
|
with open(save_path, "wb") as f:
|
126
152
|
pkl.dump(self.artifacts, f)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/vision_agent_coder_prompts.py
RENAMED
File without changes
|
File without changes
|
{vision_agent-0.2.175 → vision_agent-0.2.176}/vision_agent/agent/vision_agent_planner_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
|