alita-sdk 0.3.269__py3-none-any.whl → 0.3.271__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.py +12 -5
- alita_sdk/tools/bitbucket/__init__.py +8 -3
- alita_sdk/tools/bitbucket/api_wrapper.py +1 -1
- alita_sdk/tools/bitbucket/cloud_api_wrapper.py +5 -5
- alita_sdk/tools/zephyr_essential/__init__.py +2 -2
- {alita_sdk-0.3.269.dist-info → alita_sdk-0.3.271.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.269.dist-info → alita_sdk-0.3.271.dist-info}/RECORD +10 -10
- {alita_sdk-0.3.269.dist-info → alita_sdk-0.3.271.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.269.dist-info → alita_sdk-0.3.271.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.269.dist-info → alita_sdk-0.3.271.dist-info}/top_level.txt +0 -0
@@ -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
|
-
|
546
|
-
|
547
|
-
|
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])
|
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
|
@@ -6,6 +6,8 @@ from .api_wrapper import BitbucketAPIWrapper
|
|
6
6
|
from langchain_core.tools import BaseToolkit
|
7
7
|
from langchain_core.tools import BaseTool
|
8
8
|
from pydantic import BaseModel, Field, ConfigDict, create_model
|
9
|
+
|
10
|
+
from ..base.tool import BaseAction
|
9
11
|
from ..utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length, check_connection_response
|
10
12
|
from ...configurations.bitbucket import BitbucketConfiguration
|
11
13
|
from ...configurations.pgvector import PgVectorConfiguration
|
@@ -102,9 +104,12 @@ class AlitaBitbucketToolkit(BaseToolkit):
|
|
102
104
|
if selected_tools:
|
103
105
|
if tool['name'] not in selected_tools:
|
104
106
|
continue
|
105
|
-
|
106
|
-
|
107
|
-
|
107
|
+
tools.append(BaseAction(
|
108
|
+
api_wrapper=bitbucket_api_wrapper,
|
109
|
+
name=prefix + tool["name"],
|
110
|
+
description=tool["description"] + f"\nrepo: {bitbucket_api_wrapper.repository}",
|
111
|
+
args_schema=tool["args_schema"]
|
112
|
+
))
|
108
113
|
return cls(tools=tools)
|
109
114
|
|
110
115
|
def get_tools(self):
|
@@ -194,7 +194,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
|
|
194
194
|
if limit is not None:
|
195
195
|
branches = branches[:limit]
|
196
196
|
|
197
|
-
return branches
|
197
|
+
return "Found branches: " + ", ".join(branches)
|
198
198
|
except Exception as e:
|
199
199
|
return f"Failed to list branches: {str(e)}"
|
200
200
|
|
@@ -35,7 +35,7 @@ def normalize_response(response) -> Dict[str, Any]:
|
|
35
35
|
class BitbucketApiAbstract(ABC):
|
36
36
|
|
37
37
|
@abstractmethod
|
38
|
-
def list_branches(self) -> str:
|
38
|
+
def list_branches(self) -> List[str]:
|
39
39
|
pass
|
40
40
|
|
41
41
|
@abstractmethod
|
@@ -86,9 +86,9 @@ class BitbucketServerApi(BitbucketApiAbstract):
|
|
86
86
|
self.password = password
|
87
87
|
self.api_client = Bitbucket(url=url, username=username, password=password)
|
88
88
|
|
89
|
-
def list_branches(self) -> str:
|
89
|
+
def list_branches(self) -> List[str]:
|
90
90
|
branches = self.api_client.get_branches(project_key=self.project, repository_slug=self.repository)
|
91
|
-
return
|
91
|
+
return [branch['displayId'] for branch in branches]
|
92
92
|
|
93
93
|
def create_branch(self, branch_name: str, branch_from: str) -> Response:
|
94
94
|
return self.api_client.create_branch(
|
@@ -257,10 +257,10 @@ class BitbucketCloudApi(BitbucketApiAbstract):
|
|
257
257
|
except Exception as e:
|
258
258
|
raise ToolException(f"Unable to connect to the repository '{self.repository_name}' due to error:\n{str(e)}")
|
259
259
|
|
260
|
-
def list_branches(self) -> str:
|
260
|
+
def list_branches(self) -> List[str]:
|
261
261
|
branches = self.repository.branches.each()
|
262
262
|
branch_names = [branch.name for branch in branches]
|
263
|
-
return
|
263
|
+
return branch_names
|
264
264
|
|
265
265
|
def _get_branch(self, branch_name: str) -> Response:
|
266
266
|
return self.repository.branches.get(branch_name)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from typing import List, Literal, Optional
|
2
2
|
|
3
3
|
from langchain_core.tools import BaseToolkit, BaseTool
|
4
|
-
from pydantic import create_model, BaseModel, Field
|
4
|
+
from pydantic import create_model, BaseModel, Field, SecretStr
|
5
5
|
|
6
6
|
from .api_wrapper import ZephyrEssentialApiWrapper
|
7
7
|
from ..base.tool import BaseAction
|
@@ -35,7 +35,7 @@ class ZephyrEssentialToolkit(BaseToolkit):
|
|
35
35
|
ZephyrEssentialToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
36
36
|
return create_model(
|
37
37
|
name,
|
38
|
-
token=(
|
38
|
+
token=(SecretStr, Field(description="Bearer api token")),
|
39
39
|
base_url=(Optional[str], Field(description="Zephyr Essential base url", default=None)),
|
40
40
|
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
41
41
|
pgvector_configuration=(Optional[PgVectorConfiguration], Field(default=None,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.271
|
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=
|
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
|
@@ -145,10 +145,10 @@ alita_sdk/tools/azure_ai/search/__init__.py,sha256=FVWNSW4LlOXKt34fVUgXut5oZcok9
|
|
145
145
|
alita_sdk/tools/azure_ai/search/api_wrapper.py,sha256=E4p6HPDlwgxfT_i6cvg9rN4Vn_47CVAyNBAKLIGq3mU,7265
|
146
146
|
alita_sdk/tools/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
147
147
|
alita_sdk/tools/base/tool.py,sha256=-N27AodZS49vdPCgFkU-bFS9bxoPopZBnNrmwInx3d0,864
|
148
|
-
alita_sdk/tools/bitbucket/__init__.py,sha256=
|
149
|
-
alita_sdk/tools/bitbucket/api_wrapper.py,sha256=
|
148
|
+
alita_sdk/tools/bitbucket/__init__.py,sha256=0aw01zETqZ5_QqZg7eiVwgvYSScD3bTynOWIX2lwyyM,5497
|
149
|
+
alita_sdk/tools/bitbucket/api_wrapper.py,sha256=L8jgJihfwH3gilX_noIynO9pujVi2tyOdRvrjSQb-9A,20015
|
150
150
|
alita_sdk/tools/bitbucket/bitbucket_constants.py,sha256=UsbhQ1iEvrKoxceTFPWTYhaXS1zSxbmjs1TwY0-P4gw,462
|
151
|
-
alita_sdk/tools/bitbucket/cloud_api_wrapper.py,sha256=
|
151
|
+
alita_sdk/tools/bitbucket/cloud_api_wrapper.py,sha256=QHdud-d3xcz3mOP3xb1Htk1sv9QFg7bTm1szdN_zohQ,15517
|
152
152
|
alita_sdk/tools/browser/__init__.py,sha256=iByi9uMGjd6v44SagIPTm5fu1vWnxIkjn3xsx86uRwI,5249
|
153
153
|
alita_sdk/tools/browser/crawler.py,sha256=jhE35dU94eQLURSM-D50tspOqEMsiGzMDbYNqNSR2mU,2279
|
154
154
|
alita_sdk/tools/browser/duck_duck_go_search.py,sha256=iKws923v34o-ySXohJw-8xTDBWlj3fMsnzC_ZRuPugE,2002
|
@@ -328,7 +328,7 @@ alita_sdk/tools/zephyr/rest_client.py,sha256=7vSD3oYIX-3KbAFed-mphSQif_VRuXrq5O0
|
|
328
328
|
alita_sdk/tools/zephyr_enterprise/__init__.py,sha256=1E0xuyYx7QSuqIRKclEapI7MvxXjJ3Lwf4YpDXPzehw,4087
|
329
329
|
alita_sdk/tools/zephyr_enterprise/api_wrapper.py,sha256=km2TYNu5ppRkspN1PyYetu6iBGj-xKVIwGHty1r_wAw,11552
|
330
330
|
alita_sdk/tools/zephyr_enterprise/zephyr_enterprise.py,sha256=hV9LIrYfJT6oYp-ZfQR0YHflqBFPsUw2Oc55HwK0H48,6809
|
331
|
-
alita_sdk/tools/zephyr_essential/__init__.py,sha256=
|
331
|
+
alita_sdk/tools/zephyr_essential/__init__.py,sha256=60BKJiRuzLrOwlVdYrlHj9qaSD9crS16vDb2z1rBJEM,3778
|
332
332
|
alita_sdk/tools/zephyr_essential/api_wrapper.py,sha256=WZvtC_CLVZxwsLWITOGZpFqPWp3JgzCVtYmmq__vU5c,37237
|
333
333
|
alita_sdk/tools/zephyr_essential/client.py,sha256=bfNcUKNqj9MFWTludGbbqD4qZlxrBaC2JtWsCfZMqSY,9722
|
334
334
|
alita_sdk/tools/zephyr_scale/__init__.py,sha256=imuHOqdyOqtxQObeBZfyFvKPXfKVNuYfwKn2c9jJyeo,4299
|
@@ -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.
|
340
|
-
alita_sdk-0.3.
|
341
|
-
alita_sdk-0.3.
|
342
|
-
alita_sdk-0.3.
|
343
|
-
alita_sdk-0.3.
|
339
|
+
alita_sdk-0.3.271.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
340
|
+
alita_sdk-0.3.271.dist-info/METADATA,sha256=gsP2DAWgVbv9bmqMLl_O1EHm7Oc2L7AAT--x7xWG7aw,18897
|
341
|
+
alita_sdk-0.3.271.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
342
|
+
alita_sdk-0.3.271.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
343
|
+
alita_sdk-0.3.271.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|