alita-sdk 0.3.158__py3-none-any.whl → 0.3.160__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/clients/artifact.py +2 -2
- alita_sdk/runtime/toolkits/tools.py +1 -0
- alita_sdk/runtime/tools/artifact.py +5 -2
- alita_sdk/tools/utils/content_parser.py +16 -6
- {alita_sdk-0.3.158.dist-info → alita_sdk-0.3.160.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.158.dist-info → alita_sdk-0.3.160.dist-info}/RECORD +9 -9
- {alita_sdk-0.3.158.dist-info → alita_sdk-0.3.160.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.158.dist-info → alita_sdk-0.3.160.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.158.dist-info → alita_sdk-0.3.160.dist-info}/top_level.txt +0 -0
@@ -24,7 +24,7 @@ class Artifact:
|
|
24
24
|
logger.error(f"Error: {e}")
|
25
25
|
return f"Error: {e}"
|
26
26
|
|
27
|
-
def get(self, artifact_name: str, bucket_name: str = None, is_capture_image: bool = False, page_number: int = None):
|
27
|
+
def get(self, artifact_name: str, bucket_name: str = None, is_capture_image: bool = False, page_number: int = None, sheet_name: str = None):
|
28
28
|
if not bucket_name:
|
29
29
|
bucket_name = self.bucket_name
|
30
30
|
data = self.client.download_artifact(bucket_name, artifact_name)
|
@@ -37,7 +37,7 @@ class Artifact:
|
|
37
37
|
if detected['encoding'] is not None:
|
38
38
|
return data.decode(detected['encoding'])
|
39
39
|
else:
|
40
|
-
return parse_file_content(artifact_name, data, is_capture_image, page_number)
|
40
|
+
return parse_file_content(artifact_name, data, is_capture_image, page_number, sheet_name)
|
41
41
|
|
42
42
|
def delete(self, artifact_name: str, bucket_name = None):
|
43
43
|
if not bucket_name:
|
@@ -67,6 +67,7 @@ def get_tools(tools_list: list, alita_client, llm, memory_store: BaseStore = Non
|
|
67
67
|
selected_tools=[],
|
68
68
|
llm=llm
|
69
69
|
))
|
70
|
+
# move on tools level
|
70
71
|
# elif tool['type'] == 'memory':
|
71
72
|
# if memory_store is None:
|
72
73
|
# raise ToolException(f"Memory store is not provided for memory tool: {tool['name']}")
|
@@ -23,8 +23,8 @@ class ArtifactWrapper(BaseToolApiWrapper):
|
|
23
23
|
def create_file(self, filename: str, filedata: str, bucket_name = None):
|
24
24
|
return self.artifact.create(filename, filedata, bucket_name)
|
25
25
|
|
26
|
-
def read_file(self, filename: str, bucket_name = None, is_capture_image: bool = False, page_number: int = None):
|
27
|
-
return self.artifact.get(filename, bucket_name, is_capture_image, page_number)
|
26
|
+
def read_file(self, filename: str, bucket_name = None, is_capture_image: bool = False, page_number: int = None, sheet_name: str = None):
|
27
|
+
return self.artifact.get(filename, bucket_name, is_capture_image, page_number, sheet_name)
|
28
28
|
|
29
29
|
def delete_file(self, filename: str, bucket_name = None):
|
30
30
|
return self.artifact.delete(filename, bucket_name)
|
@@ -75,6 +75,9 @@ class ArtifactWrapper(BaseToolApiWrapper):
|
|
75
75
|
default=False)),
|
76
76
|
page_number=(Optional[int], Field(
|
77
77
|
description="Specifies which page to read. If it is None, then full document will be read.",
|
78
|
+
default=None)),
|
79
|
+
sheet_name=(Optional[str], Field(
|
80
|
+
description="Specifies which sheet to read. If it is None, then full document will be read.",
|
78
81
|
default=None))
|
79
82
|
)
|
80
83
|
},
|
@@ -9,13 +9,13 @@ import pymupdf
|
|
9
9
|
from langchain_core.tools import ToolException
|
10
10
|
from transformers import BlipProcessor, BlipForConditionalGeneration
|
11
11
|
|
12
|
-
def parse_file_content(file_name, file_content, is_capture_image: bool = False, page_number: int = None):
|
12
|
+
def parse_file_content(file_name, file_content, is_capture_image: bool = False, page_number: int = None, sheet_name: str = None):
|
13
13
|
if file_name.endswith('.txt'):
|
14
14
|
return parse_txt(file_content)
|
15
15
|
elif file_name.endswith('.docx'):
|
16
16
|
return read_docx_from_bytes(file_content)
|
17
17
|
elif file_name.endswith('.xlsx') or file_name.endswith('.xls'):
|
18
|
-
return parse_excel(file_content)
|
18
|
+
return parse_excel(file_content, sheet_name)
|
19
19
|
elif file_name.endswith('.pdf'):
|
20
20
|
return parse_pdf(file_content, page_number, is_capture_image)
|
21
21
|
elif file_name.endswith('.pptx'):
|
@@ -30,15 +30,25 @@ def parse_txt(file_content):
|
|
30
30
|
except Exception as e:
|
31
31
|
return ToolException(f"Error decoding file content: {e}")
|
32
32
|
|
33
|
-
def parse_excel(file_content):
|
33
|
+
def parse_excel(file_content, sheet_name = None):
|
34
34
|
try:
|
35
35
|
excel_file = io.BytesIO(file_content)
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
if sheet_name:
|
37
|
+
return parse_sheet(excel_file, sheet_name)
|
38
|
+
dfs = pd.read_excel(excel_file, sheet_name=sheet_name)
|
39
|
+
result = []
|
40
|
+
for sheet_name, df in dfs.items():
|
41
|
+
df.fillna('', inplace=True)
|
42
|
+
result.append(f"=== Sheet: {sheet_name} ===\n{df.to_string(index=False)}")
|
43
|
+
return "\n\n".join(result)
|
39
44
|
except Exception as e:
|
40
45
|
return ToolException(f"Error reading Excel file: {e}")
|
41
46
|
|
47
|
+
def parse_sheet(excel_file, sheet_name):
|
48
|
+
df = pd.read_excel(excel_file, sheet_name=sheet_name)
|
49
|
+
df.fillna('', inplace=True)
|
50
|
+
return df.to_string()
|
51
|
+
|
42
52
|
def parse_pdf(file_content, page_number, is_capture_image):
|
43
53
|
with pymupdf.open(stream=file_content, filetype="pdf") as report:
|
44
54
|
text_content = ''
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.160
|
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 <lifedjik@gmail.com>
|
6
6
|
License-Expression: Apache-2.0
|
@@ -43,7 +43,7 @@ alita_sdk/community/deep_researcher/utils/md_to_pdf.py,sha256=EgCaUGLsP5-5F301aB
|
|
43
43
|
alita_sdk/community/deep_researcher/utils/os.py,sha256=Q1xX7c7_p7EmuzzXIAY9TDmraDNvU0GGcpfgIfWKQ2A,793
|
44
44
|
alita_sdk/runtime/__init__.py,sha256=4W0UF-nl3QF2bvET5lnah4o24CoTwSoKXhuN0YnwvEE,828
|
45
45
|
alita_sdk/runtime/clients/__init__.py,sha256=BdehU5GBztN1Qi1Wul0cqlU46FxUfMnI6Vq2Zd_oq1M,296
|
46
|
-
alita_sdk/runtime/clients/artifact.py,sha256=
|
46
|
+
alita_sdk/runtime/clients/artifact.py,sha256=4N2t5x3GibyXLq3Fvrv2o_VA7Z000yNfc-UN4eGsHZg,2679
|
47
47
|
alita_sdk/runtime/clients/client.py,sha256=jbC_M72CybwZgFfMRL6paj-NmICrSuk1vVnVTm_u-kc,19734
|
48
48
|
alita_sdk/runtime/clients/datasource.py,sha256=HAZovoQN9jBg0_-lIlGBQzb4FJdczPhkHehAiVG3Wx0,1020
|
49
49
|
alita_sdk/runtime/clients/prompt.py,sha256=li1RG9eBwgNK_Qf0qUaZ8QNTmsncFrAL2pv3kbxZRZg,1447
|
@@ -102,12 +102,12 @@ alita_sdk/runtime/toolkits/artifact.py,sha256=7fTr9VpGd2zwCB3EwW4aqWa5jVKRTunqV3
|
|
102
102
|
alita_sdk/runtime/toolkits/datasource.py,sha256=qk78OdPoReYPCWwahfkKLbKc4pfsu-061oXRryFLP6I,2498
|
103
103
|
alita_sdk/runtime/toolkits/prompt.py,sha256=WIpTkkVYWqIqOWR_LlSWz3ug8uO9tm5jJ7aZYdiGRn0,1192
|
104
104
|
alita_sdk/runtime/toolkits/subgraph.py,sha256=ZYqI4yVLbEPAjCR8dpXbjbL2ipX598Hk3fL6AgaqFD4,1758
|
105
|
-
alita_sdk/runtime/toolkits/tools.py,sha256=
|
105
|
+
alita_sdk/runtime/toolkits/tools.py,sha256=gCIEtdeD9u-za-oIZtJ916r9oSR9_0gCWE5FIKynWdU,6148
|
106
106
|
alita_sdk/runtime/toolkits/vectorstore.py,sha256=BGppQADa1ZiLO17fC0uCACTTEvPHlodEDYEzUcBRbAA,2901
|
107
107
|
alita_sdk/runtime/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
108
108
|
alita_sdk/runtime/tools/agent.py,sha256=m98QxOHwnCRTT9j18Olbb5UPS8-ZGeQaGiUyZJSyFck,3162
|
109
109
|
alita_sdk/runtime/tools/application.py,sha256=7XSqwASZGihvQ9uZxnQp61ypFT6twrzBH_BIFC1cX0w,2785
|
110
|
-
alita_sdk/runtime/tools/artifact.py,sha256
|
110
|
+
alita_sdk/runtime/tools/artifact.py,sha256=ILpRclmyHCqz1Byb0zV9LBzI6r9YooNq7-2EYQZCTxU,6412
|
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
113
|
alita_sdk/runtime/tools/function.py,sha256=ZFpd7TGwIawze2e7BHlKwP0NHwNw42wwrmmnXyJQJhk,2600
|
@@ -303,7 +303,7 @@ alita_sdk/tools/testio/api_wrapper.py,sha256=BvmL5h634BzG6p7ajnQLmj-uoAw1gjWnd4F
|
|
303
303
|
alita_sdk/tools/testrail/__init__.py,sha256=83G9oS2fSiATLnW9783LqdoDyubgnmABEk-1hQcsTGE,3805
|
304
304
|
alita_sdk/tools/testrail/api_wrapper.py,sha256=QkF1j2QIdtqeWUZB0GYtdmKATu0gPTQVmM5faK-ASaI,24495
|
305
305
|
alita_sdk/tools/utils/__init__.py,sha256=155xepXPr4OEzs2Mz5YnjXcBpxSv1X2eznRUVoPtyK0,3268
|
306
|
-
alita_sdk/tools/utils/content_parser.py,sha256
|
306
|
+
alita_sdk/tools/utils/content_parser.py,sha256=cdAENBS2-KPBAVbUczsuT-YJEdouKQ0SxCU6bWFfgak,4736
|
307
307
|
alita_sdk/tools/xray/__init__.py,sha256=dn-Ine9mHF8c_yZ-pWkn-gvSvSmGwdrqxPJOz6Cmqc4,3297
|
308
308
|
alita_sdk/tools/xray/api_wrapper.py,sha256=l7Cwvh_5bEaH0IM3yLo1PSClqV1E20wH_sEHaJntM3s,8517
|
309
309
|
alita_sdk/tools/yagmail/__init__.py,sha256=c4Qn3em0tLxzRmFKpzbBgY9W2EnOoKf0azoDJHng5CY,2208
|
@@ -317,8 +317,8 @@ alita_sdk/tools/zephyr_enterprise/api_wrapper.py,sha256=Ir3zHljhbZQJRJJQOBzS_GL5
|
|
317
317
|
alita_sdk/tools/zephyr_enterprise/zephyr_enterprise.py,sha256=hV9LIrYfJT6oYp-ZfQR0YHflqBFPsUw2Oc55HwK0H48,6809
|
318
318
|
alita_sdk/tools/zephyr_scale/__init__.py,sha256=2NTcdrfkx4GSegqyXhsPLsEpc4FlACuDy85b0fk6cAo,4572
|
319
319
|
alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=UHVQUVqcBc3SZvDfO78HSuBzwAsRw2cCDQa-xMOzndE,68663
|
320
|
-
alita_sdk-0.3.
|
321
|
-
alita_sdk-0.3.
|
322
|
-
alita_sdk-0.3.
|
323
|
-
alita_sdk-0.3.
|
324
|
-
alita_sdk-0.3.
|
320
|
+
alita_sdk-0.3.160.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
321
|
+
alita_sdk-0.3.160.dist-info/METADATA,sha256=zzsqORk7WyWsRCx16yd_XAAXbn6SZbLLrQuAj_oGgI4,18667
|
322
|
+
alita_sdk-0.3.160.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
323
|
+
alita_sdk-0.3.160.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
324
|
+
alita_sdk-0.3.160.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|