alita-sdk 0.3.260__py3-none-any.whl → 0.3.262__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.
@@ -20,6 +20,7 @@ from .prompt import AlitaPrompt
20
20
  from .datasource import AlitaDataSource
21
21
  from .artifact import Artifact
22
22
  from ..langchain.chat_message_template import Jinja2TemplatedChatMessagesTemplate
23
+ from ..utils.utils import TOOLKIT_SPLITTER
23
24
  from ...tools import get_available_toolkit_models
24
25
 
25
26
  logger = logging.getLogger(__name__)
@@ -762,7 +763,7 @@ class AlitaClient:
762
763
  base_available_tools.append(base_name)
763
764
 
764
765
  # Track full names separately
765
- if '___' in tool_name_attr:
766
+ if TOOLKIT_SPLITTER in tool_name_attr:
766
767
  full_available_tools.append(tool_name_attr)
767
768
 
768
769
  # Create comprehensive error message
@@ -5,6 +5,7 @@ from typing import Any, Optional
5
5
  from langchain.agents import (
6
6
  AgentExecutor, create_openai_tools_agent,
7
7
  create_json_chat_agent)
8
+ from langgraph.graph.state import CompiledStateGraph
8
9
  from langgraph.store.base import BaseStore
9
10
  from .agents.xml_chat import create_xml_chat_agent
10
11
  from .langraph_agent import create_graph
@@ -61,11 +62,11 @@ class Assistant:
61
62
  # )
62
63
  # self.client = target_cls(**model_params)
63
64
  # validate agents compatibility: non-pipeline agents cannot have pipelines as toolkits
64
- if app_type not in ["pipeline", "predict"]:
65
- tools_to_check = data.get('tools', [])
66
- if any(tool['agent_type'] == 'pipeline' for tool in tools_to_check):
67
- raise ToolException("Non-pipeline agents cannot have pipelines as a toolkits. "
68
- "Review toolkits configuration or use pipeline as master agent.")
65
+ # if app_type not in ["pipeline", "predict"]:
66
+ # tools_to_check = data.get('tools', [])
67
+ # if any(tool['agent_type'] == 'pipeline' for tool in tools_to_check):
68
+ # raise ToolException("Non-pipeline agents cannot have pipelines as a toolkits. "
69
+ # "Review toolkits configuration or use pipeline as master agent.")
69
70
 
70
71
  # configure memory store if memory tool is defined (not needed for predict agents)
71
72
  if app_type != "predict":
@@ -148,20 +149,20 @@ class Assistant:
148
149
 
149
150
  def getAgentExecutor(self):
150
151
  # Exclude compiled graph runnables from simple tool agents
151
- simple_tools = [t for t in self.tools if isinstance(t, BaseTool)]
152
+ simple_tools = [t for t in self.tools if isinstance(t, (BaseTool, CompiledStateGraph))]
152
153
  agent = create_json_chat_agent(llm=self.client, tools=simple_tools, prompt=self.prompt)
153
154
  return self._agent_executor(agent)
154
155
 
155
156
 
156
157
  def getXMLAgentExecutor(self):
157
158
  # Exclude compiled graph runnables from simple tool agents
158
- simple_tools = [t for t in self.tools if isinstance(t, BaseTool)]
159
+ simple_tools = [t for t in self.tools if isinstance(t, (BaseTool, CompiledStateGraph))]
159
160
  agent = create_xml_chat_agent(llm=self.client, tools=simple_tools, prompt=self.prompt)
160
161
  return self._agent_executor(agent)
161
162
 
162
163
  def getOpenAIToolsAgentExecutor(self):
163
164
  # Exclude compiled graph runnables from simple tool agents
164
- simple_tools = [t for t in self.tools if isinstance(t, BaseTool)]
165
+ simple_tools = [t for t in self.tools if isinstance(t, (BaseTool, CompiledStateGraph))]
165
166
  agent = create_openai_tools_agent(llm=self.client, tools=simple_tools, prompt=self.prompt)
166
167
  return self._agent_executor(agent)
167
168
 
@@ -171,7 +172,7 @@ class Assistant:
171
172
  This creates a proper LangGraphAgentRunnable with modern tool support.
