alita-sdk 0.3.355__py3-none-any.whl → 0.3.356__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.
Potentially problematic release.
This version of alita-sdk might be problematic. Click here for more details.
- alita_sdk/runtime/toolkits/artifact.py +0 -1
- alita_sdk/tools/base_indexer_toolkit.py +7 -2
- alita_sdk/tools/gitlab/api_wrapper.py +38 -22
- {alita_sdk-0.3.355.dist-info → alita_sdk-0.3.356.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.355.dist-info → alita_sdk-0.3.356.dist-info}/RECORD +8 -8
- {alita_sdk-0.3.355.dist-info → alita_sdk-0.3.356.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.355.dist-info → alita_sdk-0.3.356.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.355.dist-info → alita_sdk-0.3.356.dist-info}/top_level.txt +0 -0
|
@@ -20,7 +20,6 @@ class ArtifactToolkit(BaseToolkit):
|
|
|
20
20
|
ArtifactToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
|
21
21
|
return create_model(
|
|
22
22
|
"artifact",
|
|
23
|
-
# client = (Any, FieldInfo(description="Client object", required=True, autopopulate=True)),
|
|
24
23
|
bucket = (str, FieldInfo(description="Bucket name", json_schema_extra={'toolkit_name': True, 'max_toolkit_length': ArtifactToolkit.toolkit_max_length})),
|
|
25
24
|
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
|
26
25
|
# indexer settings
|
|
@@ -155,7 +155,7 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
|
155
155
|
#
|
|
156
156
|
if clean_index:
|
|
157
157
|
self._clean_index(collection_suffix)
|
|
158
|
-
#
|
|
158
|
+
#
|
|
159
159
|
self._log_tool_event(f"Indexing data into collection with suffix '{collection_suffix}'. It can take some time...")
|
|
160
160
|
self._log_tool_event(f"Loading the documents to index...{kwargs}")
|
|
161
161
|
documents = self._base_loader(**kwargs)
|
|
@@ -191,7 +191,7 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
|
191
191
|
logger.debug(f"Indexing base document #{base_doc_counter}: {base_doc} and all dependent documents: {documents}")
|
|
192
192
|
|
|
193
193
|
dependent_docs_counter = 0
|
|
194
|
-
#
|
|
194
|
+
#
|
|
195
195
|
for doc in documents:
|
|
196
196
|
if not doc.page_content:
|
|
197
197
|
# To avoid case when all documents have empty content
|
|
@@ -357,6 +357,11 @@ class BaseIndexerToolkit(VectorStoreWrapperBase):
|
|
|
357
357
|
**kwargs):
|
|
358
358
|
""" Searches indexed documents in the vector store."""
|
|
359
359
|
# build filter on top of collection_suffix
|
|
360
|
+
|
|
361
|
+
available_collections = super().list_collections()
|
|
362
|
+
if collection_suffix and collection_suffix not in available_collections:
|
|
363
|
+
return f"Collection '{collection_suffix}' not found. Available collections: {available_collections}"
|
|
364
|
+
|
|
360
365
|
filter = self._build_collection_filter(filter, collection_suffix)
|
|
361
366
|
found_docs = super().search_documents(
|
|
362
367
|
query,
|
|
@@ -106,9 +106,13 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
106
106
|
private_token: SecretStr
|
|
107
107
|
branch: Optional[str] = 'main'
|
|
108
108
|
_git: Any = PrivateAttr()
|
|
109
|
-
_repo_instance: Any = PrivateAttr()
|
|
110
109
|
_active_branch: Any = PrivateAttr()
|
|
111
110
|
|
|
111
|
+
@staticmethod
|
|
112
|
+
def _sanitize_url(url: str) -> str:
|
|
113
|
+
"""Remove trailing slash from URL if present."""
|
|
114
|
+
return url.rstrip('/') if url else url
|
|
115
|
+
|
|
112
116
|
@model_validator(mode='before')
|
|
113
117
|
@classmethod
|
|
114
118
|
def validate_toolkit(cls, values: Dict) -> Dict:
|
|
@@ -119,22 +123,34 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
119
123
|
"python-gitlab is not installed. "
|
|
120
124
|
"Please install it with `pip install python-gitlab`"
|
|
121
125
|
)
|
|
122
|
-
|
|
126
|
+
values['repository'] = cls._sanitize_url(values['repository'])
|
|
123
127
|
g = gitlab.Gitlab(
|
|
124
|
-
url=values['url'],
|
|
128
|
+
url=cls._sanitize_url(values['url']),
|
|
125
129
|
private_token=values['private_token'],
|
|
126
130
|
keep_base_url=True,
|
|
127
131
|
)
|
|
128
132
|
|
|
129
133
|
g.auth()
|
|
130
|
-
cls._repo_instance = g.projects.get(values.get('repository'))
|
|
131
134
|
cls._git = g
|
|
132
135
|
cls._active_branch = values.get('branch')
|
|
133
136
|
return super().validate_toolkit(values)
|
|
134
137
|
|
|
138
|
+
@property
|
|
139
|
+
def repo_instance(self):
|
|
140
|
+
if not hasattr(self, "_repo_instance") or self._repo_instance is None:
|
|
141
|
+
try:
|
|
142
|
+
if self._git and self.repository:
|
|
143
|
+
self._repo_instance = self._git.projects.get(self.repository)
|
|
144
|
+
else:
|
|
145
|
+
self._repo_instance = None
|
|
146
|
+
except Exception as e:
|
|
147
|
+
# Only raise when accessed, not during initialization
|
|
148
|
+
raise ToolException(e)
|
|
149
|
+
return self._repo_instance
|
|
150
|
+
|
|
135
151
|
def set_active_branch(self, branch_name: str) -> str:
|
|
136
152
|
self._active_branch = branch_name
|
|
137
|
-
self.
|
|
153
|
+
self.repo_instance.default_branch = branch_name
|
|
138
154
|
return f"Active branch set to {branch_name}"
|
|
139
155
|
|
|
140
156
|
def list_branches_in_repo(self, limit: Optional[int] = 20, branch_wildcard: Optional[str] = None) -> List[str]:
|
|
@@ -149,7 +165,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
149
165
|
List[str]: List containing names of branches
|
|
150
166
|
"""
|
|
151
167
|
try:
|
|
152
|
-
branches = self.
|
|
168
|
+
branches = self.repo_instance.branches.list(get_all=True)
|
|
153
169
|
|
|
154
170
|
if branch_wildcard:
|
|
155
171
|
branches = [branch for branch in branches if fnmatch.fnmatch(branch.name, branch_wildcard)]
|
|
@@ -176,7 +192,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
176
192
|
|
|
177
193
|
def _get_all_files(self, path: str = None, recursive: bool = True, branch: str = None):
|
|
178
194
|
branch = branch if branch else self._active_branch
|
|
179
|
-
return self.
|
|
195
|
+
return self.repo_instance.repository_tree(path=path, ref=branch, recursive=recursive, all=True)
|
|
180
196
|
|
|
181
197
|
# overrided for indexer
|
|
182
198
|
def _get_files(self, path: str = None, recursive: bool = True, branch: str = None):
|
|
@@ -188,7 +204,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
188
204
|
Get the commit hash of a file in a specific branch.
|
|
189
205
|
"""
|
|
190
206
|
try:
|
|
191
|
-
file = self.
|
|
207
|
+
file = self.repo_instance.files.get(file_path, branch)
|
|
192
208
|
return file.commit_id
|
|
193
209
|
except Exception as e:
|
|
194
210
|
return f"Unable to get commit hash for {file_path} due to error:\n{e}"
|
|
@@ -198,7 +214,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
198
214
|
|
|
199
215
|
def create_branch(self, branch_name: str) -> str:
|
|
200
216
|
try:
|
|
201
|
-
self.
|
|
217
|
+
self.repo_instance.branches.create(
|
|
202
218
|
{
|
|
203
219
|
'branch': branch_name,
|
|
204
220
|
'ref': self._active_branch,
|
|
@@ -221,7 +237,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
221
237
|
return parsed
|
|
222
238
|
|
|
223
239
|
def get_issues(self) -> str:
|
|
224
|
-
issues = self.
|
|
240
|
+
issues = self.repo_instance.issues.list(state="opened")
|
|
225
241
|
if len(issues) > 0:
|
|
226
242
|
parsed_issues = self.parse_issues(issues)
|
|
227
243
|
parsed_issues_str = (
|
|
@@ -232,7 +248,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
232
248
|
return "No open issues available"
|
|
233
249
|
|
|
234
250
|
def get_issue(self, issue_number: int) -> Dict[str, Any]:
|
|
235
|
-
issue = self.
|
|
251
|
+
issue = self.repo_instance.issues.get(issue_number)
|
|
236
252
|
page = 0
|
|
237
253
|
comments: List[dict] = []
|
|
238
254
|
while len(comments) <= 10:
|
|
@@ -258,7 +274,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
258
274
|
commits are already in the {self.branch} branch"""
|
|
259
275
|
else:
|
|
260
276
|
try:
|
|
261
|
-
pr = self.
|
|
277
|
+
pr = self.repo_instance.mergerequests.create(
|
|
262
278
|
{
|
|
263
279
|
"source_branch": branch,
|
|
264
280
|
"target_branch": self.branch,
|
|
@@ -275,7 +291,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
275
291
|
issue_number = int(comment_query.split("\n\n")[0])
|
|
276
292
|
comment = comment_query[len(str(issue_number)) + 2 :]
|
|
277
293
|
try:
|
|
278
|
-
issue = self.
|
|
294
|
+
issue = self.repo_instance.issues.get(issue_number)
|
|
279
295
|
issue.notes.create({"body": comment})
|
|
280
296
|
return "Commented on issue " + str(issue_number)
|
|
281
297
|
except Exception as e:
|
|
@@ -284,7 +300,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
284
300
|
def create_file(self, file_path: str, file_contents: str, branch: str) -> str:
|
|
285
301
|
try:
|
|
286
302
|
self.set_active_branch(branch)
|
|
287
|
-
self.
|
|
303
|
+
self.repo_instance.files.get(file_path, branch)
|
|
288
304
|
return f"File already exists at {file_path}. Use update_file instead"
|
|
289
305
|
except Exception:
|
|
290
306
|
data = {
|
|
@@ -293,13 +309,13 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
293
309
|
"file_path": file_path,
|
|
294
310
|
"content": file_contents,
|
|
295
311
|
}
|
|
296
|
-
self.
|
|
312
|
+
self.repo_instance.files.create(data)
|
|
297
313
|
|
|
298
314
|
return "Created file " + file_path
|
|
299
315
|
|
|
300
316
|
def read_file(self, file_path: str, branch: str) -> str:
|
|
301
317
|
self.set_active_branch(branch)
|
|
302
|
-
file = self.
|
|
318
|
+
file = self.repo_instance.files.get(file_path, branch)
|
|
303
319
|
return file.decode().decode("utf-8")
|
|
304
320
|
|
|
305
321
|
def update_file(self, file_query: str, branch: str) -> str:
|
|
@@ -338,7 +354,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
338
354
|
],
|
|
339
355
|
}
|
|
340
356
|
|
|
341
|
-
self.
|
|
357
|
+
self.repo_instance.commits.create(commit)
|
|
342
358
|
return "Updated file " + file_path
|
|
343
359
|
except Exception as e:
|
|
344
360
|
return "Unable to update file due to error:\n" + str(e)
|
|
@@ -368,7 +384,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
368
384
|
],
|
|
369
385
|
}
|
|
370
386
|
|
|
371
|
-
self.
|
|
387
|
+
self.repo_instance.commits.create(commit)
|
|
372
388
|
return "Updated file " + file_path
|
|
373
389
|
except Exception as e:
|
|
374
390
|
return "Unable to update file due to error:\n" + str(e)
|
|
@@ -378,20 +394,20 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
378
394
|
self.set_active_branch(branch)
|
|
379
395
|
if not commit_message:
|
|
380
396
|
commit_message = f"Delete {file_path}"
|
|
381
|
-
self.
|
|
397
|
+
self.repo_instance.files.delete(file_path, branch, commit_message)
|
|
382
398
|
return f"Deleted file {file_path}"
|
|
383
399
|
except Exception as e:
|
|
384
400
|
return f"Unable to delete file due to error:\n{e}"
|
|
385
401
|
|
|
386
402
|
def get_pr_changes(self, pr_number: int) -> str:
|
|
387
|
-
mr = self.
|
|
403
|
+
mr = self.repo_instance.mergerequests.get(pr_number)
|
|
388
404
|
res = f"title: {mr.title}\ndescription: {mr.description}\n\n"
|
|
389
405
|
for change in mr.changes()["changes"]:
|
|
390
406
|
res += f"diff --git a/{change['old_path']} b/{change['new_path']}\n{change['diff']}\n"
|
|
391
407
|
return res
|
|
392
408
|
|
|
393
409
|
def create_pr_change_comment(self, pr_number: int, file_path: str, line_number: int, comment: str) -> str:
|
|
394
|
-
mr = self.
|
|
410
|
+
mr = self.repo_instance.mergerequests.get(pr_number)
|
|
395
411
|
position = {"position_type": "text", "new_path": file_path, "new_line": line_number}
|
|
396
412
|
mr.discussions.create({"body": comment, "position": position})
|
|
397
413
|
return "Comment added"
|
|
@@ -408,7 +424,7 @@ class GitLabAPIWrapper(CodeIndexerToolkit):
|
|
|
408
424
|
params["until"] = until
|
|
409
425
|
if author:
|
|
410
426
|
params["author"] = author
|
|
411
|
-
commits = self.
|
|
427
|
+
commits = self.repo_instance.commits.list(**params)
|
|
412
428
|
return [
|
|
413
429
|
{
|
|
414
430
|
"sha": commit.id,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: alita_sdk
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.356
|
|
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
|
|
@@ -96,7 +96,7 @@ alita_sdk/runtime/llms/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
96
96
|
alita_sdk/runtime/llms/preloaded.py,sha256=3AaUbZK3d8fvxAQMjR3ftOoYa0SnkCOL1EvdvDCXIHE,11321
|
|
97
97
|
alita_sdk/runtime/toolkits/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
98
98
|
alita_sdk/runtime/toolkits/application.py,sha256=Mn8xwIdlbuyNzroH-WVVWJG0biOUV7u8qS15fQJ_XmI,2186
|
|
99
|
-
alita_sdk/runtime/toolkits/artifact.py,sha256=
|
|
99
|
+
alita_sdk/runtime/toolkits/artifact.py,sha256=4yB5oT6yBjbfScdERMBkqirUy_GDGE0uMq9_loSrEDU,2924
|
|
100
100
|
alita_sdk/runtime/toolkits/configurations.py,sha256=kIDAlnryPQfbZyFxV-9SzN2-Vefzx06TX1BBdIIpN90,141
|
|
101
101
|
alita_sdk/runtime/toolkits/datasource.py,sha256=qk78OdPoReYPCWwahfkKLbKc4pfsu-061oXRryFLP6I,2498
|
|
102
102
|
alita_sdk/runtime/toolkits/prompt.py,sha256=WIpTkkVYWqIqOWR_LlSWz3ug8uO9tm5jJ7aZYdiGRn0,1192
|
|
@@ -134,7 +134,7 @@ alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7r
|
|
|
134
134
|
alita_sdk/runtime/utils/toolkit_utils.py,sha256=I9QFqnaqfVgN26LUr6s3XlBlG6y0CoHURnCzG7XcwVs,5311
|
|
135
135
|
alita_sdk/runtime/utils/utils.py,sha256=VXNLsdeTmf6snn9EtUyobv4yL-xzLhUcH8P_ORMifYc,675
|
|
136
136
|
alita_sdk/tools/__init__.py,sha256=jUj1ztC2FbkIUB-YYmiqaz_rqW7Il5kWzDPn1mJmj5w,10545
|
|
137
|
-
alita_sdk/tools/base_indexer_toolkit.py,sha256=
|
|
137
|
+
alita_sdk/tools/base_indexer_toolkit.py,sha256=PyT3BDSn6gNJPXdbZw21tvTbE9WkhJD3m_pFWZJlYbU,23825
|
|
138
138
|
alita_sdk/tools/code_indexer_toolkit.py,sha256=6QvI1by0OFdnKTx5TfNoDJjnMrvnTi9T56xaDxzeleU,7306
|
|
139
139
|
alita_sdk/tools/elitea_base.py,sha256=up3HshASSDfjlHV_HPrs1aD4JIwwX0Ug26WGTzgIYvY,34724
|
|
140
140
|
alita_sdk/tools/non_code_indexer_toolkit.py,sha256=B3QvhpT1F9QidkCcsOi3J_QrTOaNlTxqWFwe90VivQQ,1329
|
|
@@ -246,7 +246,7 @@ alita_sdk/tools/github/schemas.py,sha256=TxEWR3SjDKVwzo9i2tLnss_uPAv85Mh7oWjvQvY
|
|
|
246
246
|
alita_sdk/tools/github/tool.py,sha256=Jnnv5lenV5ds8AAdyo2m8hSzyJ117HZBjzHC6T1ck-M,1037
|
|
247
247
|
alita_sdk/tools/github/tool_prompts.py,sha256=y6ZW_FpUCE87Uop3WuQAZVRnzxO5t7xjBOI5bCqiluw,30194
|
|
248
248
|
alita_sdk/tools/gitlab/__init__.py,sha256=iis7RHD3YgKWxF_ryTfdtA8RPGV-W8zUfy4BgiTDADw,4540
|
|
249
|
-
alita_sdk/tools/gitlab/api_wrapper.py,sha256=
|
|
249
|
+
alita_sdk/tools/gitlab/api_wrapper.py,sha256=OW1JD3EyJCZA7iAHrNIwXuyd84Al-kB7A7VP5YE5FaQ,22578
|
|
250
250
|
alita_sdk/tools/gitlab/tools.py,sha256=vOGTlSaGaFmWn6LS6YFP-FuTqUPun9vnv1VrUcUHAZQ,16500
|
|
251
251
|
alita_sdk/tools/gitlab/utils.py,sha256=Z2XiqIg54ouqqt1to-geFybmkCb1I6bpE91wfnINH1I,2320
|
|
252
252
|
alita_sdk/tools/gitlab_org/__init__.py,sha256=PSTsC4BcPoyDv03Wj9VQHrEGUeR8hw4MRarB64VeqFg,3865
|
|
@@ -351,8 +351,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=kT0TbmMvuKhDUZc0i7KO18O38JM9S
|
|
|
351
351
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=0ne8XLJEQSLOWfzd2HdnqOYmQlUliKHbBED5kW_Vias,2895
|
|
352
352
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
|
|
353
353
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
|
|
354
|
-
alita_sdk-0.3.
|
|
355
|
-
alita_sdk-0.3.
|
|
356
|
-
alita_sdk-0.3.
|
|
357
|
-
alita_sdk-0.3.
|
|
358
|
-
alita_sdk-0.3.
|
|
354
|
+
alita_sdk-0.3.356.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
355
|
+
alita_sdk-0.3.356.dist-info/METADATA,sha256=IkFZJksYT0vdwMiG6dcF_FAhf4BgHhpUyvz1C6H_qsI,19071
|
|
356
|
+
alita_sdk-0.3.356.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
357
|
+
alita_sdk-0.3.356.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
|
358
|
+
alita_sdk-0.3.356.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|