alita-sdk 0.3.411__py3-none-any.whl → 0.3.412.post1__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.
@@ -30,7 +30,10 @@ class AlitaJSONLoader(BaseLoader):
30
30
  with open(self.file_path, encoding=self.encoding) as f:
31
31
  return json.load(f)
32
32
  elif hasattr(self, 'file_content') and self.file_content:
33
- return json.load(self.file_content)
33
+ if isinstance(self.file_content, bytes):
34
+ return json.loads(self.file_content.decode(self.encoding))
35
+ else:
36
+ return json.load(self.file_content)
34
37
  else:
35
38
  raise ValueError("Neither file_path nor file_content is provided.")
36
39
 
@@ -255,17 +255,17 @@ document_loaders_map = {
255
255
  'extract_images': False,
256
256
  }
257
257
  },
258
- '.py': {
259
- 'class': AlitaPythonLoader,
260
- 'mime_type': 'text/x-python',
261
- 'is_multimodal_processing': False,
262
- 'kwargs': {},
263
- 'allowed_to_override': DEFAULT_ALLOWED_BASE
264
- }
258
+ # '.py': {
259
+ # 'class': AlitaPythonLoader,
260
+ # 'mime_type': 'text/x-python',
261
+ # 'is_multimodal_processing': False,
262
+ # 'kwargs': {},
263
+ # 'allowed_to_override': DEFAULT_ALLOWED_BASE
264
+ # }
265
265
  }
266
266
 