172
173
  """
173
174
  # Exclude compiled graph runnables from simple tool agents
174
- simple_tools = [t for t in self.tools if isinstance(t, BaseTool)]
175
+ simple_tools = [t for t in self.tools if isinstance(t, (BaseTool, CompiledStateGraph))]
175
176
 
176
177
  # Set up memory/checkpointer if available
177
178
  checkpointer = None
@@ -77,7 +77,6 @@ def get_tools(tools_list: list, alita_client, llm, memory_store: BaseStore = Non
77
77
  connection_string=tool['settings'].get('connection_string', None),
78
78
  collection_name=tool.get('toolkit_name'),
79
79
  embedding_model=tool['settings'].get('embedding_model'),
80
- embedding_model_params=tool['settings'].get('embedding_model_params', None),
81
80
  vectorstore_type="PGVector"
82
81
  ).get_tools())
83
82
  elif tool['type'] == 'vectorstore':
@@ -421,7 +421,7 @@ class VectorStoreWrapperBase(BaseToolApiWrapper):
421
421
  for result in text_results:
422
422
  doc_id = result['id']
423
423
  text_score = result['text_score']
424
-
424
+
425
425
  if doc_id in doc_map:
426
426
  # Document exists in vector results, combine scores
427
427
  doc, vector_score = doc_map[doc_id]
@@ -452,7 +452,7 @@ class VectorStoreWrapperBase(BaseToolApiWrapper):
452
452
 
453
453
  # Apply cutoff filter
454
454
  if cut_off:
455
- combined_items = [item for item in combined_items if abs(item[1]) >= cut_off]
455
+ combined_items = [item for item in combined_items if abs(item[1]) <= cut_off]
456
456
 
457
457
  # Sort by score and limit results
458
458
  # DISABLED: for chroma we want ascending order (lower score is better), for others descending
@@ -3,7 +3,6 @@ from typing import Dict, List, Literal, Optional
3
3
  from requests.auth import HTTPBasicAuth
4
4
 
5
5
  from .api_wrapper import BitbucketAPIWrapper
6
- from .tools import __all__
7
6
  from langchain_core.tools import BaseToolkit
8
7
  from langchain_core.tools import BaseTool
9
8
  from pydantic import BaseModel, Field, ConfigDict, create_model
@@ -41,10 +40,8 @@ class AlitaBitbucketToolkit(BaseToolkit):
41
40
 
42
41
  @staticmethod
43
42
  def toolkit_config_schema() -> BaseModel:
44
- selected_tools = {}
45
- for t in __all__:
46
- default = t['tool'].__pydantic_fields__['args_schema'].default
47
- selected_tools[t['name']] = default.schema() if default else default
43
+ selected_tools = {x['name']: x['args_schema'].schema() for x in
44
+ BitbucketAPIWrapper.model_construct().get_available_tools()}
48
45
  AlitaBitbucketToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
49
46
  m = create_model(
50
47
  name,
@@ -98,7 +95,7 @@ class AlitaBitbucketToolkit(BaseToolkit):
98
95
  **(kwargs.get('pgvector_configuration') or {}),
99
96
  }
100
97
  bitbucket_api_wrapper = BitbucketAPIWrapper(**wrapper_payload)
101
- available_tools: List[Dict] = __all__
98
+ available_tools: List[Dict] = bitbucket_api_wrapper.get_available_tools()
102
99
  prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
103
100
  tools = []
104
101
  for tool in available_tools:
@@ -2,21 +2,119 @@
2
2
  from __future__ import annotations
3
3
 
4
4
  import logging
5
- from typing import TYPE_CHECKING, Any, Dict, List, Optional
5
+ from typing import Any, Dict, List, Optional
6
+ import fnmatch
6
7
 
7
8
  from langchain_core.tools import ToolException
8
- from pydantic import model_validator, SecretStr
9
+ from pydantic import model_validator, SecretStr, create_model, Field
9
10
  from .bitbucket_constants import create_pr_data
10
11
  from .cloud_api_wrapper import BitbucketCloudApi, BitbucketServerApi
11
12
  from pydantic.fields import PrivateAttr
12
13
 
13
- from ..elitea_base import BaseCodeToolApiWrapper
14
+ from ..elitea_base import BaseCodeToolApiWrapper, extend_with_vector_tools
14
15
 
15
16
  logger = logging.getLogger(__name__)
16
17
 
18
+ # Pydantic model definitions for tool arguments
19
+ CreateBranchModel = create_model(
20
+ "CreateBranchModel",
21
+ branch_name=(str, Field(description="The name of the branch, e.g. `my_branch`.")),
22
+ )
17
23
 
18
- if TYPE_CHECKING:
19
- pass
24
+ CreatePullRequestModel = create_model(
25
+ "CreatePullRequestModel",
26
+ pr_json_data=(str, Field(description=create_pr_data)),
27
+ )
28
+
29
+ CreateFileModel = create_model(
30
+ "CreateFileModel",
31
+ file_path=(str, Field(description="The path of the file")),
32
+ file_contents=(str, Field(description="The contents of the file")),
33
+ branch=(str, Field(description="The branch to create the file in")),
34
+ )
35
+
36
+ UpdateFileModel = create_model(
37
+ "UpdateFileModel",
38
+ file_path=(str, Field(description="The path of the file")),
39
+ update_query=(str, Field(description="Contains the file contents required to be updated. "
40
+ "The old file contents is wrapped in OLD <<<< and >>>> OLD. "
41
+ "The new file contents is wrapped in NEW <<<< and >>>> NEW")),
42
+ branch=(str, Field(description="The branch to update the file in")),
43
+ )
44
+
45
+ ReadFileModel = create_model(
46
+ "ReadFileModel",
47
+ file_path=(str, Field(description="The path of the file")),
48
+ branch=(str, Field(description="The branch to read the file from")),
49
+ )
50
+
51
+ SetActiveBranchModel = create_model(
52
+ "SetActiveBranchModel",
53
+ branch_name=(str, Field(description="The name of the branch, e.g. `my_branch`.")),
54
+ )
55
+
56
+ ListBranchesInRepoModel = create_model(
57
+ "ListBranchesInRepoModel",
58
+ limit=(Optional[int], Field(default=20, description="Maximum number of branches to return. If not provided, all branches will be returned.")),
59
+ branch_wildcard=(Optional[str], Field(default=None, description="Wildcard pattern to filter branches by name. If not provided, all branches will be returned."))
60
+ )
61
+
62
+ ListFilesModel = create_model(
63
+ "ListFilesModel",
64
+ path=(Optional[str], Field(description="The path to list files from")),
65
+ recursive=(bool, Field(description="Whether to list files recursively", default=True)),
66
+ branch=(Optional[str], Field(description="The branch to list files from")),
67
+ )
68
+
69
+ GetPullRequestsCommitsModel = create_model(
70
+ "GetPullRequestsCommitsModel",
71
+ pr_id=(str, Field(description="The ID of the pull request to get commits from")),
72
+ )
73
+
74
+ GetPullRequestModel = create_model(
75
+ "GetPullRequestModel",
76
+ pr_id=(str, Field(description="The ID of the pull request to get details from")),
77
+ )
78
+
79
+ GetPullRequestsChangesModel = create_model(
80
+ "GetPullRequestsChangesModel",
81
+ pr_id=(str, Field(description="The ID of the pull request to get changes from")),
82
+ )
83
+
84
+ AddPullRequestCommentModel = create_model(
85
+ "AddPullRequestCommentModel",
86
+ pr_id=(str, Field(description="The ID of the pull request to add a comment to")),
87
+ content=(str, Field(description="The comment content")),
88
+ inline=(Optional[dict], Field(default=None, description="Inline comment details. Example: {'from': 57, 'to': 122, 'path': '<string>'}"))
89
+ )
90
+
91
+ DeleteFileModel = create_model(
92
+ "DeleteFileModel",
93
+ file_path=(str, Field(description="The path of the file")),
94
+ branch=(str, Field(description="The branch to delete the file from")),
95
+ commit_message=(str, Field(default=None, description="Commit message for deleting the file. Optional.")),
96
+ )
97
+
98
+ AppendFileModel = create_model(
99
+ "AppendFileModel",
100
+ file_path=(str, Field(description="The path of the file")),
101
+ content=(str, Field(description="The content to append to the file")),
102
+ branch=(str, Field(description="The branch to append the file in")),
103
+ )
104
+
105
+ GetIssuesModel = create_model(
106
+ "GetIssuesModel",
107
+ )
108
+
109
+ GetIssueModel = create_model(
110
+ "GetIssueModel",
111
+ issue_number=(int, Field(description="The number of the issue")),
112
+ )
113
+
114
+ CommentOnIssueModel = create_model(
115
+ "CommentOnIssueModel",
116
+ comment_query=(str, Field(description="The comment query string")),
117
+ )
20
118
 
21
119
 
22
120
  class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
@@ -41,18 +139,6 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
41
139
  """Bitbucket installation type: true for cloud, false for server.
