alita-sdk 0.3.348__py3-none-any.whl → 0.3.349__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.

Potentially problematic release.


This version of alita-sdk might be problematic. Click here for more details.

@@ -201,7 +201,7 @@ class AlitaExcelLoader(AlitaTableLoader):
201
201
  return docs
202
202
 
203
203
  def read(self, lazy: bool = False):
204
- df = pd.read_excel(self.file_path, sheet_name=None)
204
+ df = pd.read_excel(self.file_path, sheet_name=None, engine='calamine')
205
205
  docs = []
206
206
  for key in df.keys():
207
207
  if self.raw_content:
@@ -212,7 +212,7 @@ class AlitaExcelLoader(AlitaTableLoader):
212
212
  return docs
213
213
 
214
214
  def read_lazy(self) -> Iterator[dict]:
215
- df = pd.read_excel(self.file_path, sheet_name=None)
215
+ df = pd.read_excel(self.file_path, sheet_name=None, engine='calamine')
216
216
  for key in df.keys():
217
217
  if self.raw_content:
218
218
  yield df[key].to_string()
@@ -1,4 +1,5 @@
1
1
  import logging
2
+ import re
2
3
  from typing import Union, Any, Optional, Annotated, get_type_hints
3
4
  from uuid import uuid4
4
5
  from typing import Dict
@@ -274,11 +275,20 @@ class StateModifierNode(Runnable):
274
275
  logger.warning(f"Failed to decode base64 value: {e}")
275
276
  return value
276
277
 
278
+ def split_by_words(value, chunk_size=100):
279
+ words = value.split()
280
+ return [" ".join(words[i:i + chunk_size]) for i in range(0, len(words), chunk_size)]
281
+
282
+ def split_by_regex(value, pattern):
283
+ """Splits the provided string using the specified regex pattern."""
284
+ return re.split(pattern, value)
277
285
 
278
286
  env = Environment()
279
287
  env.filters['from_json'] = from_json
280
- env.filters['base64ToString'] = base64_to_string
281
-
288
+ env.filters['base64_to_string'] = base64_to_string
289
+ env.filters['split_by_words'] = split_by_words
290
+ env.filters['split_by_regex'] = split_by_regex
291
+
282
292
  template = env.from_string(self.template)
283
293
  rendered_message = template.render(**input_data)
284
294
  result = {}
@@ -3,6 +3,7 @@ import logging
3
3
  import re
4
4
  from typing import Any, Optional, Generator, List
5
5
 
6
+ from langchain_core.callbacks import dispatch_custom_event
6
7
  from langchain_core.documents import Document
7
8
  from langchain_core.tools import ToolException
8
9
  from pydantic import create_model, Field, model_validator
@@ -30,7 +31,21 @@ class ArtifactWrapper(NonCodeIndexerToolkit):
30
31
  return self.artifact.list(bucket_name, return_as_string)
31
32
 
32
33
  def create_file(self, filename: str, filedata: str, bucket_name = None):
33
- return self.artifact.create(filename, filedata, bucket_name)
34
+ result = self.artifact.create(filename, filedata, bucket_name)
35
+
36
+ # Dispatch custom event for file creation
37
+ dispatch_custom_event("file_modified", {
38
+ "message": f"File '{filename}' created successfully",
39
+ "filename": filename,
40
+ "tool_name": "createFile",
41
+ "toolkit": "artifact",
42
+ "operation_type": "create",
43
+ "meta": {
44
+ "bucket": bucket_name or self.bucket
45
+ }
46
+ })
47
+
48
+ return result
34
49
 
