alita-sdk 0.3.282__py3-none-any.whl → 0.3.284__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/vectorstore_base.py +1 -1
- alita_sdk/tools/base_indexer_toolkit.py +9 -2
- alita_sdk/tools/elitea_base.py +6 -2
- alita_sdk/tools/figma/api_wrapper.py +26 -11
- {alita_sdk-0.3.282.dist-info → alita_sdk-0.3.284.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.282.dist-info → alita_sdk-0.3.284.dist-info}/RECORD +9 -9
- {alita_sdk-0.3.282.dist-info → alita_sdk-0.3.284.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.282.dist-info → alita_sdk-0.3.284.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.282.dist-info → alita_sdk-0.3.284.dist-info}/top_level.txt +0 -0
@@ -158,15 +158,22 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
158
158
|
if clean_index:
|
159
159
|
self._clean_index(collection_suffix)
|
160
160
|
#
|
161
|
+
self._log_tool_event(f"Indexing data into collection with suffix '{collection_suffix}'. It can take some time...")
|
162
|
+
self._log_tool_event(f"Loading the documents to index...{kwargs}")
|
161
163
|
documents = self._base_loader(**kwargs)
|
164
|
+
self._log_tool_event(f"Base documents were loaded. "
|
165
|
+
f"Search for possible document duplicates and remove them from the indexing list...")
|
162
166
|
documents = self._reduce_duplicates(documents, collection_suffix)
|
167
|
+
self._log_tool_event(f"Duplicates were removed. "
|
168
|
+
f"Processing documents to collect dependencies and prepare them for indexing...")
|
163
169
|
documents = self._extend_data(documents) # update content of not-reduced base document if needed (for sharepoint and similar)
|
164
170
|
documents = self._collect_dependencies(documents) # collect dependencies for base documents
|
171
|
+
self._log_tool_event(f"Documents were processed. "
|
172
|
+
f"Applying chunking tool '{chunking_tool}' if specified and preparing documents for indexing...")
|
165
173
|
documents = self._apply_loaders_chunkers(documents, chunking_tool, chunking_config)
|
166
174
|
list_documents = list(documents)
|
167
175
|
self._clean_metadata(list_documents)
|
168
|
-
|
169
|
-
#
|
176
|
+
self._log_tool_event(f"Documents are ready for indexing. Total documents to index: {len(list_documents)}")
|
170
177
|
return self._save_index(list_documents, collection_suffix=collection_suffix, progress_step=progress_step)
|
171
178
|
|
172
179
|
def _apply_loaders_chunkers(self, documents: Generator[Document, None, None], chunking_tool: str=None, chunking_config=None) -> Generator[Document, None, None]:
|
alita_sdk/tools/elitea_base.py
CHANGED
@@ -576,6 +576,10 @@ class BaseCodeToolApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
576
576
|
raise ValueError("Expected a list of strings")
|
577
577
|
return _files
|
578
578
|
|
579
|
+
def __get_branch(self, branch):
|
580
|
+
return (branch or getattr(self, 'active_branch', None)
|
581
|
+
or getattr(self, '_active_branch', None) or getattr(self, 'branch', None))
|
582
|
+
|
579
583
|
def loader(self,
|
580
584
|
branch: Optional[str] = None,
|
581
585
|
whitelist: Optional[List[str]] = None,
|
@@ -601,7 +605,7 @@ class BaseCodeToolApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
601
605
|
"""
|
602
606
|
from .chunkers.code.codeparser import parse_code_files_for_db
|
603
607
|
|
604
|
-
_files = self.__handle_get_files("",
|
608
|
+
_files = self.__handle_get_files("", self.__get_branch(branch))
|
605
609
|
self._log_tool_event(message="Listing files in branch", tool_name="loader")
|
606
610
|
logger.info(f"Files in branch: {_files}")
|
607
611
|
|
@@ -624,7 +628,7 @@ class BaseCodeToolApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
624
628
|
for idx, file in enumerate(_files, 1):
|
625
629
|
if is_whitelisted(file) and not is_blacklisted(file):
|
626
630
|
# read file ONLY if it matches whitelist and does not match blacklist
|
627
|
-
file_content = self._read_file(file,
|
631
|
+
file_content = self._read_file(file, self.__get_branch(branch))
|
628
632
|
if not file_content:
|
629
633
|
# empty file, skip
|
630
634
|
continue
|
@@ -249,7 +249,9 @@ class FigmaApiWrapper(NonCodeIndexerToolkit):
|
|
249
249
|
) -> Generator[Document, None, None]:
|
250
250
|
# If both include and exclude are provided, use only include
|
251
251
|
if file_keys_include:
|
252
|
+
self._log_tool_event(f"Loading files: {file_keys_include}")
|
252
253
|
for file_key in file_keys_include:
|
254
|
+
self._log_tool_event(f"Loading file `{file_key}`")
|
253
255
|
file = self._client.get_file(file_key)
|
254
256
|
if not file:
|
255
257
|
raise ToolException(f"Unexpected error while retrieving file {file_key}. Probably file is under editing. Try again later.")
|
@@ -265,6 +267,7 @@ class FigmaApiWrapper(NonCodeIndexerToolkit):
|
|
265
267
|
}
|
266
268
|
yield Document(page_content=json.dumps(metadata), metadata=metadata)
|
267
269
|
elif project_id:
|
270
|
+
self._log_tool_event(f"Loading project files from project `{project_id}`")
|
268
271
|
files = json.loads(self.get_project_files(project_id)).get('files', [])
|
269
272
|
for file in files:
|
270
273
|
if file_keys_exclude and file.get('key', '') in file_keys_exclude:
|
@@ -286,12 +289,14 @@ class FigmaApiWrapper(NonCodeIndexerToolkit):
|
|
286
289
|
|
287
290
|
def _process_document(self, document: Document) -> Generator[Document, None, None]:
|
288
291
|
file_key = document.metadata.get('id', '')
|
292
|
+
self._log_tool_event(f"Loading details (images) for `{file_key}`")
|
289
293
|
#
|
290
294
|
figma_pages = self._client.get_file(file_key).document.get('children', [])
|
291
295
|
node_ids_include = document.metadata.pop('figma_pages_include', [])
|
292
296
|
node_ids_exclude = document.metadata.pop('figma_pages_exclude', [])
|
293
297
|
node_types_include = [t.lower() for t in document.metadata.pop('figma_nodes_include', [])]
|
294
298
|
node_types_exclude = [t.lower() for t in document.metadata.pop('figma_nodes_exclude', [])]
|
299
|
+
self._log_tool_event(f"Included pages: {node_ids_include}. Excluded pages: {node_ids_exclude}.")
|
295
300
|
if node_ids_include:
|
296
301
|
figma_pages = [node for node in figma_pages if ('id' in node and node['id'].replace(':', '-') in node_ids_include)]
|
297
302
|
elif node_ids_exclude:
|
@@ -310,7 +315,12 @@ class FigmaApiWrapper(NonCodeIndexerToolkit):
|
|
310
315
|
]
|
311
316
|
|
312
317
|
images = self._client.get_file_images(file_key, node_ids).images or {}
|
313
|
-
|
318
|
+
total_images = len(images)
|
319
|
+
if total_images == 0:
|
320
|
+
logging.info(f"No images found for file {file_key}.")
|
321
|
+
return
|
322
|
+
progress_step = max(1, total_images // 10)
|
323
|
+
for idx, (node_id, image_url) in enumerate(images.items(), 1):
|
314
324
|
if not image_url:
|
315
325
|
logging.warning(f"Image URL not found for node_id {node_id} in file {file_key}. Skipping.")
|
316
326
|
continue
|
@@ -321,17 +331,22 @@ class FigmaApiWrapper(NonCodeIndexerToolkit):
|
|
321
331
|
extension = f".{content_type.split('/')[-1]}" if content_type.startswith('image') else '.txt'
|
322
332
|
page_content = load_content_from_bytes(
|
323
333
|
file_content=response.content,
|
324
|
-
extension=extension, llm
|
334
|
+
extension=extension, llm=self.llm)
|
325
335
|
yield Document(
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
336
|
+
page_content=page_content,
|
337
|
+
metadata={
|
338
|
+
'id': node_id,
|
339
|
+
'updated_on': document.metadata.get('updated_on', ''),
|
340
|
+
'file_key': file_key,
|
341
|
+
'node_id': node_id,
|
342
|
+
'image_url': image_url
|
343
|
+
}
|
344
|
+
)
|
345
|
+
if idx % progress_step == 0 or idx == total_images:
|
346
|
+
percent = int((idx / total_images) * 100)
|
347
|
+
msg = f"Processed {idx}/{total_images} images ({percent}%) for file {file_key}."
|
348
|
+
logging.info(msg)
|
349
|
+
self._log_tool_event(msg)
|
335
350
|
|
336
351
|
def _remove_metadata_keys(self):
|
337
352
|
return super()._remove_metadata_keys() + ['figma_pages_include', 'figma_pages_exclude', 'figma_nodes_include', 'figma_nodes_exclude']
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.284
|
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>, Artem Dubrovskiy <ad13box@gmail.com>
|
6
6
|
License-Expression: Apache-2.0
|
@@ -119,7 +119,7 @@ alita_sdk/runtime/tools/prompt.py,sha256=nJafb_e5aOM1Rr3qGFCR-SKziU9uCsiP2okIMs9
|
|
119
119
|
alita_sdk/runtime/tools/router.py,sha256=wCvZjVkdXK9dMMeEerrgKf5M790RudH68pDortnHSz0,1517
|
120
120
|
alita_sdk/runtime/tools/tool.py,sha256=lE1hGi6qOAXG7qxtqxarD_XMQqTghdywf261DZawwno,5631
|
121
121
|
alita_sdk/runtime/tools/vectorstore.py,sha256=PN_Im5pkbFR6vXUhlBppEwHEhsg-UsO9eYrMS8UstFk,35826
|
122
|
-
alita_sdk/runtime/tools/vectorstore_base.py,sha256=
|
122
|
+
alita_sdk/runtime/tools/vectorstore_base.py,sha256=AoTTkpygbcstzUQsgbK0eP0RdoAS5wU-qSbbbA9U-pU,27751
|
123
123
|
alita_sdk/runtime/utils/AlitaCallback.py,sha256=E4LlSBuCHWiUq6W7IZExERHZY0qcmdjzc_rJlF2iQIw,7356
|
124
124
|
alita_sdk/runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
125
125
|
alita_sdk/runtime/utils/constants.py,sha256=Xntx1b_uxUzT4clwqHA_U6K8y5bBqf_4lSQwXdcWrp4,13586
|
@@ -131,8 +131,8 @@ alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7r
|
|
131
131
|
alita_sdk/runtime/utils/toolkit_utils.py,sha256=I9QFqnaqfVgN26LUr6s3XlBlG6y0CoHURnCzG7XcwVs,5311
|
132
132
|
alita_sdk/runtime/utils/utils.py,sha256=VXNLsdeTmf6snn9EtUyobv4yL-xzLhUcH8P_ORMifYc,675
|
133
133
|
alita_sdk/tools/__init__.py,sha256=8oFahbggsv8h7hEqqeQ4iF6g2m85Ki17iSeknviCNis,10613
|
134
|
-
alita_sdk/tools/base_indexer_toolkit.py,sha256=
|
135
|
-
alita_sdk/tools/elitea_base.py,sha256=
|
134
|
+
alita_sdk/tools/base_indexer_toolkit.py,sha256=3s8YRx_ambQQXGOKdlt_sRqREbrzFgm9zCWgxWsPHMU,20155
|
135
|
+
alita_sdk/tools/elitea_base.py,sha256=EBCgrqfaHwyhq510svtDEB0i5pizazeIPHKD1acsKAk,33121
|
136
136
|
alita_sdk/tools/non_code_indexer_toolkit.py,sha256=v9uq1POE1fQKCd152mbqDtF-HSe0qoDj83k4E5LAkMI,1080
|
137
137
|
alita_sdk/tools/ado/__init__.py,sha256=u2tdDgufGuDb-7lIgKKQlqgStL9Wd1gzNmRNYems2c0,1267
|
138
138
|
alita_sdk/tools/ado/utils.py,sha256=PTCludvaQmPLakF2EbCGy66Mro4-rjDtavVP-xcB2Wc,1252
|
@@ -233,7 +233,7 @@ alita_sdk/tools/custom_open_api/api_wrapper.py,sha256=sDSFpvEqpSvXHGiBISdQQcUecf
|
|
233
233
|
alita_sdk/tools/elastic/__init__.py,sha256=iwnSRppRpzvJ1da2K3Glu8Uu41MhBDCYbguboLkEbW0,2818
|
234
234
|
alita_sdk/tools/elastic/api_wrapper.py,sha256=pl8CqQxteJAGwyOhMcld-ZgtOTFwwbv42OITQVe8rM0,1948
|
235
235
|
alita_sdk/tools/figma/__init__.py,sha256=hfe7FxMCCKnHNUdj9dCLuCu69pabBq6OmmlxODBXqzc,4410
|
236
|
-
alita_sdk/tools/figma/api_wrapper.py,sha256=
|
236
|
+
alita_sdk/tools/figma/api_wrapper.py,sha256=HCOl8upJl5_yjtrgy0A8mEWVkqIq5oPzUCJAlNfyPzc,25856
|
237
237
|
alita_sdk/tools/github/__init__.py,sha256=2LLkgtm8mp5e1vlgx2VtPiUlV95iCeYLOXdWVz1kXP0,5092
|
238
238
|
alita_sdk/tools/github/api_wrapper.py,sha256=uDwYckdnpYRJtb0uZnDkaz2udvdDLVxuCh1tSwspsiU,8411
|
239
239
|
alita_sdk/tools/github/github_client.py,sha256=nxnSXsDul2PPbWvYZS8TmAFFmR-5ALyakNoV5LN2D4U,86617
|
@@ -347,8 +347,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=HOt9ShtJI_1tVPcwd3Rwk-VS0SMLq
|
|
347
347
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
|
348
348
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
|
349
349
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
|
350
|
-
alita_sdk-0.3.
|
351
|
-
alita_sdk-0.3.
|
352
|
-
alita_sdk-0.3.
|
353
|
-
alita_sdk-0.3.
|
354
|
-
alita_sdk-0.3.
|
350
|
+
alita_sdk-0.3.284.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
351
|
+
alita_sdk-0.3.284.dist-info/METADATA,sha256=4u6303venAnCzBB7n0UveeWvynBpZTAACQENr6amRqo,18897
|
352
|
+
alita_sdk-0.3.284.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
353
|
+
alita_sdk-0.3.284.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
354
|
+
alita_sdk-0.3.284.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|