alita-sdk 0.3.413__py3-none-any.whl → 0.3.415__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- alita_sdk/runtime/tools/function.py +9 -2
- alita_sdk/runtime/tools/sandbox.py +15 -31
- {alita_sdk-0.3.413.dist-info → alita_sdk-0.3.415.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.413.dist-info → alita_sdk-0.3.415.dist-info}/RECORD +7 -7
- {alita_sdk-0.3.413.dist-info → alita_sdk-0.3.415.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.413.dist-info → alita_sdk-0.3.415.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.413.dist-info → alita_sdk-0.3.415.dist-info}/top_level.txt +0 -0
|
@@ -116,14 +116,21 @@ class FunctionTool(BaseTool):
|
|
|
116
116
|
if not self.output_variables:
|
|
117
117
|
return {"messages": [{"role": "assistant", "content": dumps(tool_result)}]}
|
|
118
118
|
else:
|
|
119
|
-
if self.output_variables
|
|
120
|
-
|
|
119
|
+
if "messages" in self.output_variables:
|
|
120
|
+
messages_dict = {
|
|
121
121
|
"messages": [{
|
|
122
122
|
"role": "assistant",
|
|
123
123
|
"content": dumps(tool_result) if not isinstance(tool_result, ToolException)
|
|
124
124
|
else str(tool_result)
|
|
125
125
|
}]
|
|
126
126
|
}
|
|
127
|
+
for var in self.output_variables:
|
|
128
|
+
if var != "messages":
|
|
129
|
+
if isinstance(tool_result, dict) and var in tool_result:
|
|
130
|
+
messages_dict[var] = tool_result[var]
|
|
131
|
+
else:
|
|
132
|
+
messages_dict[var] = tool_result
|
|
133
|
+
return messages_dict
|
|
127
134
|
else:
|
|
128
135
|
return { self.output_variables[0]: tool_result }
|
|
129
136
|
except ValidationError:
|
|
@@ -64,36 +64,10 @@ def _is_deno_available() -> bool:
|
|
|
64
64
|
|
|
65
65
|
|
|
66
66
|
def _setup_pyodide_cache_env() -> None:
|
|
67
|
-
"""Setup Pyodide caching environment variables for performance optimization"""
|
|
67
|
+
"""Setup Pyodide caching environment variables for performance optimization [NO-OP]"""
|
|
68
68
|
try:
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
if os.path.exists(cache_env_file):
|
|
72
|
-
with open(cache_env_file, 'r') as f:
|
|
73
|
-
for line in f:
|
|
74
|
-
line = line.strip()
|
|
75
|
-
if line.startswith('export ') and '=' in line:
|
|
76
|
-
# Parse export VAR=value format
|
|
77
|
-
var_assignment = line[7:] # Remove 'export '
|
|
78
|
-
if '=' in var_assignment:
|
|
79
|
-
key, value = var_assignment.split('=', 1)
|
|
80
|
-
# Remove quotes if present
|
|
81
|
-
value = value.strip('"').strip("'")
|
|
82
|
-
os.environ[key] = value
|
|
83
|
-
logger.debug(f"Set Pyodide cache env: {key}={value}")
|
|
84
|
-
|
|
85
|
-
# Set default caching environment variables if not already set
|
|
86
|
-
cache_defaults = {
|
|
87
|
-
'PYODIDE_PACKAGES_PATH': os.path.expanduser('~/.cache/pyodide'),
|
|
88
|
-
'DENO_DIR': os.path.expanduser('~/.cache/deno'),
|
|
89
|
-
'PYODIDE_CACHE_DIR': os.path.expanduser('~/.cache/pyodide'),
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
for key, default_value in cache_defaults.items():
|
|
93
|
-
if key not in os.environ:
|
|
94
|
-
os.environ[key] = default_value
|
|
95
|
-
logger.debug(f"Set default Pyodide env: {key}={default_value}")
|
|
96
|
-
|
|
69
|
+
for key in ["SANDBOX_BASE", "DENO_DIR"]:
|
|
70
|
+
logger.info("Sandbox env: %s -> %s", key, os.environ.get(key, "n/a"))
|
|
97
71
|
except Exception as e:
|
|
98
72
|
logger.warning(f"Could not setup Pyodide cache environment: {e}")
|
|
99
73
|
|
|
@@ -142,7 +116,7 @@ class PyodideSandboxTool(BaseTool):
|
|
|
142
116
|
def _prepare_pyodide_input(self, code: str) -> str:
|
|
143
117
|
"""Prepare input for PyodideSandboxTool by injecting state and alita_client into the code block."""
|
|
144
118
|
pyodide_predata = ""
|
|
145
|
-
|
|
119
|
+
|
|
146
120
|
# Add alita_client if available
|
|
147
121
|
if self.alita_client:
|
|
148
122
|
try:
|
|
@@ -158,7 +132,7 @@ class PyodideSandboxTool(BaseTool):
|
|
|
158
132
|
f"auth_token='{self.alita_client.auth_token}')\n")
|
|
159
133
|
except FileNotFoundError:
|
|
160
134
|
logger.error(f"sandbox_client.py not found. Ensure the file exists.")
|
|
161
|
-
|
|
135
|
+
|
|
162
136
|
return f"#elitea simplified client\n{pyodide_predata}{code}"
|
|
163
137
|
|
|
164
138
|
def _initialize_sandbox(self) -> None:
|
|
@@ -175,9 +149,19 @@ class PyodideSandboxTool(BaseTool):
|
|
|
175
149
|
|
|
176
150
|
from langchain_sandbox import PyodideSandbox
|
|
177
151
|
|
|
152
|
+
# Air-gapped settings
|
|
153
|
+
sandbox_base = os.environ.get("SANDBOX_BASE", os.path.expanduser('~/.cache/pyodide'))
|
|
154
|
+
sandbox_tmp = os.path.join(sandbox_base, "tmp")
|
|
155
|
+
deno_cache = os.environ.get("DENO_DIR", os.path.expanduser('~/.cache/deno'))
|
|
156
|
+
|
|
178
157
|
# Configure sandbox with performance optimizations
|
|
179
158
|
self._sandbox = PyodideSandbox(
|
|
180
159
|
stateful=self.stateful,
|
|
160
|
+
#
|
|
161
|
+
allow_env=["SANDBOX_BASE"],
|
|
162
|
+
allow_read=[sandbox_base, sandbox_tmp, deno_cache],
|
|
163
|
+
allow_write=[sandbox_tmp, deno_cache],
|
|
164
|
+
#
|
|
181
165
|
allow_net=self.allow_net,
|
|
182
166
|
# Use auto node_modules_dir for better caching
|
|
183
167
|
node_modules_dir="auto"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: alita_sdk
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.415
|
|
4
4
|
Summary: SDK for building langchain agents using resources from Alita
|
|
5
5
|
Author-email: Artem Rozumenko <artyom.rozumenko@gmail.com>, Mikalai Biazruchka <mikalai_biazruchka@epam.com>, Roman Mitusov <roman_mitusov@epam.com>, Ivan Krakhmaliuk <lifedj27@gmail.com>, Artem Dubrovskiy <ad13box@gmail.com>
|
|
6
6
|
License-Expression: Apache-2.0
|
|
@@ -110,7 +110,7 @@ alita_sdk/runtime/tools/application.py,sha256=RCGe-mRfj8372gTFkEX2xBvcYhw7IKdU1t
|
|
|
110
110
|
alita_sdk/runtime/tools/artifact.py,sha256=u3szFwZqguHrPZ3tZJ7S_TiZl7cxlT3oHYd6zbdpRDE,13842
|
|
111
111
|
alita_sdk/runtime/tools/datasource.py,sha256=pvbaSfI-ThQQnjHG-QhYNSTYRnZB0rYtZFpjCfpzxYI,2443
|
|
112
112
|
alita_sdk/runtime/tools/echo.py,sha256=spw9eCweXzixJqHnZofHE1yWiSUa04L4VKycf3KCEaM,486
|
|
113
|
-
alita_sdk/runtime/tools/function.py,sha256=
|
|
113
|
+
alita_sdk/runtime/tools/function.py,sha256=VOgcCjsDfyH2kBbX4k3DtwpsW7aX0JETahC26dwYsuA,6540
|
|
114
114
|
alita_sdk/runtime/tools/graph.py,sha256=7jImBBSEdP5Mjnn2keOiyUwdGDFhEXLUrgUiugO3mgA,3503
|
|
115
115
|
alita_sdk/runtime/tools/image_generation.py,sha256=Kls9D_ke_SK7xmVr7I9SlQcAEBJc86gf66haN0qIj9k,7469
|
|
116
116
|
alita_sdk/runtime/tools/indexer_tool.py,sha256=whSLPevB4WD6dhh2JDXEivDmTvbjiMV1MrPl9cz5eLA,4375
|
|
@@ -121,7 +121,7 @@ alita_sdk/runtime/tools/mcp_server_tool.py,sha256=MhLxZJ44LYrB_0GrojmkyqKoDRaqIH
|
|
|
121
121
|
alita_sdk/runtime/tools/pgvector_search.py,sha256=NN2BGAnq4SsDHIhUcFZ8d_dbEOM8QwB0UwpsWCYruXU,11692
|
|
122
122
|
alita_sdk/runtime/tools/prompt.py,sha256=nJafb_e5aOM1Rr3qGFCR-SKziU9uCsiP2okIMs9PppM,741
|
|
123
123
|
alita_sdk/runtime/tools/router.py,sha256=p7e0tX6YAWw2M2Nq0A_xqw1E2P-Xz1DaJvhUstfoZn4,1584
|
|
124
|
-
alita_sdk/runtime/tools/sandbox.py,sha256=
|
|
124
|
+
alita_sdk/runtime/tools/sandbox.py,sha256=LTCHC9xnuYThWX30PCTVEtjeg50FX7w2c29KU5E68W0,15251
|
|
125
125
|
alita_sdk/runtime/tools/tool.py,sha256=lE1hGi6qOAXG7qxtqxarD_XMQqTghdywf261DZawwno,5631
|
|
126
126
|
alita_sdk/runtime/tools/vectorstore.py,sha256=0SzfY1dYrGr7YUapJzXY01JFyzLv36dPjwHzs1XZIM4,34392
|
|
127
127
|
alita_sdk/runtime/tools/vectorstore_base.py,sha256=k_6LAhhBJEs5SXCQJI3bBvJLQli6_3pHjqF6SCQGJGc,28312
|
|
@@ -353,8 +353,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=kT0TbmMvuKhDUZc0i7KO18O38JM9S
|
|
|
353
353
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=0ne8XLJEQSLOWfzd2HdnqOYmQlUliKHbBED5kW_Vias,2895
|
|
354
354
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
|
|
355
355
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
|
|
356
|
-
alita_sdk-0.3.
|
|
357
|
-
alita_sdk-0.3.
|
|
358
|
-
alita_sdk-0.3.
|
|
359
|
-
alita_sdk-0.3.
|
|
360
|
-
alita_sdk-0.3.
|
|
356
|
+
alita_sdk-0.3.415.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
357
|
+
alita_sdk-0.3.415.dist-info/METADATA,sha256=56q2LMSzT9wVT1UilbADle-ONyYKKpCudn__DVOcbi4,19071
|
|
358
|
+
alita_sdk-0.3.415.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
359
|
+
alita_sdk-0.3.415.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
|
360
|
+
alita_sdk-0.3.415.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|