35
50
  def read_file(self,
36
51
  filename: str,
@@ -51,10 +66,38 @@ class ArtifactWrapper(NonCodeIndexerToolkit):
51
66
  return self.artifact.delete(filename, bucket_name)
52
67
 
53
68
  def append_data(self, filename: str, filedata: str, bucket_name = None):
54
- return self.artifact.append(filename, filedata, bucket_name)
69
+ result = self.artifact.append(filename, filedata, bucket_name)
70
+
71
+ # Dispatch custom event for file append
72
+ dispatch_custom_event("file_modified", {
73
+ "message": f"Data appended to file '{filename}' successfully",
74
+ "filename": filename,
75
+ "tool_name": "appendData",
76
+ "toolkit": "artifact",
77
+ "operation_type": "modify",
78
+ "meta": {
79
+ "bucket": bucket_name or self.bucket
80
+ }
81
+ })
82
+
83
+ return result
55
84
 
56
85
  def overwrite_data(self, filename: str, filedata: str, bucket_name = None):
57
- return self.artifact.overwrite(filename, filedata, bucket_name)
86
+ result = self.artifact.overwrite(filename, filedata, bucket_name)
87
+
88
+ # Dispatch custom event for file overwrite
89
+ dispatch_custom_event("file_modified", {
90
+ "message": f"File '{filename}' overwritten successfully",
91
+ "filename": filename,
92
+ "tool_name": "overwriteData",
93
+ "toolkit": "artifact",
94
+ "operation_type": "modify",
95
+ "meta": {
96
+ "bucket": bucket_name or self.bucket
97
+ }
98
+ })
99
+
100
+ return result
58
101
 
59
102
  def create_new_bucket(self, bucket_name: str, expiration_measure = "weeks", expiration_value = 1):
60
103
  return self.artifact.client.create_bucket(bucket_name, expiration_measure, expiration_value)
@@ -279,7 +279,8 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
279
279
  """Cleans the indexed data in the collection."""
280
280
  super()._clean_collection(collection_suffix=collection_suffix)
281
281
  return (f"Collection '{collection_suffix}' has been removed from the vector store.\n"
282
- f"Available collections: {self.list_collections()}")
282
+ f"Available collections: {self.list_collections()}") if collection_suffix \
283
+ else "All collections have been removed from the vector store."
283
284
 
284
285
  def _build_collection_filter(self, filter: dict | str, collection_suffix: str = "") -> dict:
285
286
  """Builds a filter for the collection based on the provided suffix."""
@@ -93,7 +93,7 @@ class PandasWrapper(BaseToolApiWrapper):
93
93
  if file_extension in ['csv', 'txt']:
94
94
  df = pd.read_csv(file_obj)
95
95
  elif file_extension in ['xlsx', 'xls']:
96
- df = pd.read_excel(file_obj)
96
+ df = pd.read_excel(file_obj, engine='calamine')
97
97
  elif file_extension == 'parquet':
98
98
  df = pd.read_parquet(file_obj)
99
99
  elif file_extension == 'json':
@@ -162,35 +162,17 @@ class PandasWrapper(BaseToolApiWrapper):
162
162
  """Analyze and process using query on dataset"""
163
163
  df = self._get_dataframe(filename)
164
164
  code = self.generate_code_with_retries(df, query)
165
- dispatch_custom_event(
166
- name="thinking_step",
167
- data={
168
- "message": f"Executing generated code... \n\n```python\n{code}\n```",
169
- "tool_name": "process_query",
170
- "toolkit": "pandas"
171
- }
172
- )
165
+ self._log_tool_event(tool_name="process_query",
166
+ message=f"Executing generated code... \n\n```python\n{code}\n```")
173
167
  try:
174
168
  result = self.execute_code(df, code)
175
169
  except Exception as e:
176
170
  logger.error(f"Code execution failed: {format_exc()}")
177
- dispatch_custom_event(
178
- name="thinking_step",
179
- data={
180
- "message": f"Code execution failed: {format_exc()}",
181
- "tool_name": "process_query",
182
- "toolkit": "pandas"
183
- }
184
- )
171
+ self._log_tool_event(tool_name="process_query",
172
+ message=f"Executing generated code... \n\n```python\n{code}\n```")
185
173
  raise
186
- dispatch_custom_event(
187
- name="thinking_step",
188
- data={
189
- "message": f"Result of code execution... \n\n```\n{result['result']}\n```",
190
- "tool_name": "process_query",
191
- "toolkit": "pandas"
192
- }
193
- )
174
+ self._log_tool_event(tool_name="process_query",
175
+ message=f"Executing generated code... \n\n```python\n{code}\n```")
194
176
  if result.get("df") is not None:
195
177
  df = result.pop("df")
196
178
  # Not saving dataframe to artifact repo for now
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.348
3
+ Version: 0.3.349
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
@@ -128,6 +128,7 @@ Requires-Dist: textract-py3==2.1.1; extra == "tools"
128
128
  Requires-Dist: slack_sdk==3.35.0; extra == "tools"
129
129
  Requires-Dist: deltalake==1.0.2; extra == "tools"
130
130
  Requires-Dist: google_cloud_bigquery==3.34.0; extra == "tools"
131
+ Requires-Dist: python-calamine==0.5.3; extra == "tools"
131
132
  Provides-Extra: community
132
133
  Requires-Dist: retry-extended==0.2.3; extra == "community"
133
134
  Requires-Dist: pyobjtojson==0.3; extra == "community"
@@ -44,7 +44,7 @@ alita_sdk/runtime/langchain/assistant.py,sha256=lF46zxtEg8Tnims5gm-24jvjvUoJ28GB
44
44
  alita_sdk/runtime/langchain/chat_message_template.py,sha256=kPz8W2BG6IMyITFDA5oeb5BxVRkHEVZhuiGl4MBZKdc,2176
