alita-sdk 0.3.209__py3-none-any.whl → 0.3.210__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.
Files changed (47) hide show
  1. alita_sdk/runtime/clients/artifact.py +18 -4
  2. alita_sdk/runtime/langchain/document_loaders/AlitaCSVLoader.py +2 -1
  3. alita_sdk/runtime/langchain/document_loaders/AlitaDocxMammothLoader.py +3 -3
  4. alita_sdk/runtime/langchain/document_loaders/AlitaImageLoader.py +8 -4
  5. alita_sdk/runtime/langchain/document_loaders/AlitaTableLoader.py +1 -1
  6. alita_sdk/runtime/langchain/langraph_agent.py +1 -1
  7. alita_sdk/runtime/toolkits/artifact.py +7 -3
  8. alita_sdk/runtime/toolkits/tools.py +8 -1
  9. alita_sdk/runtime/tools/application.py +2 -0
  10. alita_sdk/runtime/tools/artifact.py +65 -8
  11. alita_sdk/runtime/tools/vectorstore.py +125 -41
  12. alita_sdk/runtime/utils/utils.py +3 -0
  13. alita_sdk/tools/ado/__init__.py +8 -0
  14. alita_sdk/tools/ado/repos/repos_wrapper.py +37 -0
  15. alita_sdk/tools/ado/test_plan/test_plan_wrapper.py +0 -7
  16. alita_sdk/tools/ado/work_item/__init__.py +4 -0
  17. alita_sdk/tools/ado/work_item/ado_wrapper.py +37 -4
  18. alita_sdk/tools/aws/delta_lake/__init__.py +1 -1
  19. alita_sdk/tools/bitbucket/__init__.py +13 -1
  20. alita_sdk/tools/bitbucket/api_wrapper.py +31 -4
  21. alita_sdk/tools/bitbucket/cloud_api_wrapper.py +31 -0
  22. alita_sdk/tools/chunkers/code/codeparser.py +18 -10
  23. alita_sdk/tools/confluence/api_wrapper.py +35 -134
  24. alita_sdk/tools/confluence/loader.py +30 -28
  25. alita_sdk/tools/elitea_base.py +112 -11
  26. alita_sdk/tools/figma/__init__.py +13 -1
  27. alita_sdk/tools/figma/api_wrapper.py +47 -3
  28. alita_sdk/tools/github/api_wrapper.py +8 -0
  29. alita_sdk/tools/github/github_client.py +18 -0
  30. alita_sdk/tools/gitlab/__init__.py +4 -0
  31. alita_sdk/tools/gitlab/api_wrapper.py +10 -0
  32. alita_sdk/tools/google/bigquery/__init__.py +1 -1
  33. alita_sdk/tools/jira/__init__.py +21 -13
  34. alita_sdk/tools/jira/api_wrapper.py +285 -5
  35. alita_sdk/tools/sharepoint/__init__.py +11 -1
  36. alita_sdk/tools/sharepoint/api_wrapper.py +23 -53
  37. alita_sdk/tools/testrail/__init__.py +4 -0
  38. alita_sdk/tools/testrail/api_wrapper.py +21 -54
  39. alita_sdk/tools/utils/content_parser.py +72 -8
  40. alita_sdk/tools/xray/__init__.py +8 -1
  41. alita_sdk/tools/xray/api_wrapper.py +505 -14
  42. alita_sdk/tools/zephyr_scale/api_wrapper.py +5 -5
  43. {alita_sdk-0.3.209.dist-info → alita_sdk-0.3.210.dist-info}/METADATA +1 -1
  44. {alita_sdk-0.3.209.dist-info → alita_sdk-0.3.210.dist-info}/RECORD +47 -47
  45. {alita_sdk-0.3.209.dist-info → alita_sdk-0.3.210.dist-info}/WHEEL +0 -0
  46. {alita_sdk-0.3.209.dist-info → alita_sdk-0.3.210.dist-info}/licenses/LICENSE +0 -0
  47. {alita_sdk-0.3.209.dist-info → alita_sdk-0.3.210.dist-info}/top_level.txt +0 -0
@@ -61,7 +61,7 @@ IMAGE_EXTENSIONS = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'tiff', 'webp', 'svg']
61
61
 
62
62
 