42
140
  """
43
141
 
44
- llm: Optional[Any] = None
45
- # Alita instance
46
- alita: Optional[Any] = None
47
-
48
- # Vector store configuration
49
- connection_string: Optional[SecretStr] = None
50
- collection_name: Optional[str] = None
51
- doctype: Optional[str] = 'code'
52
- embedding_model: Optional[str] = "HuggingFaceEmbeddings"
53
- embedding_model_params: Optional[Dict[str, Any]] = {"model_name": "sentence-transformers/all-MiniLM-L6-v2"}
54
- vectorstore_type: Optional[str] = "PGVector"
55
-
56
142
  @model_validator(mode='before')
57
143
  @classmethod
58
144
  def validate_env(cls, values: Dict) -> Dict:
@@ -83,14 +169,34 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
83
169
  cls._active_branch = values.get('branch')
84
170
  return values
85
171
 
86
- def set_active_branch(self, branch: str) -> None:
172
+ def set_active_branch(self, branch_name: str) -> str:
87
173
  """Set the active branch for the bot."""
88
- self._active_branch = branch
89
- return f"Active branch set to `{branch}`"
174
+ self._active_branch = branch_name
175
+ return f"Active branch set to `{branch_name}`"
90
176
 
91
- def list_branches_in_repo(self) -> List[str]:
92
- """List all branches in the repository."""
93
- return self._bitbucket.list_branches()
177
+ def list_branches_in_repo(self, limit: Optional[int] = 20, branch_wildcard: Optional[str] = None) -> List[str]:
178
+ """
179
+ Lists branches in the repository with optional limit and wildcard filtering.
180
+
181
+ Parameters:
182
+ limit (Optional[int]): Maximum number of branches to return
183
+ branch_wildcard (Optional[str]): Wildcard pattern to filter branches (e.g., '*dev')
184
+
185
+ Returns:
186
+ List[str]: List containing names of branches
187
+ """
188
+ try:
189
+ branches = self._bitbucket.list_branches()
190
+
191
+ if branch_wildcard:
192
+ branches = [branch for branch in branches if fnmatch.fnmatch(branch, branch_wildcard)]
193
+
194
+ if limit is not None:
195
+ branches = branches[:limit]
196
+
197
+ return branches
198
+ except Exception as e:
199
+ return f"Failed to list branches: {str(e)}"
94
200
 
95
201
  def create_branch(self, branch_name: str) -> None:
96
202
  """Create a new branch in the repository."""
@@ -266,3 +372,106 @@ class BitbucketAPIWrapper(BaseCodeToolApiWrapper):
266
372
  return self._bitbucket.get_file(file_path=file_path, branch=branch)
267
373
  except Exception as e:
268
374
  raise ToolException(f"Can't extract file content (`{file_path}`) due to error:\n{str(e)}")
375
+
376
+ def list_files(self, path: str = None, recursive: bool = True, branch: str = None) -> List[str]:
377
+ """List files in the repository with optional path, recursive search, and branch."""
378
+ branch = branch if branch else self._active_branch
379
+ try:
380
+ files_str = self._get_files(path, branch)
381
+ # Parse the string response to extract file paths
382
+ # This is a simplified implementation - might need adjustment based on actual response format
383
+ import ast
384
+ try:
385
+ files_list = ast.literal_eval(files_str)
386
+ if isinstance(files_list, list):
387
+ return files_list
388
+ else:
389
+ return [str(files_list)]
390
+ except:
391
+ return [files_str] if files_str else []
392
+ except Exception as e:
393
+ return f"Failed to list files: {str(e)}"
394
+
395
+ def read_file(self, file_path: str, branch: str) -> str:
396
+ """Read the contents of a file in the repository."""
397
+ try:
398
+ return self._read_file(file_path, branch)
399
+ except Exception as e:
400
+ return f"Failed to read file {file_path}: {str(e)}"
401
+
402
+ @extend_with_vector_tools
403
+ def get_available_tools(self):
404
+ return [
405
+ {
406
+ "name": "create_branch",
407
+ "ref": self.create_branch,
408
+ "description": self.create_branch.__doc__ or "Create a new branch in the repository.",
409
+ "args_schema": CreateBranchModel,
410
+ },
411
+ {
412
+ "name": "list_branches_in_repo",
413
+ "ref": self.list_branches_in_repo,
414
+ "description": self.list_branches_in_repo.__doc__ or "List branches in the repository with optional limit and wildcard filtering.",
415
+ "args_schema": ListBranchesInRepoModel,
416
+ },
417
+ {
418
+ "name": "list_files",
419
+ "ref": self.list_files,
420
+ "description": self.list_files.__doc__ or "List files in the repository with optional path, recursive search, and branch.",
421
+ "args_schema": ListFilesModel,
422
+ },
423
+ {
424
+ "name": "create_pull_request",
425
+ "ref": self.create_pull_request,
426
+ "description": self.create_pull_request.__doc__ or "Create a pull request in the repository.",
427
+ "args_schema": CreatePullRequestModel,
428
+ },
429
+ {
430
+ "name": "create_file",
431
+ "ref": self.create_file,
432
+ "description": self.create_file.__doc__ or "Create a new file in the repository.",
433
+ "args_schema": CreateFileModel,
434
+ },
435
+ {
436
+ "name": "read_file",
437
+ "ref": self.read_file,
438
+ "description": self.read_file.__doc__ or "Read the contents of a file in the repository.",
439
+ "args_schema": ReadFileModel,
440
+ },
441
+ {
442
+ "name": "update_file",
443
+ "ref": self.update_file,
444
+ "description": self.update_file.__doc__ or "Update the contents of a file in the repository.",
445
+ "args_schema": UpdateFileModel,
446
+ },
447
+ {
448
+ "name": "set_active_branch",
449
+ "ref": self.set_active_branch,
450
+ "description": self.set_active_branch.__doc__ or "Set the active branch in the repository.",
451
+ "args_schema": SetActiveBranchModel,
452
+ },
453
+ {
454
+ "name": "get_pull_requests_commits",
455
+ "ref": self.get_pull_requests_commits,
456
+ "description": self.get_pull_requests_commits.__doc__ or "Get commits from a pull request in the repository.",
457
+ "args_schema": GetPullRequestsCommitsModel,
458
+ },
459
+ {
460
+ "name": "get_pull_request",
461
+ "ref": self.get_pull_request,
462
+ "description": self.get_pull_request.__doc__ or "Get details of a pull request in the repository.",
463
+ "args_schema": GetPullRequestModel,
464
+ },
465
+ {
466
+ "name": "get_pull_requests_changes",
467
+ "ref": self.get_pull_requests_changes,
468
+ "description": self.get_pull_requests_changes.__doc__ or "Get changes from a pull request in the repository.",
469
+ "args_schema": GetPullRequestsChangesModel,
470
+ },
471
+ {
472
+ "name": "add_pull_request_comment",
473
+ "ref": self.add_pull_request_comment,
474
+ "description": self.add_pull_request_comment.__doc__ or "Add a comment to a pull request in the repository.",
475
+ "args_schema": AddPullRequestCommentModel,
476
+ },
477
+ ]
@@ -142,7 +142,7 @@ def load_content(file_path: str, extension: str = None, loader_extra_config: dic
142
142
  if "file_path" in loader_kwargs:
143
143
  del loader_kwargs["file_path"]
144
144
 
145
- loader = loader_cls(file_path, **loader_kwargs)
145
+ loader = loader_cls(file_path=file_path, **loader_kwargs)
146
146
  documents = loader.load()
147
147
 
148
148
  page_contents = [doc.page_content for doc in documents]
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: alita_sdk
3
- Version: 0.3.260
3
+ Version: 0.3.262
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
@@ -26,11 +26,11 @@ alita_sdk/configurations/zephyr_enterprise.py,sha256=5W1QEcv62Y5Rk_kApI2QmOwvWZe
26
26
  alita_sdk/runtime/__init__.py,sha256=4W0UF-nl3QF2bvET5lnah4o24CoTwSoKXhuN0YnwvEE,828
27
27
  alita_sdk/runtime/clients/__init__.py,sha256=BdehU5GBztN1Qi1Wul0cqlU46FxUfMnI6Vq2Zd_oq1M,296
28
28
  alita_sdk/runtime/clients/artifact.py,sha256=H3pJAh5G-zWVyJ6YbqHGk4jA8U6HfacQduiTivpJZ3Y,3210
29
- alita_sdk/runtime/clients/client.py,sha256=ZkXP3-e785EyYoJLNowAGV3bRqv3fs1XqD_iuqqkg9Y,43513
29
+ alita_sdk/runtime/clients/client.py,sha256=13_Ht9MnRO-9V1uP9_YTxM07g7mpm2uVevVh2wDPOnE,43567
30
30
  alita_sdk/runtime/clients/datasource.py,sha256=HAZovoQN9jBg0_-lIlGBQzb4FJdczPhkHehAiVG3Wx0,1020
31
31
  alita_sdk/runtime/clients/prompt.py,sha256=li1RG9eBwgNK_Qf0qUaZ8QNTmsncFrAL2pv3kbxZRZg,1447
32
32
  alita_sdk/runtime/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
33
- alita_sdk/runtime/langchain/assistant.py,sha256=Bn9vUyZlFAP-D9Bh3zc2G1ZQkh5rr2c2g5t1WAQW6Hw,13388
33
+ alita_sdk/runtime/langchain/assistant.py,sha256=suBFEt24t9bLyBHMzkR3Mkgd9HIrGBq_bzcMiENiEr4,13539
34
34
  alita_sdk/runtime/langchain/chat_message_template.py,sha256=kPz8W2BG6IMyITFDA5oeb5BxVRkHEVZhuiGl4MBZKdc,2176
35
35
  alita_sdk/runtime/langchain/constants.py,sha256=eHVJ_beJNTf1WJo4yq7KMK64fxsRvs3lKc34QCXSbpk,3319
36
36
  alita_sdk/runtime/langchain/indexer.py,sha256=0ENHy5EOhThnAiYFc7QAsaTNp9rr8hDV_hTK8ahbatk,37592
@@ -88,7 +88,7 @@ alita_sdk/runtime/toolkits/configurations.py,sha256=kIDAlnryPQfbZyFxV-9SzN2-Vefz
88
88
  alita_sdk/runtime/toolkits/datasource.py,sha256=qk78OdPoReYPCWwahfkKLbKc4pfsu-061oXRryFLP6I,2498
89
89
  alita_sdk/runtime/toolkits/prompt.py,sha256=WIpTkkVYWqIqOWR_LlSWz3ug8uO9tm5jJ7aZYdiGRn0,1192
90
90
  alita_sdk/runtime/toolkits/subgraph.py,sha256=ZYqI4yVLbEPAjCR8dpXbjbL2ipX598Hk3fL6AgaqFD4,1758
91
- alita_sdk/runtime/toolkits/tools.py,sha256=kOoWkG3MQtphc7WHqtbf7WTTZ1e-kjmlrdjcAEeoHnw,7999
91
+ alita_sdk/runtime/toolkits/tools.py,sha256=2WJNELUOjEL1v0LKANJ4crB2Kow3pfI03X1n30zUtTM,7906
92
92
  alita_sdk/runtime/toolkits/vectorstore.py,sha256=BGppQADa1ZiLO17fC0uCACTTEvPHlodEDYEzUcBRbAA,2901
93
93
  alita_sdk/runtime/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
94
94
  alita_sdk/runtime/tools/agent.py,sha256=m98QxOHwnCRTT9j18Olbb5UPS8-ZGeQaGiUyZJSyFck,3162
@@ -107,7 +107,7 @@ alita_sdk/runtime/tools/prompt.py,sha256=nJafb_e5aOM1Rr3qGFCR-SKziU9uCsiP2okIMs9
107
107
  alita_sdk/runtime/tools/router.py,sha256=wCvZjVkdXK9dMMeEerrgKf5M790RudH68pDortnHSz0,1517
108
108
  alita_sdk/runtime/tools/tool.py,sha256=lE1hGi6qOAXG7qxtqxarD_XMQqTghdywf261DZawwno,5631
109
109
  alita_sdk/runtime/tools/vectorstore.py,sha256=yl6FKJGVQDevftSkxWTkMbqjIskIFz69vXELdEGp9u4,34780
110
- alita_sdk/runtime/tools/vectorstore_base.py,sha256=Ko-82amS4mBoJqX-v6h-iUrQ5LNzMvM978q2i8TcfVw,27409
110
+ alita_sdk/runtime/tools/vectorstore_base.py,sha256=OM9nMUzQ7SgfQD8QYlzGYLXzKuGMZ1onpqSrBx9vMKk,27381
111
111
  alita_sdk/runtime/utils/AlitaCallback.py,sha256=E4LlSBuCHWiUq6W7IZExERHZY0qcmdjzc_rJlF2iQIw,7356
112
112
  alita_sdk/runtime/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
113
113
  alita_sdk/runtime/utils/constants.py,sha256=Xntx1b_uxUzT4clwqHA_U6K8y5bBqf_4lSQwXdcWrp4,13586
@@ -144,11 +144,10 @@ alita_sdk/tools/azure_ai/search/__init__.py,sha256=FVWNSW4LlOXKt34fVUgXut5oZcok9
144
144
  alita_sdk/tools/azure_ai/search/api_wrapper.py,sha256=E4p6HPDlwgxfT_i6cvg9rN4Vn_47CVAyNBAKLIGq3mU,7265
145
145
  alita_sdk/tools/base/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
146
146
  alita_sdk/tools/base/tool.py,sha256=-N27AodZS49vdPCgFkU-bFS9bxoPopZBnNrmwInx3d0,864
147
- alita_sdk/tools/bitbucket/__init__.py,sha256=_ywYlgYoE6gtJlLR94MHcS4EPWIaCFU_Mxy2Iha8nCE,5385
148
- alita_sdk/tools/bitbucket/api_wrapper.py,sha256=xKa2dQ-gw2YbLJx7P1xrc3JUfgBkXkMsEG-s0mzh3KI,11023
147
+ alita_sdk/tools/bitbucket/__init__.py,sha256=YhD74yn5pC8Kjm2nRfH3Xot00Nk2kpdvZxaLmMRzmKA,5343
148
+ alita_sdk/tools/bitbucket/api_wrapper.py,sha256=ajnF9-LYYy4w-tXagYtnvKicnQIZE0JUQPGlwOVOy7E,19983
149
149
  alita_sdk/tools/bitbucket/bitbucket_constants.py,sha256=UsbhQ1iEvrKoxceTFPWTYhaXS1zSxbmjs1TwY0-P4gw,462
150
150
  alita_sdk/tools/bitbucket/cloud_api_wrapper.py,sha256=VELi65tLXvszwCGQSqVfyVal0ylx9DgAmAGpRQL_Zkg,15522
151
- alita_sdk/tools/bitbucket/tools.py,sha256=o1hwSEbSmjd5YgF-AsWls2ZyrewUuegBn9S6xTwsT74,15326
152
151
  alita_sdk/tools/browser/__init__.py,sha256=iByi9uMGjd6v44SagIPTm5fu1vWnxIkjn3xsx86uRwI,5249
153
152
  alita_sdk/tools/browser/crawler.py,sha256=jhE35dU94eQLURSM-D50tspOqEMsiGzMDbYNqNSR2mU,2279
154
153
  alita_sdk/tools/browser/duck_duck_go_search.py,sha256=iKws923v34o-ySXohJw-8xTDBWlj3fMsnzC_ZRuPugE,2002
@@ -314,7 +313,7 @@ alita_sdk/tools/testrail/__init__.py,sha256=0kETjWKLU7R6mugBWsjwEUsh10pipbAeNSGJ
314
313
  alita_sdk/tools/testrail/api_wrapper.py,sha256=5T-QyTzt-J0rI32xc_E684lCdgyWeHSyeTYiwQwtGyg,32275
315
314
  alita_sdk/tools/utils/__init__.py,sha256=155xepXPr4OEzs2Mz5YnjXcBpxSv1X2eznRUVoPtyK0,3268
316
315
  alita_sdk/tools/utils/available_tools_decorator.py,sha256=IbrdfeQkswxUFgvvN7-dyLMZMyXLiwvX7kgi3phciCk,273
317
- alita_sdk/tools/utils/content_parser.py,sha256=zqeyuxZqZqVFq5M5sZM-falMdlOw48FyZnp3Z0XUpCw,9868
316
+ alita_sdk/tools/utils/content_parser.py,sha256=a8m5kSpEuI4d3YIJlBqSrHtEc-igAnOUDI_uRyo4Sls,9878
318
317
  alita_sdk/tools/vector_adapters/VectorStoreAdapter.py,sha256=a6FAsiix_EvATIKUf5YT6vHh5LDyJ5uSP3LJqoxFo04,17367
319
318
  alita_sdk/tools/vector_adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
320
319
  alita_sdk/tools/xray/__init__.py,sha256=BnG2StSfX44CUMtrjHTcSCDWxxse5tCZqwyaZSkBKIc,4230
@@ -336,8 +335,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=HOt9ShtJI_1tVPcwd3Rwk-VS0SMLq
336
335
  alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
337
336
  alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
338
337
  alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
339
- alita_sdk-0.3.260.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
340
- alita_sdk-0.3.260.dist-info/METADATA,sha256=dRh-jEpVK5p3pK7KvE4h_JEX6qfMkaHe8F4NkOdHs8c,18897
341
- alita_sdk-0.3.260.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
342
- alita_sdk-0.3.260.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
343
- alita_sdk-0.3.260.dist-info/RECORD,,
338
+ alita_sdk-0.3.262.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
339
+ alita_sdk-0.3.262.dist-info/METADATA,sha256=jMCRTQ5YTuRDgHondlpPBMyNcZ9IH5M7jebxHxoZjTY,18897
340
+ alita_sdk-0.3.262.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
341
+ alita_sdk-0.3.262.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
342
+ alita_sdk-0.3.262.dist-info/RECORD,,
@@ -1,304 +0,0 @@
1
- import logging
2
- import traceback
3
- from typing import Type, Optional, List
4
-
5
- from langchain_core.tools import BaseTool
6
- from pydantic import create_model, Field, BaseModel
7
- from .bitbucket_constants import create_pr_data
8
-
9
- from .api_wrapper import BitbucketAPIWrapper
10
- from ..elitea_base import LoaderSchema
11
-
12
- logger = logging.getLogger(__name__)
13
-
14
- branchInput = create_model(
15
- "BranchInput",
16
- branch_name=(str, Field(description="The name of the branch, e.g. `my_branch`.")))
17
-
18
-
19
- class CreateBitbucketBranchTool(BaseTool):
20
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
21
- name: str = "create_branch"
22
- description: str = """This tool is a wrapper for the Bitbucket API to create a new branch in the repository."""
23
- args_schema: Type[BaseModel] = branchInput
24
-
25
- def _run(self, branch_name: str):
26
- try:
27
- logger.info(f"Creating branch {branch_name} in the repository.")
28
- return self.api_wrapper.create_branch(branch_name)
29
- except Exception:
30
- stacktrace = traceback.format_exc()
31
- logger.error(f"Unable to create a branch: {stacktrace}")
32
- return f"Unable to create a branch: {stacktrace}"
33
-
34
-
35
- class CreatePRTool(BaseTool):
36
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
37
- name: str = "create_pull_request"
38
- description: str = """This tool is a wrapper for the Bitbucket API to create a new pull request in a GitLab repository.
39
- Strictly follow and provide input parameters based on context.
40
- """
41
- args_schema: Type[BaseModel] = create_model(
42
- "CreatePRInput",
43
- pr_json_data=(str, Field(description=create_pr_data)))
44
-
45
- def _run(self, pr_json_data: str):
46
- try:
47
- base_branch = self.api_wrapper.branch
48
- logger.info(f"Creating pull request using data: base_branch: {pr_json_data}")
49
- return self.api_wrapper.create_pull_request(pr_json_data)
50
- except Exception as e:
51
- stacktrace = traceback.format_exc()
52
- logger.error(f"Unable to create PR: {stacktrace}")
53
- return f"Unable to create PR: {stacktrace}"
54
-
55
-
56
- class CreateFileTool(BaseTool):
57
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
58
- name: str = "create_file"
59
- description: str = """This tool is a wrapper for the Bitbucket API, useful when you need to create a file in a Bitbucket repository.
60
- """
61
- args_schema: Type[BaseModel] = create_model(
62
- "CreateFileInput",
63
- file_path=(str, Field(
64
- description="File path of file to be created. e.g. `src/agents/developer/tools/git/bitbucket.py`. **IMPORTANT**: the path must not start with a slash")),
65
- file_contents=(str, Field(description="""
66
- Full file content to be created. It must be without any escapes, just raw content to CREATE in GIT.
67
- Generate full file content for this field without any additional texts, escapes, just raw code content.
68
- You MUST NOT ignore, skip or comment any details, PROVIDE FULL CONTENT including all content based on all best practices.
69
- """)),
70
- branch=(str, Field(
71
- description="branch - name of the branch file should be read from. e.g. `feature-1`. **IMPORTANT**: if branch not specified, try to determine from the chat history or clarify with user."))
72
- )
73
-
74
- def _run(self, file_path: str, file_contents: str, branch: str):
75
- logger.info(f"Create file in the repository {file_path} with content: {file_contents}")
76
- return self.api_wrapper.create_file(file_path, file_contents, branch)
77
-
78
-
79
- class UpdateFileTool(BaseTool):
80
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
81
- name: str = "update_file"
82
- description: str = """
83
- Updates a file with new content.
84
- Parameters:
85
- file_path (str): Path to the file to be updated
86
- branch (str): The name of the branch where update the file.
87
- update_query(str): Contains file contents.
88
- The old file contents is wrapped in OLD <<<< and >>>> OLD
89
- The new file contents is wrapped in NEW <<<< and >>>> NEW
90
- For example:
91
- /test/hello.txt
92
- OLD <<<<
93
- Hello Earth!
94
- >>>> OLD
95
- NEW <<<<
96
- Hello Mars!
97
- >>>> NEW
98
- """
99
- args_schema: Type[BaseModel] = create_model(
100
- "UpdateFileTool",
101
- file_path=(str, Field(
102
- description="File path of file to be updated. e.g. `src/agents/developer/tools/git/bitbucket.py`. **IMPORTANT**: the path must not start with a slash")),
103
- update_query=(str, Field(description="File path followed by the old and new contents")),
104
- branch=(str, Field(
105
- description="branch - the name of the branch where file that has to be updated is located. e.g. `feature-1`. **IMPORTANT**: if branch not specified, try to determine from the chat history or clarify with user."))
106
- )
107
-
108
- def _run(self, file_path: str, update_query: str, branch: str):
109
- logger.info(f"Update file in the repository {file_path} with content: {update_query} and branch {branch}")
110
- return self.api_wrapper.update_file(file_path, update_query, branch)
111
-
112
-
113
- class SetActiveBranchTool(BaseTool):
114
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
115
- name: str = "set_active_branch"
116
- description: str = """
117
- This tool is a wrapper for the Bitbucket API and set the active branch in the repository, similar to `git checkout <branch_name>` and `git switch -c <branch_name>`."""
118
- args_schema: Type[BaseModel] = branchInput
119
-
120
- def _run(self, branch_name: str):
121
- try:
122
- logger.info(f"Set active branch {branch_name} in the repository.")
123
- return self.api_wrapper.set_active_branch(branch=branch_name)
124
- except Exception as e:
125
- stacktrace = traceback.format_exc()
126
- logger.error(f"Unable to set active branch: {stacktrace}")
127
- return f"Unable to set active branch: {stacktrace}"
128
-
129
-
130
- class ListBranchesTool(BaseTool):
131
- """Tool for interacting with the Bitbucket API."""
132
-
133
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
134
- name: str = "list_branches_in_repo"
135
- description: str = """This tool is a wrapper for the Bitbucket API to fetch a list of all branches in the repository.
136
- It will return the name of each branch. No input parameters are required."""
137
- args_schema: Type[BaseModel] = create_model("NoInput")
138
-
139
- def _run(self):
140
- try:
141
- logger.debug("List branches in the repository.")
142
- return self.api_wrapper.list_branches_in_repo()
143
- except Exception as e:
144
- stacktrace = traceback.format_exc()
145
- logger.error(f"Unable to list branches: {stacktrace}")
146
- return f"Unable to list branches: {stacktrace}"
147
-
148
-
149
- class ReadFileTool(BaseTool):
150
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
151
- name: str = "read_file"
152
- description: str = """This tool is a wrapper for the GitLab API, useful when you need to read a file in a GitLab repository.
153
- Simply pass in the full
154
- file path of the file you would like to read. **IMPORTANT**: the path must not start with a slash"""
155
- args_schema: Type[BaseModel] = create_model(
156
- "ReadFileInput",
157
- file_path=(str, Field(
158
- description="File path of file to be read. e.g. `src/agents/developer/tools/git/github_tools.py`. **IMPORTANT**: the path must not start with a slash")),
159
- branch=(str, Field(
160
- description="branch - name of the branch file should be read from. e.g. `feature-1`. **IMPORTANT**: if branch not specified, try to determine from the chat history or clarify with user."))
161
- )
162
-
163
- def _run(self, file_path: str, branch: str):
164
- try:
165
- return self.api_wrapper._read_file(file_path, branch)
166
- except Exception:
167
- stacktrace = traceback.format_exc()
168
- logger.error(f"Unable to read file: {stacktrace}")
169
- return f"Unable to read file: {stacktrace}"
170
-
171
-
172
- class GetFilesListTool(BaseTool):
173
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
174
- name: str = "get_files"
175
- description: str = """
176
- This tool returns list of files.
177
- IMPORTANT: *User may leave it empty if he wants to read files from the root of the repository and using active branch.*
178
-
179
- Args:
180
- file_path (Optional[str], default: None): Package path to read files from. e.g. `src/agents/developer/tools/git/`. **IMPORTANT**: the path must not start with a slash.
181
- branch (Optional[str], default: None): branch - name of the branch file should be read from. e.g. `feature-1`. **IMPORTANT**: if branch not specified, try to determine from the chat history, leave it empty.
182
- """
183
- args_schema: Type[BaseModel] = create_model(
184
- "GetFilesListModel",
185
- file_path=(Optional[str], Field(
186
- description="Package path to read files from. e.g. `src/agents/developer/tools/git/`. Default: None. "
187
- "**IMPORTANT**: the path must not start with a slash",
188
- default=None)),
189
- branch=(Optional[str], Field(
190
- description="branch - name of the branch file should be read from. e.g. `feature-1`. Default: None. "
191
- "**IMPORTANT**: if branch not specified, try to determine from the chat history or use active branch.",
192
- default=None))
193
- )
194
-
195
- def _run(self, file_path: Optional[str] = None, branch: Optional[str] = None):
196
- try:
197
- return self.api_wrapper._get_files(file_path, branch)
198
- except Exception:
199
- stacktrace = traceback.format_exc()
200
- logger.error(f"Unable to read file: {stacktrace}")
201
- return f"Unable to read file: {stacktrace}"
202
-
203
-
204
- class LoaderTool(BaseTool):
205
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
206
- name: str = "loader"
207
- description: str = """This tool is a wrapper for the Bitbucket API, useful when you need to create a file in a Bitbucket repository.
208
- """
209
- args_schema: Type[BaseModel] = LoaderSchema
210
-
211
- def _run(self,
212
- branch: Optional[str] = None,
213
- whitelist: Optional[List[str]] = None,
214
- blacklist: Optional[List[str]] = None):
215
- return self.api_wrapper.loader(branch, whitelist, blacklist)
216
-
217
-
218
- class GetPullRequestsCommitsTool(BaseTool):
219
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
220
- name: str = "get_pull_requests_commits"
221
- description: str = """This tool is a wrapper for the Bitbucket API to get commits from pull requests."""
222
- args_schema: Type[BaseModel] = create_model(
223
- "GetPullRequestsCommitsInput",
224
- pr_id=(str, Field(description="The ID of the pull request to get commits from.")))
225
-
226
- def _run(self, pr_id: str):
227
- try:
228
- logger.debug(f"Get pull request commits for {pr_id}.")
229
- return self.api_wrapper.get_pull_requests_commits(pr_id)
230
- except Exception as e:
231
- stacktrace = traceback.format_exc()
232
- logger.error(f"Can't get commits from pull request `{pr_id}` due to error:\n{stacktrace}")
233
- return f"Can't get commits from pull request `{pr_id}` due to error:\n{stacktrace}"
234
-
235
- class GetPullRequestTool(BaseTool):
236
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
237
- name: str = "get_pull_request"
238
- description: str = """This tool is a wrapper for the Bitbucket API to get details of a pull request."""
239
- args_schema: Type[BaseModel] = create_model(
240
- "GetPullRequestInput",
241
- pr_id=(str, Field(description="The ID of the pull request to get details from.")))
242
-
243
- def _run(self, pr_id: str):
244
- try:
245
- logger.debug(f"Get pull request details for {pr_id}.")
246
- return self.api_wrapper.get_pull_request(pr_id)
247
- except Exception as e:
248
- stacktrace = traceback.format_exc()
249
- logger.error(f"Can't get pull request `{pr_id}` due to error:\n{stacktrace}")
250
- return f"Can't get pull request `{pr_id}` due to error:\n{stacktrace}"
251
-
252
- class GetPullRequestsChangesTool(BaseTool):
253
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
254
- name: str = "get_pull_requests_changes"
255
- description: str = """This tool is a wrapper for the Bitbucket API to get changes of a pull request."""
256
- args_schema: Type[BaseModel] = create_model(
257
- "GetPullRequestsChangesInput",
258
- pr_id=(str, Field(description="The ID of the pull request to get changes from.")))
259
-
260
- def _run(self, pr_id: str):
261
- try:
262
- logger.debug(f"Get pull request changes for {pr_id}.")
263
- return self.api_wrapper.get_pull_requests_changes(pr_id)
264
- except Exception as e:
265
- stacktrace = traceback.format_exc()
266
- logger.error(f"Can't get changes from pull request `{pr_id}` due to error:\n{stacktrace}")
267
- return f"Can't get changes from pull request `{pr_id}` due to error:\n{stacktrace}"
268
-
269
- class AddPullRequestCommentTool(BaseTool):
270
- api_wrapper: BitbucketAPIWrapper = Field(default_factory=BitbucketAPIWrapper)
271
- name: str = "add_pull_request_comment"
272
- description: str = """This tool is a wrapper for the Bitbucket API to add a comment to a pull request.
273
- Supports multiple content types and inline comments."""
274
- args_schema: Type[BaseModel] = create_model(
275
- "AddPullRequestCommentInput",
276
- pr_id=(str, Field(description="The ID of the pull request to add a comment to.")),
277
- content=(str, Field(description="The comment content. Can be a string (raw text) or a dict with keys 'raw', 'markup', 'html'.")),
278
- inline=(Optional[dict], Field(default=None, description="Inline comment details. Example: {'from': 57, 'to': 122, 'path': '<string>'}"))
279
- )
280
-
281
- def _run(self, pr_id: str, content: str, inline: Optional[dict] = None):
282
- try:
283
- logger.debug(f"Add comment to pull request {pr_id}.")
284
- return self.api_wrapper.add_pull_request_comment(pr_id, content, inline)
285
- except Exception as e:
286
- stacktrace = traceback.format_exc()
287
- logger.error(f"Can't add comment to pull request `{pr_id}` due to error:\n{stacktrace}")
288
- return f"Can't add comment to pull request `{pr_id}` due to error:\n{stacktrace}"
289
-
290
- __all__ = [
291
- {"name": "create_branch", "tool": CreateBitbucketBranchTool},
292
- {"name": "create_pull_request", "tool": CreatePRTool},
293
- {"name": "create_file", "tool": CreateFileTool},
294
- {"name": "set_active_branch", "tool": SetActiveBranchTool},
295
- {"name": "list_branches_in_repo", "tool": ListBranchesTool},
296
- {"name": "read_file", "tool": ReadFileTool},
297
- {"name": "get_files", "tool": GetFilesListTool},
298
- {"name": "update_file", "tool": UpdateFileTool},
299
- {"name": "loader", "tool": LoaderTool},
300
- {"name": "get_pull_requests_commits", "tool": GetPullRequestsCommitsTool},
301
- {"name": "get_pull_request", "tool": GetPullRequestTool},
302
- {"name": "get_pull_requests_changes", "tool": GetPullRequestsChangesTool},
303
- {"name": "add_pull_request_comment", "tool": AddPullRequestCommentTool}
304
- ]