alita-sdk 0.3.450__py3-none-any.whl → 0.3.451__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 +17 -2
- alita_sdk/tools/base_indexer_toolkit.py +3 -1
- {alita_sdk-0.3.450.dist-info → alita_sdk-0.3.451.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.450.dist-info → alita_sdk-0.3.451.dist-info}/RECORD +7 -7
- {alita_sdk-0.3.450.dist-info → alita_sdk-0.3.451.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.450.dist-info → alita_sdk-0.3.451.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.450.dist-info → alita_sdk-0.3.451.dist-info}/top_level.txt +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import json
|
|
2
|
-
import math
|
|
3
2
|
from collections import OrderedDict
|
|
4
3
|
from logging import getLogger
|
|
5
4
|
from typing import Any, Optional, List, Dict, Generator
|
|
6
5
|
|
|
6
|
+
import math
|
|
7
7
|
from langchain_core.documents import Document
|
|
8
8
|
from langchain_core.messages import HumanMessage
|
|
9
9
|
from langchain_core.tools import ToolException
|
|
@@ -12,7 +12,7 @@ from pydantic import BaseModel, model_validator, Field
|
|
|
12
12
|
|
|
13
13
|
from alita_sdk.tools.elitea_base import BaseToolApiWrapper
|
|
14
14
|
from alita_sdk.tools.vector_adapters.VectorStoreAdapter import VectorStoreAdapterFactory
|
|
15
|
-
from
|
|
15
|
+
from ...runtime.utils.utils import IndexerKeywords
|
|
16
16
|
|
|
17
17
|
logger = getLogger(__name__)
|
|
18
18
|
|
|
@@ -222,6 +222,21 @@ class VectorStoreWrapperBase(BaseToolApiWrapper):
|
|
|
222
222
|
raise RuntimeError(f"Multiple index_meta documents found: {index_metas}")
|
|
223
223
|
return index_metas[0] if index_metas else None
|
|
224
224
|
|
|
225
|
+
def get_indexed_count(self, index_name: str) -> int:
|
|
226
|
+
from sqlalchemy.orm import Session
|
|
227
|
+
from sqlalchemy import func, or_
|
|
228
|
+
|
|
229
|
+
with Session(self.vectorstore.session_maker.bind) as session:
|
|
230
|
+
return session.query(
|
|
231
|
+
self.vectorstore.EmbeddingStore.id,
|
|
232
|
+
).filter(
|
|
233
|
+
func.jsonb_extract_path_text(self.vectorstore.EmbeddingStore.cmetadata, 'collection') == index_name,
|
|
234
|
+
or_(
|
|
235
|
+
func.jsonb_extract_path_text(self.vectorstore.EmbeddingStore.cmetadata, 'type').is_(None),
|
|
236
|
+
func.jsonb_extract_path_text(self.vectorstore.EmbeddingStore.cmetadata, 'type') != IndexerKeywords.INDEX_META_TYPE.value
|
|
237
|
+
)
|
|
238
|
+
).count()
|
|
239
|
+
|
|
225
240
|
def _clean_collection(self, index_name: str = ''):
|
|
226
241
|
"""
|
|
227
242
|
Clean the vectorstore collection by deleting all indexed data.
|
|
@@ -470,6 +470,7 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
|
470
470
|
"collection": index_name,
|
|
471
471
|
"type": IndexerKeywords.INDEX_META_TYPE.value,
|
|
472
472
|
"indexed": 0,
|
|
473
|
+
"updated": 0,
|
|
473
474
|
"state": IndexerKeywords.INDEX_META_IN_PROGRESS.value,
|
|
474
475
|
"index_configuration": index_configuration,
|
|
475
476
|
"created_on": created_on,
|
|
@@ -487,7 +488,8 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
|
487
488
|
#
|
|
488
489
|
if index_meta_raw:
|
|
489
490
|
metadata = copy.deepcopy(index_meta_raw.get("metadata", {}))
|
|
490
|
-
metadata["indexed"] =
|
|
491
|
+
metadata["indexed"] = self.get_indexed_count(index_name)
|
|
492
|
+
metadata["updated"] = result
|
|
491
493
|
metadata["state"] = state
|
|
492
494
|
metadata["updated_on"] = time.time()
|
|
493
495
|
#
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: alita_sdk
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.451
|
|
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
|
|
@@ -130,7 +130,7 @@ alita_sdk/runtime/tools/router.py,sha256=p7e0tX6YAWw2M2Nq0A_xqw1E2P-Xz1DaJvhUstf
|
|
|
130
130
|
alita_sdk/runtime/tools/sandbox.py,sha256=LTCHC9xnuYThWX30PCTVEtjeg50FX7w2c29KU5E68W0,15251
|
|
131
131
|
alita_sdk/runtime/tools/tool.py,sha256=lE1hGi6qOAXG7qxtqxarD_XMQqTghdywf261DZawwno,5631
|
|
132
132
|
alita_sdk/runtime/tools/vectorstore.py,sha256=0SzfY1dYrGr7YUapJzXY01JFyzLv36dPjwHzs1XZIM4,34392
|
|
133
|
-
alita_sdk/runtime/tools/vectorstore_base.py,sha256=
|
|
133
|
+
alita_sdk/runtime/tools/vectorstore_base.py,sha256=wTVgX9MHPGqJ3JTKJd1BL3hQze-1a1CK2tVVPw3qXY4,29064
|
|
134
134
|
alita_sdk/runtime/utils/AlitaCallback.py,sha256=E4LlSBuCHWiUq6W7IZExERHZY0qcmdjzc_rJlF2iQIw,7356
|
|
135
135
|
alita_sdk/runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
136
136
|
alita_sdk/runtime/utils/constants.py,sha256=Xntx1b_uxUzT4clwqHA_U6K8y5bBqf_4lSQwXdcWrp4,13586
|
|
@@ -144,7 +144,7 @@ alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7r
|
|
|
144
144
|
alita_sdk/runtime/utils/toolkit_utils.py,sha256=_6cKy514v4ueIZynXTA8LwGC9Q447MfgrQKkDwDI4qM,5886
|
|
145
145
|
alita_sdk/runtime/utils/utils.py,sha256=PJK8A-JVIzY1IowOjGG8DIqsIiEFe65qDKvFcjJCKWA,1041
|
|
146
146
|
alita_sdk/tools/__init__.py,sha256=uQzvtnyOsgfdHl3pdo2LqK49Hb3SKFXDBXW_szN2R3k,10992
|
|
147
|
-
alita_sdk/tools/base_indexer_toolkit.py,sha256=
|
|
147
|
+
alita_sdk/tools/base_indexer_toolkit.py,sha256=f93O8bvemshJtUpSABeWx6_rOR_TfI1-7js3Cl2tSBs,27279
|
|
148
148
|
alita_sdk/tools/code_indexer_toolkit.py,sha256=2VkOC8JfBDc25_jp-NWyMYqpaYRETIzTJFLrIYrfBpE,7814
|
|
149
149
|
alita_sdk/tools/elitea_base.py,sha256=34fmVdYgd2YXifU5LFNjMQysr4OOIZ6AOZjq4GxLgSw,34417
|
|
150
150
|
alita_sdk/tools/non_code_indexer_toolkit.py,sha256=6Lrqor1VeSLbPLDHAfg_7UAUqKFy1r_n6bdsc4-ak98,1315
|
|
@@ -361,8 +361,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=kT0TbmMvuKhDUZc0i7KO18O38JM9S
|
|
|
361
361
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=0ne8XLJEQSLOWfzd2HdnqOYmQlUliKHbBED5kW_Vias,2895
|
|
362
362
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
|
|
363
363
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
|
|
364
|
-
alita_sdk-0.3.
|
|
365
|
-
alita_sdk-0.3.
|
|
366
|
-
alita_sdk-0.3.
|
|
367
|
-
alita_sdk-0.3.
|
|
368
|
-
alita_sdk-0.3.
|
|
364
|
+
alita_sdk-0.3.451.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
365
|
+
alita_sdk-0.3.451.dist-info/METADATA,sha256=V1M3C5taXiUZDVO-vruTOBT4rKmEm3fN2abAP9WZq5g,19101
|
|
366
|
+
alita_sdk-0.3.451.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
367
|
+
alita_sdk-0.3.451.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
|
368
|
+
alita_sdk-0.3.451.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|