alita-sdk 0.3.269__py3-none-any.whl → 0.3.270__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.
@@ -1,7 +1,7 @@
1
1
  import json
2
2
  import math
3
3
  import types
4
- from typing import Any, Optional, List, Dict, Callable, Generator
4
+ from typing import Any, Optional, List, Dict, Callable, Generator, OrderedDict
5
5
 
6
6
  from langchain_core.documents import Document
7
7
  from pydantic import BaseModel, model_validator, Field
@@ -542,11 +542,18 @@ class VectorStoreWrapper(BaseToolApiWrapper):
542
542
 
543
543
  # Initialize document map for tracking by ID
544
544
  doc_map = {
545
- f"{doc.metadata.get('id', f'idx_{i}')}_{doc.metadata['chunk_id']}"
546
- if 'chunk_id' in doc.metadata
547
- else doc.metadata.get('id', f"idx_{i}"): (doc, score)
545
+ (
546
+ f"{doc.metadata.get('id', f'idx_{i}')}_{doc.metadata['chunk_id']}"
547
+ if 'chunk_id' in doc.metadata
548
+ else doc.metadata.get('id', f"idx_{i}")
549
+ ): (doc, 1 - score)
548
550
  for i, (doc, score) in enumerate(vector_items)
549
551
  }
552
+
553
+ # Sort the items by the new score in descending order
554
+ doc_map = OrderedDict(
555
+ sorted(doc_map.items(), key=lambda x: x[1][1], reverse=True)
556
+ )
550
557
 
551
558
  # Process full-text search if configured
552
559
  if full_text_search and full_text_search.get('enabled') and full_text_search.get('fields'):
@@ -597,7 +604,7 @@ class VectorStoreWrapper(BaseToolApiWrapper):
597
604
  # Apply cutoff filter
598
605
  if cut_off:
599
606
  # Filter out items above the cutoff score (since the lower the score, the better)
600
- combined_items = [item for item in combined_items if abs(item[1]) <= cut_off]
607
+ combined_items = [item for item in combined_items if abs(item[1]) >= cut_off]
601
608
 
602
609
  # Sort by score and limit results
603
610
  # DISABLED: for chroma we want ascending order (lower score is better), for others descending
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.269
3
+ Version: 0.3.270
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
@@ -107,7 +107,7 @@ alita_sdk/runtime/tools/pgvector_search.py,sha256=NN2BGAnq4SsDHIhUcFZ8d_dbEOM8Qw
107
107
  alita_sdk/runtime/tools/prompt.py,sha256=nJafb_e5aOM1Rr3qGFCR-SKziU9uCsiP2okIMs9PppM,741
108
108
  alita_sdk/runtime/tools/router.py,sha256=wCvZjVkdXK9dMMeEerrgKf5M790RudH68pDortnHSz0,1517
109
109
  alita_sdk/runtime/tools/tool.py,sha256=lE1hGi6qOAXG7qxtqxarD_XMQqTghdywf261DZawwno,5631
110
- alita_sdk/runtime/tools/vectorstore.py,sha256=yl6FKJGVQDevftSkxWTkMbqjIskIFz69vXELdEGp9u4,34780
110
+ alita_sdk/runtime/tools/vectorstore.py,sha256=UyuNQwsGRcZMz5M3olUwahxtTBN8yvd2D4yeGWh-HWk,35014
111
111
  alita_sdk/runtime/tools/vectorstore_base.py,sha256=Hxd74XNiuxsc6Fe9CufTrLATWUPnm5278t0a-1YswR8,27638
112
112
  alita_sdk/runtime/utils/AlitaCallback.py,sha256=E4LlSBuCHWiUq6W7IZExERHZY0qcmdjzc_rJlF2iQIw,7356
113
113
  alita_sdk/runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -336,8 +336,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=HOt9ShtJI_1tVPcwd3Rwk-VS0SMLq
336
336
  alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
337
337
  alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
338
338
  alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
339
- alita_sdk-0.3.269.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
340
- alita_sdk-0.3.269.dist-info/METADATA,sha256=0c-eAdXm6-V0VeSP6AZSkFusLfGz_XaI28Zas2aMBsg,18897
341
- alita_sdk-0.3.269.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
342
- alita_sdk-0.3.269.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
343
- alita_sdk-0.3.269.dist-info/RECORD,,
339
+ alita_sdk-0.3.270.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
340
+ alita_sdk-0.3.270.dist-info/METADATA,sha256=Rew1TSCOcM5Yz0OLl0kJBMaQcOg6EDbGP9CFfF3U2Ko,18897
341
+ alita_sdk-0.3.270.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
342
+ alita_sdk-0.3.270.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
343
+ alita_sdk-0.3.270.dist-info/RECORD,,