267
267
  code_extensions = [
268
- # '.py', # Python
268
+ '.py', # Python
269
269
  '.js', # JavaScript
270
270
  '.ts', # TypeScript
271
271
  '.java', # Java
@@ -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
- # Check if cache environment file exists and source it
70
- cache_env_file = os.path.expanduser("~/.pyodide_cache_env")
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"
@@ -92,21 +92,24 @@ def parse_file_content(file_name=None, file_content=None, is_capture_image: bool
92
92
  return ToolException(
93
93
  "Not supported type of files entered. Supported types are TXT, DOCX, PDF, PPTX, XLSX and XLS only.")
94
94
 
95
- if hasattr(loader, 'get_content'):
96
- return loader.get_content()
97
- else:
98
- extension = Path(file_path if file_path else file_name).suffix
99
- loader_kwargs = get_loader_kwargs(loaders_map.get(extension), file_name, file_content, is_capture_image, page_number, sheet_name, llm, file_path, excel_by_sheets)
100
- if file_content:
101
- return load_content_from_bytes(file_content=file_content,
102
- extension=extension,
103
- loader_extra_config=loader_kwargs,
104
- llm=llm)
95
+ try:
96
+ if hasattr(loader, 'get_content'):
97
+ return loader.get_content()
105
98
  else:
106
- return load_content(file_path=file_path,
107
- extension=extension,
108
- loader_extra_config=loader_kwargs,
109
- llm=llm)
99
+ extension = Path(file_path if file_path else file_name).suffix
100
+ loader_kwargs = get_loader_kwargs(loaders_map.get(extension), file_name, file_content, is_capture_image, page_number, sheet_name, llm, file_path, excel_by_sheets)
101
+ if file_content:
102
+ return load_content_from_bytes(file_content=file_content,
103
+ extension=extension,
104
+ loader_extra_config=loader_kwargs,
105
+ llm=llm)
106
+ else:
107
+ return load_content(file_path=file_path,
108
+ extension=extension,
109
+ loader_extra_config=loader_kwargs,
110
+ llm=llm)
111
+ except Exception as e:
112
+ return ToolException(f"Error reading file ({file_name or file_path}) content. Make sure these types are supported: {str(e)}")
110
113
 
111
114
  def load_file_docs(file_name=None, file_content=None, is_capture_image: bool = False, page_number: int = None,
112
115
  sheet_name: str = None, llm=None, file_path: str = None, excel_by_sheets: bool = False) -> List[Document] | ToolException:
@@ -153,7 +156,7 @@ def prepare_loader(file_name=None, file_content=None, is_capture_image: bool = F
153
156
 
154
157
  loader_object = loaders_map.get(extension)
155
158
  if not loader_object:
156
- return None
159
+ loader_object = loaders_map.get('.txt') # Default to text loader if no specific loader found
157
160
  loader_kwargs = get_loader_kwargs(loader_object, file_name, file_content, is_capture_image, page_number, sheet_name, llm, file_path, excel_by_sheets, prompt)
158
161
  loader = loader_object['class'](**loader_kwargs)
159
162
  return loader
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.411
3
+ Version: 0.3.412.post1
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
@@ -60,7 +60,7 @@ alita_sdk/runtime/langchain/document_loaders/AlitaDocxMammothLoader.py,sha256=HU
60
60
  alita_sdk/runtime/langchain/document_loaders/AlitaExcelLoader.py,sha256=YI8QaHRjCl8WtxuQKMXi_iTJBZ6da3OTNgoDFqNjz1g,9294
61
61
  alita_sdk/runtime/langchain/document_loaders/AlitaGitRepoLoader.py,sha256=5WXGcyHraSVj3ANHj_U6X4EDikoekrIYtS0Q_QqNIng,2608
62
62
  alita_sdk/runtime/langchain/document_loaders/AlitaImageLoader.py,sha256=QwgBJE-BvOasjgT1hYHZc0MP0F_elirUjSzKixoM6fY,6610
63
- alita_sdk/runtime/langchain/document_loaders/AlitaJSONLoader.py,sha256=Nav2cgCQKOHQi_ZgYYn_iFdP_Os56KVlVR5nHGXecBc,3445
63
+ alita_sdk/runtime/langchain/document_loaders/AlitaJSONLoader.py,sha256=iKCHUkEISLX1mSiMrhbKXhLPWHIVov6gQ0FahUrHAFM,3607
64
64
  alita_sdk/runtime/langchain/document_loaders/AlitaJiraLoader.py,sha256=M2q3YThkps0yAZOjfoLcyE7qycVTYKcXEGtpmp0N6C8,10950
65
65
  alita_sdk/runtime/langchain/document_loaders/AlitaMarkdownLoader.py,sha256=RGHDfleYTn7AAc3H-yFZrjm06L0Ux14ZtEJpFlVBNCA,2474
66
66
  alita_sdk/runtime/langchain/document_loaders/AlitaPDFLoader.py,sha256=olVThKX9Mmv4muTW0cAQBkgeNqU4IcdLVhqpBuzwly4,5904
@@ -71,7 +71,7 @@ alita_sdk/runtime/langchain/document_loaders/AlitaTableLoader.py,sha256=EO1nJDRP
71
71
  alita_sdk/runtime/langchain/document_loaders/AlitaTextLoader.py,sha256=EiCIAF_OxSrbuwgOFk2IpxRMvFbctITt2jAI0g_atpk,3586
72
72
  alita_sdk/runtime/langchain/document_loaders/ImageParser.py,sha256=RQ4zGdSw42ec8c6Eb48uFadayWuiT4FbwhGVwhSw60s,1065
73
73
  alita_sdk/runtime/langchain/document_loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
74
- alita_sdk/runtime/langchain/document_loaders/constants.py,sha256=ITDAOyu2QdObcK-yjucJu3drgavCCFWvkjXDj2oYYS8,9413
74
+ alita_sdk/runtime/langchain/document_loaders/constants.py,sha256=BFXPTMI8ocF2uzWcY6ZAZ6F_uRNaurA5ibK6YvhcH3A,9425
75
75
  alita_sdk/runtime/langchain/document_loaders/utils.py,sha256=9xghESf3axBbwxATyVuS0Yu-TWe8zWZnXgCD1ZVyNW0,2414
76
76
  alita_sdk/runtime/langchain/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
77
77
  alita_sdk/runtime/langchain/interfaces/kwextractor.py,sha256=kSJA9L8g8UArmHu7Bd9dIO0Rrq86JPUb8RYNlnN68FQ,3072
@@ -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=7KpTAE4Fs1dvQIwAH__jwrxXG4QUa9GhcOhlkE8EKro,16049
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
@@ -331,7 +331,7 @@ alita_sdk/tools/testrail/__init__.py,sha256=Xg4nVjULL_D8JpIXLYXppnwUfGF4-lguFwKH
331
331
  alita_sdk/tools/testrail/api_wrapper.py,sha256=tQcGlFJmftvs5ZiO4tsP19fCo4CrJeq_UEvQR1liVfE,39891
332
332
  alita_sdk/tools/utils/__init__.py,sha256=xB9OQgW65DftadrSpoAAitnEIbIXZKBOCji0NDe7FRM,3923
333
333
  alita_sdk/tools/utils/available_tools_decorator.py,sha256=IbrdfeQkswxUFgvvN7-dyLMZMyXLiwvX7kgi3phciCk,273
334
- alita_sdk/tools/utils/content_parser.py,sha256=7ohj8HeL_-rmc-Fv0TS8IpxIQC8tOpfuhyT3XlWx-gQ,15368
334
+ alita_sdk/tools/utils/content_parser.py,sha256=-zRABq9-qITrslIo6so0iSGMhjZjJOvLRT8KjKvZT5g,15680
335
335
  alita_sdk/tools/vector_adapters/VectorStoreAdapter.py,sha256=-9ByRh8bVRraTcJPS7SE-2l3en6A4UkKGS9iAd9fa3w,19722
336
336
  alita_sdk/tools/vector_adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
337
337
  alita_sdk/tools/xray/__init__.py,sha256=eOMWP8VamFbbJgt1xrGpGPqB9ByOTA0Cd3LCaETzGk4,4376
@@ -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.411.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
357
- alita_sdk-0.3.411.dist-info/METADATA,sha256=OAQs8F9qR3gpOkt1_JRbaA2m-pOt-JX4v-mOPfxATeE,19071
358
- alita_sdk-0.3.411.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
359
- alita_sdk-0.3.411.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
360
- alita_sdk-0.3.411.dist-info/RECORD,,
356
+ alita_sdk-0.3.412.post1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
357
+ alita_sdk-0.3.412.post1.dist-info/METADATA,sha256=sau81SODpRBYAI4JH0vc014TBOE1hHJo9QkI7QsaPXU,19077
358
+ alita_sdk-0.3.412.post1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
359
+ alita_sdk-0.3.412.post1.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
360
+ alita_sdk-0.3.412.post1.dist-info/RECORD,,