45
45
  alita_sdk/runtime/langchain/constants.py,sha256=eHVJ_beJNTf1WJo4yq7KMK64fxsRvs3lKc34QCXSbpk,3319
46
46
  alita_sdk/runtime/langchain/indexer.py,sha256=0ENHy5EOhThnAiYFc7QAsaTNp9rr8hDV_hTK8ahbatk,37592
47
- alita_sdk/runtime/langchain/langraph_agent.py,sha256=5I5l4zpbKeHy9JONwkkrEyFAMzpBY_BBeAOhHPwmWB8,46866
47
+ alita_sdk/runtime/langchain/langraph_agent.py,sha256=XR6M_MufA0HEtfAESbHfXNU3DF45rh_H8z14wDfs1V8,47339
48
48
  alita_sdk/runtime/langchain/mixedAgentParser.py,sha256=M256lvtsL3YtYflBCEp-rWKrKtcY1dJIyRGVv7KW9ME,2611
49
49
  alita_sdk/runtime/langchain/mixedAgentRenderes.py,sha256=asBtKqm88QhZRILditjYICwFVKF5KfO38hu2O-WrSWE,5964
50
50
  alita_sdk/runtime/langchain/store_manager.py,sha256=i8Fl11IXJhrBXq1F1ukEVln57B1IBe-tqSUvfUmBV4A,2218
@@ -56,7 +56,7 @@ alita_sdk/runtime/langchain/document_loaders/AlitaCSVLoader.py,sha256=3ne-a5qIkB
56
56
  alita_sdk/runtime/langchain/document_loaders/AlitaConfluenceLoader.py,sha256=NzpoL4C7UzyzLouTSL_xTQw70MitNt-WZz3Eyl7QkTA,8294
57
57
  alita_sdk/runtime/langchain/document_loaders/AlitaDirectoryLoader.py,sha256=fKezkgvIcLG7S2PVJp1a8sZd6C4XQKNZKAFC87DbQts,7003
58
58
  alita_sdk/runtime/langchain/document_loaders/AlitaDocxMammothLoader.py,sha256=9hi5eHgDIfa9wBWqTuwMM6D6W64czrDTfZl_htooe8Y,5943
59
- alita_sdk/runtime/langchain/document_loaders/AlitaExcelLoader.py,sha256=h8x1Xma_IBM4NdGXVVuvHHSlFQgY0S7Xjj8oGZhdFL8,9256
59
+ alita_sdk/runtime/langchain/document_loaders/AlitaExcelLoader.py,sha256=YI8QaHRjCl8WtxuQKMXi_iTJBZ6da3OTNgoDFqNjz1g,9294
60
60
  alita_sdk/runtime/langchain/document_loaders/AlitaGitRepoLoader.py,sha256=5WXGcyHraSVj3ANHj_U6X4EDikoekrIYtS0Q_QqNIng,2608
61
61
  alita_sdk/runtime/langchain/document_loaders/AlitaImageLoader.py,sha256=QwgBJE-BvOasjgT1hYHZc0MP0F_elirUjSzKixoM6fY,6610
62
62
  alita_sdk/runtime/langchain/document_loaders/AlitaJSONLoader.py,sha256=Nav2cgCQKOHQi_ZgYYn_iFdP_Os56KVlVR5nHGXecBc,3445
@@ -106,7 +106,7 @@ alita_sdk/runtime/toolkits/vectorstore.py,sha256=BGppQADa1ZiLO17fC0uCACTTEvPHlod
106
106
  alita_sdk/runtime/tools/__init__.py,sha256=7OA8YPKlEOfXu3-gJA08cyR-VymjSPL-OmbXI-B2xVA,355
107
107
  alita_sdk/runtime/tools/agent.py,sha256=m98QxOHwnCRTT9j18Olbb5UPS8-ZGeQaGiUyZJSyFck,3162
108
108
  alita_sdk/runtime/tools/application.py,sha256=z3vLZODs-_xEEnZFmGF0fKz1j3VtNJxqsAmg5ovExpQ,3129
109
- alita_sdk/runtime/tools/artifact.py,sha256=4xA_va11WxO0fQclavKivRo24GI1b5qpsp2YZt7RxGY,10795
109
+ alita_sdk/runtime/tools/artifact.py,sha256=wh2e9JSVBZzJHhNOANhHFF6BaK0RtuZ3kvhkqTrTbys,12234
110
110
  alita_sdk/runtime/tools/datasource.py,sha256=pvbaSfI-ThQQnjHG-QhYNSTYRnZB0rYtZFpjCfpzxYI,2443
