alita-sdk 0.3.225__py3-none-any.whl → 0.3.226__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/tools/bitbucket/api_wrapper.py +7 -7
- alita_sdk/tools/gitlab/api_wrapper.py +9 -11
- {alita_sdk-0.3.225.dist-info → alita_sdk-0.3.226.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.225.dist-info → alita_sdk-0.3.226.dist-info}/RECORD +7 -7
- {alita_sdk-0.3.225.dist-info → alita_sdk-0.3.226.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.225.dist-info → alita_sdk-0.3.226.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.225.dist-info → alita_sdk-0.3.226.dist-info}/top_level.txt +0 -0
@@ -23,7 +23,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
|
|
23
23
|
"""Wrapper for Bitbucket API."""
|
24
24
|
|
25
25
|
_bitbucket: Any = PrivateAttr()
|
26
|
-
|
26
|
+
active_branch: Any = PrivateAttr()
|
27
27
|
url: str = ''
|
28
28
|
project: str = ''
|
29
29
|
"""The key of the project this repo belongs to"""
|
@@ -78,12 +78,12 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
|
|
78
78
|
project=values['project'],
|
79
79
|
repository=values['repository']
|
80
80
|
)
|
81
|
-
cls.
|
81
|
+
cls.active_branch = values.get('branch')
|
82
82
|
return values
|
83
83
|
|
84
84
|
def set_active_branch(self, branch: str) -> None:
|
85
85
|
"""Set the active branch for the bot."""
|
86
|
-
self.
|
86
|
+
self.active_branch = branch
|
87
87
|
return f"Active branch set to `{branch}`"
|
88
88
|
|
89
89
|
def list_branches_in_repo(self) -> List[str]:
|
@@ -93,15 +93,15 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
|
|
93
93
|
def create_branch(self, branch_name: str) -> None:
|
94
94
|
"""Create a new branch in the repository."""
|
95
95
|
try:
|
96
|
-
self._bitbucket.create_branch(branch_name, self.
|
96
|
+
self._bitbucket.create_branch(branch_name, self.active_branch)
|
97
97
|
except Exception as e:
|
98
98
|
if "not permitted to access this resource" in str(e):
|
99
99
|
return f"Please, verify you token/password: {str}"
|
100
100
|
if "already exists" in str(e):
|
101
|
-
self.
|
101
|
+
self.active_branch = branch_name
|
102
102
|
return f"Branch {branch_name} already exists. set it as active"
|
103
103
|
return f"Unable to create branch due to error:\n{e}"
|
104
|
-
self.
|
104
|
+
self.active_branch = branch_name
|
105
105
|
return f"Branch {branch_name} created successfully and set as active"
|
106
106
|
|
107
107
|
def create_pull_request(self, pr_json_data: str) -> str:
|
@@ -234,7 +234,7 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
|
|
234
234
|
Returns:
|
235
235
|
str: List of the files
|
236
236
|
"""
|
237
|
-
return str(self._bitbucket.get_files_list(file_path=path if path else '', branch=branch if branch else self.
|
237
|
+
return str(self._bitbucket.get_files_list(file_path=path if path else '', branch=branch if branch else self.active_branch))
|
238
238
|
|
239
239
|
# TODO: review this method, it may not work as expected
|
240
240
|
# def _file_commit_hash(self, file_path: str, branch: str):
|
@@ -1,7 +1,6 @@
|
|
1
1
|
# api_wrapper.py
|
2
2
|
from typing import Any, Dict, List, Optional
|
3
3
|
import fnmatch
|
4
|
-
from alita_sdk.tools.elitea_base import extend_with_vector_tools
|
5
4
|
from alita_sdk.tools.elitea_base import BaseCodeToolApiWrapper
|
6
5
|
from pydantic import create_model, Field, model_validator, SecretStr, PrivateAttr
|
7
6
|
|
@@ -105,7 +104,7 @@ class GitLabAPIWrapper(BaseCodeToolApiWrapper):
|
|
105
104
|
branch: Optional[str] = 'main'
|
106
105
|
_git: Any = PrivateAttr()
|
107
106
|
_repo_instance: Any = PrivateAttr()
|
108
|
-
|
107
|
+
active_branch: Any = PrivateAttr()
|
109
108
|
|
110
109
|
llm: Optional[Any] = None
|
111
110
|
# Alita instance
|
@@ -139,11 +138,11 @@ class GitLabAPIWrapper(BaseCodeToolApiWrapper):
|
|
139
138
|
g.auth()
|
140
139
|
cls._repo_instance = g.projects.get(values.get('repository'))
|
141
140
|
cls._git = g
|
142
|
-
cls.
|
141
|
+
cls.active_branch = values.get('branch')
|
143
142
|
return values
|
144
143
|
|
145
144
|
def set_active_branch(self, branch_name: str) -> str:
|
146
|
-
self.
|
145
|
+
self.active_branch = branch_name
|
147
146
|
self._repo_instance.default_branch = branch_name
|
148
147
|
return f"Active branch set to {branch_name}"
|
149
148
|
|
@@ -173,19 +172,19 @@ class GitLabAPIWrapper(BaseCodeToolApiWrapper):
|
|
173
172
|
return f"Failed to list branches: {str(e)}"
|
174
173
|
|
175
174
|
def list_files(self, path: str = None, recursive: bool = True, branch: str = None) -> List[str]:
|
176
|
-
branch = branch if branch else self.
|
175
|
+
branch = branch if branch else self.active_branch
|
177
176
|
files = self._get_all_files(path, recursive, branch)
|
178
177
|
paths = [file['path'] for file in files if file['type'] == 'blob']
|
179
178
|
return paths
|
180
179
|
|
181
180
|
def list_folders(self, path: str = None, recursive: bool = True, branch: str = None) -> List[str]:
|
182
|
-
branch = branch if branch else self.
|
181
|
+
branch = branch if branch else self.active_branch
|
183
182
|
files = self._get_all_files(path, recursive, branch)
|
184
183
|
paths = [file['path'] for file in files if file['type'] == 'tree']
|
185
184
|
return paths
|
186
185
|
|
187
186
|
def _get_all_files(self, path: str = None, recursive: bool = True, branch: str = None):
|
188
|
-
branch = branch if branch else self.
|
187
|
+
branch = branch if branch else self.active_branch
|
189
188
|
return self._repo_instance.repository_tree(path=path, ref=branch, recursive=recursive, all=True)
|
190
189
|
|
191
190
|
# overrided for indexer
|
@@ -211,15 +210,15 @@ class GitLabAPIWrapper(BaseCodeToolApiWrapper):
|
|
211
210
|
self._repo_instance.branches.create(
|
212
211
|
{
|
213
212
|
'branch': branch_name,
|
214
|
-
'ref': self.
|
213
|
+
'ref': self.active_branch,
|
215
214
|
}
|
216
215
|
)
|
217
216
|
except Exception as e:
|
218
217
|
if "Branch already exists" in str(e):
|
219
|
-
self.
|
218
|
+
self.active_branch = branch_name
|
220
219
|
return f"Branch {branch_name} already exists. set it as active"
|
221
220
|
return f"Unable to create branch due to error:\n{e}"
|
222
|
-
self.
|
221
|
+
self.active_branch = branch_name
|
223
222
|
return f"Branch {branch_name} created successfully and set as active"
|
224
223
|
|
225
224
|
def parse_issues(self, issues: List[Any]) -> List[dict]:
|
@@ -430,7 +429,6 @@ class GitLabAPIWrapper(BaseCodeToolApiWrapper):
|
|
430
429
|
for commit in commits
|
431
430
|
]
|
432
431
|
|
433
|
-
@extend_with_vector_tools
|
434
432
|
def get_available_tools(self):
|
435
433
|
return [
|
436
434
|
{
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.226
|
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
|
@@ -118,7 +118,7 @@ alita_sdk/tools/azure_ai/search/api_wrapper.py,sha256=E4p6HPDlwgxfT_i6cvg9rN4Vn_
|
|
118
118
|
alita_sdk/tools/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
119
119
|
alita_sdk/tools/base/tool.py,sha256=-N27AodZS49vdPCgFkU-bFS9bxoPopZBnNrmwInx3d0,864
|
120
120
|
alita_sdk/tools/bitbucket/__init__.py,sha256=EEJUp965OT0JijI6x7U7DP-_5sgRC3Q3TbNnxky6hPo,5458
|
121
|
-
alita_sdk/tools/bitbucket/api_wrapper.py,sha256=
|
121
|
+
alita_sdk/tools/bitbucket/api_wrapper.py,sha256=Sww4j67Ib5owH5-bKcSadikIQ9BJpzQXMVToku3Wpc0,10872
|
122
122
|
alita_sdk/tools/bitbucket/bitbucket_constants.py,sha256=UsbhQ1iEvrKoxceTFPWTYhaXS1zSxbmjs1TwY0-P4gw,462
|
123
123
|
alita_sdk/tools/bitbucket/cloud_api_wrapper.py,sha256=VELi65tLXvszwCGQSqVfyVal0ylx9DgAmAGpRQL_Zkg,15522
|
124
124
|
alita_sdk/tools/bitbucket/tools.py,sha256=zKBUq7t9zLa1EvhlVZzyVcZSvwvdcbtz0oslgPFZeeo,15307
|
@@ -203,7 +203,7 @@ alita_sdk/tools/github/schemas.py,sha256=yFsqivfjCPRk9GxFJrL8sTz6nnjFCZ0j5DIfPtG
|
|
203
203
|
alita_sdk/tools/github/tool.py,sha256=Jnnv5lenV5ds8AAdyo2m8hSzyJ117HZBjzHC6T1ck-M,1037
|
204
204
|
alita_sdk/tools/github/tool_prompts.py,sha256=y6ZW_FpUCE87Uop3WuQAZVRnzxO5t7xjBOI5bCqiluw,30194
|
205
205
|
alita_sdk/tools/gitlab/__init__.py,sha256=DftTt4uVaRG4g2RFvLKyghG_A28ukGPHK9G2jojEGnM,4853
|
206
|
-
alita_sdk/tools/gitlab/api_wrapper.py,sha256=
|
206
|
+
alita_sdk/tools/gitlab/api_wrapper.py,sha256=SG8YL92ksTqM-lHgJL3XyycbvMb-DDkaCqdh0iwaY1Y,22292
|
207
207
|
alita_sdk/tools/gitlab/tools.py,sha256=vOGTlSaGaFmWn6LS6YFP-FuTqUPun9vnv1VrUcUHAZQ,16500
|
208
208
|
alita_sdk/tools/gitlab/utils.py,sha256=Z2XiqIg54ouqqt1to-geFybmkCb1I6bpE91wfnINH1I,2320
|
209
209
|
alita_sdk/tools/gitlab_org/__init__.py,sha256=_DJ5y92E6GuNBtCuaEZakGNInxbuFtvLYZMTMCDf3Js,3713
|
@@ -307,8 +307,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=JAeWf-RXohsxheUpT0iMDClc_izj-
|
|
307
307
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
|
308
308
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
|
309
309
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
|
310
|
-
alita_sdk-0.3.
|
311
|
-
alita_sdk-0.3.
|
312
|
-
alita_sdk-0.3.
|
313
|
-
alita_sdk-0.3.
|
314
|
-
alita_sdk-0.3.
|
310
|
+
alita_sdk-0.3.226.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
311
|
+
alita_sdk-0.3.226.dist-info/METADATA,sha256=mbKuIG_1KR0BDC7Q8-c34XlXzugfo5k1Z2L7duhJebs,18917
|
312
|
+
alita_sdk-0.3.226.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
313
|
+
alita_sdk-0.3.226.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
314
|
+
alita_sdk-0.3.226.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|