63
63
  def parse_file_content(file_name=None, file_content=None, is_capture_image: bool = False, page_number: int = None,
64
- sheet_name: str = None, llm=None, file_path: str = None):
64
+ sheet_name: str = None, llm=None, file_path: str = None, excel_by_sheets: bool = False):
65
65
  """Parse the content of a file based on its type and return the parsed content.
66
66
 
67
67
  Args:
@@ -91,7 +91,7 @@ def parse_file_content(file_name=None, file_content=None, is_capture_image: bool
91
91
  elif file_name.endswith('.docx'):
92
92
  return read_docx_from_bytes(file_content)
93
93
  elif file_name.endswith('.xlsx') or file_name.endswith('.xls'):
94
- return parse_excel(file_content, sheet_name)
94
+ return parse_excel(file_content, sheet_name, excel_by_sheets)
95
95
  elif file_name.endswith('.pdf'):
96
96
  return parse_pdf(file_content, page_number, is_capture_image, llm)
97
97
  elif file_name.endswith('.pptx'):
@@ -109,17 +109,26 @@ def parse_txt(file_content):
109
109
  except Exception as e:
110
110
  return ToolException(f"Error decoding file content: {e}")
111
111
 
112
- def parse_excel(file_content, sheet_name = None):
112
+ def parse_excel(file_content, sheet_name = None, return_by_sheets: bool = False):
113
113
  try:
114
114
  excel_file = io.BytesIO(file_content)
115
115
  if sheet_name:
116
116
  return parse_sheet(excel_file, sheet_name)
117
117
  dfs = pd.read_excel(excel_file, sheet_name=sheet_name)
118
- result = []
119
- for sheet_name, df in dfs.items():
120
- df.fillna('', inplace=True)
121
- result.append(f"=== Sheet: {sheet_name} ===\n{df.to_string(index=False)}")
122
- return "\n\n".join(result)
118
+
119
+ if return_by_sheets:
120
+ result = {}
121
+ for sheet_name, df in dfs.items():
122
+ df.fillna('', inplace=True)
123
+ result[sheet_name] = df.to_dict(orient='records')
124
+ return result
125
+ else:
126
+ result = []
127
+ for sheet_name, df in dfs.items():
128
+ df.fillna('', inplace=True)
129
+ string_content = df.to_string(index=False)
130
+ result.append(f"====== Sheet name: {sheet_name} ======\n{string_content}")
131
+ return "\n\n".join(result)
123
132
  except Exception as e:
124
133
  return ToolException(f"Error reading Excel file: {e}")
125
134
 
@@ -194,6 +203,8 @@ def describe_image(image):
194
203
  return "\n[Picture: " + processor.decode(out[0], skip_special_tokens=True) + "]\n"
195
204
 
196
205
  def __perform_llm_prediction_for_image(llm, image: bytes, image_format='png', prompt=image_processing_prompt) -> str:
206
+ if not llm:
207
+ raise ToolException("LLM is not provided for image processing.")
197
208
  base64_string = bytes_to_base64(image)
198
209
  result = llm.invoke([
199
210
  HumanMessage(
@@ -207,6 +218,59 @@ def __perform_llm_prediction_for_image(llm, image: bytes, image_format='png', pr
207
218
  ])
208
219
  return f"\n[Image description: {result.content}]\n"
209
220
 
221
+ # TODO: review usage of this function alongside with functions above
222
+ def load_content(file_path: str, extension: str = None, loader_extra_config: dict = None, llm = None) -> str:
223
+ """
224
+ Loads the content of a file based on its extension using a configured loader.
225
+ """
226
+ try:
227
+ from ...runtime.langchain.document_loaders.constants import loaders_map
228
+
229
+ if not extension:
230
+ extension = file_path.split('.')[-1].lower()
231
+
232
+ loader_config = loaders_map.get(extension)
233
+ if not loader_config:
234
+ logger.warning(f"No loader found for file extension: {extension}. File: {file_path}")
235
+ return ""
236
+
237
+ loader_cls = loader_config['class']
238
+ loader_kwargs = loader_config['kwargs']
239
+
240
+ if loader_extra_config:
241
+ loader_kwargs.update(loader_extra_config)
242
+ if loader_config['is_multimodal_processing'] and llm:
243
+ loader_kwargs.update({'llm': llm})
244
+
245
+ loader = loader_cls(file_path, **loader_kwargs)
246
+ documents = loader.load()
247
+
248
+ page_contents = [doc.page_content for doc in documents]
249
+ return "\n".join(page_contents)
250
+ except Exception as e:
251
+ error_message = f"Error loading attachment: {str(e)}"
252
+ logger.warning(f"{error_message} for file {file_path}")
253
+ return ""
254
+
255
+ def load_content_from_bytes(file_content: bytes, extension: str = None, loader_extra_config: dict = None, llm = None) -> str:
256
+ """Loads the content of a file from bytes based on its extension using a configured loader."""
257
+
258
+ import tempfile
259
+
260
+ # Automatic cleanup with context manager
261
+ with tempfile.NamedTemporaryFile(mode='w+b', delete=True) as temp_file:
262
+ # Write data to temp file
263
+ temp_file.write(file_content)
264
+ temp_file.flush() # Ensure data is written
265
+
266
+ # Get the file path for operations
267
+ temp_path = temp_file.name
268
+
269
+ # Perform your operations
270
+ return load_content(temp_path, extension, loader_extra_config, llm)
271
+
272
+
273
+
210
274
  def file_to_bytes(filepath):
211
275
  """
212
276
  Reads a file and returns its content as a bytes object.
@@ -20,7 +20,14 @@ def get_tools(tool):
20
20
  client_secret=tool['settings'].get('client_secret', None),
21
21
  limit=tool['settings'].get('limit', 20),
22
22
  verify_ssl=tool['settings'].get('verify_ssl', True),
23
- toolkit_name=tool.get('toolkit_name')
23
+ toolkit_name=tool.get('toolkit_name'),
24
+
25
+ # indexer settings
26
+ connection_string=tool['settings'].get('connection_string', None),
27
+ collection_name=f"{tool.get('toolkit_name')}_{str(tool['id'])}",
28
+ embedding_model="HuggingFaceEmbeddings",
29
+ embedding_model_params={"model_name": "sentence-transformers/all-MiniLM-L6-v2"},
30
+ vectorstore_type="PGVector"
24
31
  ).get_tools()
25
32
 
26
33