111
111
  alita_sdk/runtime/tools/echo.py,sha256=spw9eCweXzixJqHnZofHE1yWiSUa04L4VKycf3KCEaM,486
112
112
  alita_sdk/runtime/tools/function.py,sha256=0iZJ-UxaPbtcXAVX9G5Vsn7vmD7lrz3cBG1qylto1gs,2844
@@ -134,7 +134,7 @@ alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7r
134
134
  alita_sdk/runtime/utils/toolkit_utils.py,sha256=I9QFqnaqfVgN26LUr6s3XlBlG6y0CoHURnCzG7XcwVs,5311
135
135
  alita_sdk/runtime/utils/utils.py,sha256=VXNLsdeTmf6snn9EtUyobv4yL-xzLhUcH8P_ORMifYc,675
136
136
  alita_sdk/tools/__init__.py,sha256=jUj1ztC2FbkIUB-YYmiqaz_rqW7Il5kWzDPn1mJmj5w,10545
137
- alita_sdk/tools/base_indexer_toolkit.py,sha256=IKtnJVX27yPu8bBWgbl-5YfUQy4pJPnBoRBFLkqagoc,20228
137
+ alita_sdk/tools/base_indexer_toolkit.py,sha256=hRo93pgb8uJbQgxPle5n7CtLbSbY97jfVq2GKkoNzvc,20328
138
138
  alita_sdk/tools/elitea_base.py,sha256=up3HshASSDfjlHV_HPrs1aD4JIwwX0Ug26WGTzgIYvY,34724
139
139
  alita_sdk/tools/non_code_indexer_toolkit.py,sha256=B3QvhpT1F9QidkCcsOi3J_QrTOaNlTxqWFwe90VivQQ,1329
140
140
  alita_sdk/tools/ado/__init__.py,sha256=NnNYpNFW0_N_v1td_iekYOoQRRB7PIunbpT2f9ZFJM4,1201
@@ -276,7 +276,7 @@ alita_sdk/tools/ocr/api_wrapper.py,sha256=08UF8wj1sR8DcW0z16pw19bgLatLkBF8dySW-D
276
276
  alita_sdk/tools/ocr/text_detection.py,sha256=1DBxt54r3_HdEi93QynSIVta3rH3UpIvy799TPtDTtk,23825
277
277
  alita_sdk/tools/openapi/__init__.py,sha256=x1U4SGApL6MmNFz9SSsQCv352wMAIdGv0z4eMmYnjCw,4984
278
278
  alita_sdk/tools/pandas/__init__.py,sha256=rGenKJH5b9__qM4GerpyLT5YEhNk7W1gA7gn6Zpew04,2748
279
- alita_sdk/tools/pandas/api_wrapper.py,sha256=froH0h7NPPyFUHWNioESzJ-PQQ522oBM7hNTMfh3qAw,11494
279
+ alita_sdk/tools/pandas/api_wrapper.py,sha256=wn0bagB45Tz_kN0FoKUCIxKcYklMMWTqQP5NOM8_Kwc,11100
280
280
  alita_sdk/tools/pandas/dataframe/__init__.py,sha256=iOZRlYDEtwqg2MaYFFxETjN8yHAkUqSNe86cm6ao4LA,108
281
281
  alita_sdk/tools/pandas/dataframe/errors.py,sha256=MBzpi5e2p3lNKxiVadzuT5A_DwuTT8cpJ059rXsdabs,320
282
282
  alita_sdk/tools/pandas/dataframe/prompts.py,sha256=Zvc-LQ7MifldDTuhxbi-RkpAyO5Gae1wDBtTU6Ygs3k,2884
@@ -350,8 +350,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=kT0TbmMvuKhDUZc0i7KO18O38JM9S
350
350
  alita_sdk/tools/zephyr_squad/__init__.py,sha256=0ne8XLJEQSLOWfzd2HdnqOYmQlUliKHbBED5kW_Vias,2895
351
351
  alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
352
352
  alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
353
- alita_sdk-0.3.348.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
354
- alita_sdk-0.3.348.dist-info/METADATA,sha256=_oiAJpxGjG23s01B-P41PkJqG1oUgdAgS7QUnlyS5gc,19015
355
- alita_sdk-0.3.348.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
356
- alita_sdk-0.3.348.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
357
- alita_sdk-0.3.348.dist-info/RECORD,,
353
+ alita_sdk-0.3.349.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
354
+ alita_sdk-0.3.349.dist-info/METADATA,sha256=7-TBm0rWMDR8iCwUI1ixF6841zGe1wyOqfeGEoLkiRU,19071
355
+ alita_sdk-0.3.349.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
356
+ alita_sdk-0.3.349.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
357
+ alita_sdk-0.3.349.dist-info/RECORD,,