alita-sdk 0.3.169__py3-none-any.whl → 0.3.171__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/langchain/langraph_agent.py +13 -5
- alita_sdk/tools/__init__.py +8 -9
- alita_sdk/tools/ado/repos/__init__.py +15 -2
- alita_sdk/tools/ado/repos/repos_wrapper.py +13 -8
- alita_sdk/tools/ado/work_item/__init__.py +2 -3
- {alita_sdk-0.3.169.dist-info → alita_sdk-0.3.171.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.169.dist-info → alita_sdk-0.3.171.dist-info}/RECORD +10 -10
- {alita_sdk-0.3.169.dist-info → alita_sdk-0.3.171.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.169.dist-info → alita_sdk-0.3.171.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.169.dist-info → alita_sdk-0.3.171.dist-info}/top_level.txt +0 -0
@@ -285,7 +285,7 @@ class StateModifierNode(Runnable):
|
|
285
285
|
|
286
286
|
|
287
287
|
|
288
|
-
def prepare_output_schema(lg_builder, memory, store, debug=False, interrupt_before=None, interrupt_after=None, state_class=None):
|
288
|
+
def prepare_output_schema(lg_builder, memory, store, debug=False, interrupt_before=None, interrupt_after=None, state_class=None, output_variables=None):
|
289
289
|
# prepare output channels
|
290
290
|
if interrupt_after is None:
|
291
291
|
interrupt_after = []
|
@@ -328,7 +328,8 @@ def prepare_output_schema(lg_builder, memory, store, debug=False, interrupt_befo
|
|
328
328
|
auto_validate=False,
|
329
329
|
debug=debug,
|
330
330
|
store=store,
|
331
|
-
schema_to_mapper=state_class
|
331
|
+
schema_to_mapper=state_class,
|
332
|
+
output_variables=output_variables
|
332
333
|
)
|
333
334
|
|
334
335
|
compiled.attach_node(START, None)
|
@@ -597,13 +598,16 @@ def create_graph(
|
|
597
598
|
lg_builder, memory, store, debug,
|
598
599
|
interrupt_before=interrupt_before,
|
599
600
|
interrupt_after=interrupt_after,
|
600
|
-
state_class={state_class: None}
|
601
|
+
state_class={state_class: None},
|
602
|
+
output_variables=node.get('output', [])
|
601
603
|
)
|
602
604
|
return compiled.validate()
|
603
605
|
|
604
606
|
|
605
607
|
class LangGraphAgentRunnable(CompiledStateGraph):
|
606
|
-
|
608
|
+
def __init__(self, *args, output_variables=None, **kwargs):
|
609
|
+
super().__init__(*args, **kwargs)
|
610
|
+
self.output_variables = output_variables
|
607
611
|
|
608
612
|
def invoke(self, input: Union[dict[str, Any], Any],
|
609
613
|
config: Optional[RunnableConfig] = None,
|
@@ -624,7 +628,11 @@ class LangGraphAgentRunnable(CompiledStateGraph):
|
|
624
628
|
else:
|
625
629
|
result = super().invoke(input, config=config, *args, **kwargs)
|
626
630
|
try:
|
627
|
-
|
631
|
+
if self.output_variables and self.output_variables[0] != "messages":
|
632
|
+
# If output_variables are specified, use the value of first one or use the last messages as default
|
633
|
+
output = result.get(self.output_variables[0], result['messages'][-1].content)
|
634
|
+
else:
|
635
|
+
output = result['messages'][-1].content
|
628
636
|
except:
|
629
637
|
output = list(result.values())[-1]
|
630
638
|
thread_id = None
|
alita_sdk/tools/__init__.py
CHANGED
@@ -54,7 +54,7 @@ _safe_import_tool('zephyr_enterprise', 'zephyr_enterprise', 'get_tools', 'Zephyr
|
|
54
54
|
_safe_import_tool('ado', 'ado', 'get_tools')
|
55
55
|
_safe_import_tool('ado_repos', 'ado.repos', 'get_tools', 'AzureDevOpsReposToolkit')
|
56
56
|
_safe_import_tool('ado_plans', 'ado.test_plan', None, 'AzureDevOpsPlansToolkit')
|
57
|
-
_safe_import_tool('
|
57
|
+
_safe_import_tool('ado_boards', 'ado.work_item', None, 'AzureDevOpsWorkItemsToolkit')
|
58
58
|
_safe_import_tool('ado_wiki', 'ado.wiki', None, 'AzureDevOpsWikiToolkit')
|
59
59
|
_safe_import_tool('rally', 'rally', 'get_tools', 'RallyToolkit')
|
60
60
|
_safe_import_tool('sql', 'sql', 'get_tools', 'SQLToolkit')
|
@@ -97,17 +97,16 @@ def get_tools(tools_list, alita, llm, store: Optional[BaseStore] = None, *args,
|
|
97
97
|
tool['settings']['llm'] = llm
|
98
98
|
tool['settings']['store'] = store
|
99
99
|
tool_type = tool['type']
|
100
|
-
|
100
|
+
|
101
|
+
# Handle special cases for ADO tools
|
102
|
+
if tool_type in ['ado_boards', 'ado_wiki', 'ado_plans']:
|
103
|
+
tools.extend(AVAILABLE_TOOLS['ado']['get_tools'](tool_type, tool))
|
104
|
+
|
101
105
|
# Check if tool is available and has get_tools function
|
102
|
-
|
106
|
+
elif tool_type in AVAILABLE_TOOLS and 'get_tools' in AVAILABLE_TOOLS[tool_type]:
|
103
107
|
try:
|
104
108
|
get_tools_func = AVAILABLE_TOOLS[tool_type]['get_tools']
|
105
|
-
|
106
|
-
# Handle special cases for ADO tools
|
107
|
-
if tool_type in ['ado_boards', 'ado_wiki', 'ado_plans']:
|
108
|
-
tools.extend(get_tools_func(tool_type, tool))
|
109
|
-
else:
|
110
|
-
tools.extend(get_tools_func(tool))
|
109
|
+
tools.extend(get_tools_func(tool))
|
111
110
|
|
112
111
|
except Exception as e:
|
113
112
|
logger.error(f"Error getting tools for {tool_type}: {e}")
|
@@ -3,9 +3,10 @@ from typing import List, Literal, Optional
|
|
3
3
|
from langchain_core.tools import BaseTool, BaseToolkit
|
4
4
|
from pydantic import BaseModel, Field, create_model, SecretStr
|
5
5
|
|
6
|
+
import requests
|
6
7
|
from ...base.tool import BaseAction
|
7
8
|
from .repos_wrapper import ReposApiWrapper
|
8
|
-
from ...utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length
|
9
|
+
from ...utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length, check_connection_response
|
9
10
|
|
10
11
|
name = "ado_repos"
|
11
12
|
|
@@ -43,7 +44,7 @@ class AzureDevOpsReposToolkit(BaseToolkit):
|
|
43
44
|
def toolkit_config_schema() -> BaseModel:
|
44
45
|
selected_tools = {x['name']: x['args_schema'].schema() for x in ReposApiWrapper.model_construct().get_available_tools()}
|
45
46
|
AzureDevOpsReposToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
46
|
-
|
47
|
+
m = create_model(
|
47
48
|
name,
|
48
49
|
organization_url=(Optional[str], Field(default="", title="Organization URL", description="ADO organization url")),
|
49
50
|
project=(Optional[str], Field(default="", title="Project", description="ADO project")),
|
@@ -78,6 +79,18 @@ class AzureDevOpsReposToolkit(BaseToolkit):
|
|
78
79
|
}}}
|
79
80
|
)
|
80
81
|
|
82
|
+
@check_connection_response
|
83
|
+
def check_connection(self):
|
84
|
+
response = requests.get(
|
85
|
+
f'{self.organization_url}/{self.project}/_apis/git/repositories/{self.repository_id}?api-version=7.0',
|
86
|
+
headers = {'Authorization': f'Bearer {self.token}'},
|
87
|
+
timeout=5
|
88
|
+
)
|
89
|
+
return response
|
90
|
+
|
91
|
+
m.check_connection = check_connection
|
92
|
+
return m
|
93
|
+
|
81
94
|
@classmethod
|
82
95
|
def get_toolkit(cls, selected_tools: list[str] | None = None, toolkit_name: Optional[str] = None, **kwargs):
|
83
96
|
from os import environ
|
@@ -191,10 +191,14 @@ class ArgsSchema(Enum):
|
|
191
191
|
"CreatePullRequest",
|
192
192
|
pull_request_title=(str, Field(description="Title of the pull request")),
|
193
193
|
pull_request_body=(str, Field(description="Body of the pull request")),
|
194
|
-
|
194
|
+
target_branch=(
|
195
195
|
str,
|
196
|
-
Field(description="The name of the branch, e.g. `my_branch`."),
|
196
|
+
Field(description="The name of the target branch, e.g. `my_branch`."),
|
197
197
|
),
|
198
|
+
source_branch=(
|
199
|
+
str,
|
200
|
+
Field(description="The name of the source branch, e.g. `feature_branch`."),
|
201
|
+
)
|
198
202
|
)
|
199
203
|
GetCommits = create_model(
|
200
204
|
"GetCommits",
|
@@ -1041,7 +1045,7 @@ class ReposApiWrapper(BaseCodeToolApiWrapper):
|
|
1041
1045
|
return ToolException(msg)
|
1042
1046
|
|
1043
1047
|
def create_pr(
|
1044
|
-
self, pull_request_title: str, pull_request_body: str,
|
1048
|
+
self, pull_request_title: str, pull_request_body: str, target_branch: str, source_branch: str
|
1045
1049
|
) -> str:
|
1046
1050
|
"""
|
1047
1051
|
Creates a pull request in Azure DevOps from the active branch to the base branch mentioned in params.
|
@@ -1049,18 +1053,19 @@ class ReposApiWrapper(BaseCodeToolApiWrapper):
|
|
1049
1053
|
Parameters:
|
1050
1054
|
pull_request_title (str): Title of the pull request.
|
1051
1055
|
pull_request_body (str): Description/body of the pull request.
|
1052
|
-
|
1056
|
+
target_branch (str): The name of the branch which is used as target branch for pull request.
|
1057
|
+
source_branch (str): The name of the source branch which is used as source branch for pull request.
|
1053
1058
|
|
1054
1059
|
Returns:
|
1055
1060
|
str: A success or failure message.
|
1056
1061
|
"""
|
1057
|
-
if
|
1058
|
-
return f"Cannot create a pull request because the source branch '{
|
1062
|
+
if source_branch == target_branch:
|
1063
|
+
return f"Cannot create a pull request because the source branch '{source_branch}' is the same as the target branch '{target_branch}'"
|
1059
1064
|
|
1060
1065
|
try:
|
1061
1066
|
pull_request = {
|
1062
|
-
"sourceRefName": f"refs/heads/{
|
1063
|
-
"targetRefName": f"refs/heads/{
|
1067
|
+
"sourceRefName": f"refs/heads/{source_branch}",
|
1068
|
+
"targetRefName": f"refs/heads/{target_branch}",
|
1064
1069
|
"title": pull_request_title,
|
1065
1070
|
"description": pull_request_body,
|
1066
1071
|
"reviewers": [],
|
@@ -6,8 +6,7 @@ from pydantic import create_model, BaseModel, Field, SecretStr
|
|
6
6
|
from ...base.tool import BaseAction
|
7
7
|
from ...utils import clean_string, TOOLKIT_SPLITTER, get_max_toolkit_length
|
8
8
|
|
9
|
-
name = "
|
10
|
-
name_alias = 'ado_boards'
|
9
|
+
name = "ado_boards"
|
11
10
|
|
12
11
|
class AzureDevOpsWorkItemsToolkit(BaseToolkit):
|
13
12
|
tools: List[BaseTool] = []
|
@@ -18,7 +17,7 @@ class AzureDevOpsWorkItemsToolkit(BaseToolkit):
|
|
18
17
|
selected_tools = {x['name']: x['args_schema'].schema() for x in AzureDevOpsApiWrapper.model_construct().get_available_tools()}
|
19
18
|
AzureDevOpsWorkItemsToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
20
19
|
return create_model(
|
21
|
-
|
20
|
+
name,
|
22
21
|
name=(str, Field(description="Toolkit name",
|
23
22
|
json_schema_extra={
|
24
23
|
'toolkit_name': True,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.171
|
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
|
@@ -52,7 +52,7 @@ alita_sdk/runtime/langchain/assistant.py,sha256=QJEMiEOrFMJ4GpnK24U2pKFblrvdQpKF
|
|
52
52
|
alita_sdk/runtime/langchain/chat_message_template.py,sha256=kPz8W2BG6IMyITFDA5oeb5BxVRkHEVZhuiGl4MBZKdc,2176
|
53
53
|
alita_sdk/runtime/langchain/constants.py,sha256=eHVJ_beJNTf1WJo4yq7KMK64fxsRvs3lKc34QCXSbpk,3319
|
54
54
|
alita_sdk/runtime/langchain/indexer.py,sha256=0ENHy5EOhThnAiYFc7QAsaTNp9rr8hDV_hTK8ahbatk,37592
|
55
|
-
alita_sdk/runtime/langchain/langraph_agent.py,sha256
|
55
|
+
alita_sdk/runtime/langchain/langraph_agent.py,sha256=ac96v-Nr7t1x1NzaOpvV1VuML3LfoNNIDTDl8pb-bSY,40505
|
56
56
|
alita_sdk/runtime/langchain/mixedAgentParser.py,sha256=M256lvtsL3YtYflBCEp-rWKrKtcY1dJIyRGVv7KW9ME,2611
|
57
57
|
alita_sdk/runtime/langchain/mixedAgentRenderes.py,sha256=asBtKqm88QhZRILditjYICwFVKF5KfO38hu2O-WrSWE,5964
|
58
58
|
alita_sdk/runtime/langchain/store_manager.py,sha256=w5-0GbPGJAw14g0CCD9BKFMznzk1I-iJ5OGj_HZJZgA,2211
|
@@ -129,17 +129,17 @@ alita_sdk/runtime/utils/logging.py,sha256=svPyiW8ztDfhqHFITv5FBCj8UhLxz6hWcqGIY6
|
|
129
129
|
alita_sdk/runtime/utils/save_dataframe.py,sha256=i-E1wp-t4wb17Zq3nA3xYwgSILjoXNizaQAA9opWvxY,1576
|
130
130
|
alita_sdk/runtime/utils/streamlit.py,sha256=z4J_bdxkA0zMROkvTB4u379YBRFCkKh-h7PD8RlnZWQ,85644
|
131
131
|
alita_sdk/runtime/utils/utils.py,sha256=dM8whOJAuFJFe19qJ69-FLzrUp6d2G-G6L7d4ss2XqM,346
|
132
|
-
alita_sdk/tools/__init__.py,sha256=
|
132
|
+
alita_sdk/tools/__init__.py,sha256=48DhEi14KkaYhNb-KvXuM9XJ4WGC-v9sRcWfN7GFWd4,9963
|
133
133
|
alita_sdk/tools/elitea_base.py,sha256=NQaIxPX6DVIerHCb18jwUR6maZxxk73NZaTsFHkBQWE,21119
|
134
134
|
alita_sdk/tools/ado/__init__.py,sha256=mD6GHcYMTtffPJkJvFPe2rzvye_IRmXmWfI7xYuZhO4,912
|
135
135
|
alita_sdk/tools/ado/utils.py,sha256=PTCludvaQmPLakF2EbCGy66Mro4-rjDtavVP-xcB2Wc,1252
|
136
|
-
alita_sdk/tools/ado/repos/__init__.py,sha256=
|
137
|
-
alita_sdk/tools/ado/repos/repos_wrapper.py,sha256=
|
136
|
+
alita_sdk/tools/ado/repos/__init__.py,sha256=Wro7xo1GcpX4M4yPBqDKFFE2wCCVzj0HyusdAmloxKM,5686
|
137
|
+
alita_sdk/tools/ado/repos/repos_wrapper.py,sha256=_OWKAls7VFfFtEPTwqj_DxE1MSvpC0ivxdTIULEz3Tk,48206
|
138
138
|
alita_sdk/tools/ado/test_plan/__init__.py,sha256=ctn2CUkH_xS0Wkv2gLrO3FHQ36BvNCc0VcpMuddvU8E,3404
|
139
139
|
alita_sdk/tools/ado/test_plan/test_plan_wrapper.py,sha256=oIvVhLUMP5ZGctoAtK6sU0y6Si9gNv9-mbLqcWtw3gY,12525
|
140
140
|
alita_sdk/tools/ado/wiki/__init__.py,sha256=92AIAXVYSEYKnNvEG08W2YmR2lC35Bn92CiXJ8T3vpA,3736
|
141
141
|
alita_sdk/tools/ado/wiki/ado_wrapper.py,sha256=l4bc2QoKSUXg9UqNcx0ylv7YL9JPPQd35Ti5MXyEgC4,12690
|
142
|
-
alita_sdk/tools/ado/work_item/__init__.py,sha256=
|
142
|
+
alita_sdk/tools/ado/work_item/__init__.py,sha256=HcPX18wODKCn8oCnhs0DRXYKaRxiQ6GvEGgd1emHud8,3832
|
143
143
|
alita_sdk/tools/ado/work_item/ado_wrapper.py,sha256=t0D9xubU0yy_JmRJ_zEtRCxwFLyanT1StbIrtHGaqpw,26108
|
144
144
|
alita_sdk/tools/advanced_jira_mining/__init__.py,sha256=pUTzECqGvYaR5qWY3JPUhrImrZgc7pCXuqSe5eWIE80,4604
|
145
145
|
alita_sdk/tools/advanced_jira_mining/data_mining_wrapper.py,sha256=nZPtuwVWp8VeHw1B8q9kdwf-6ZvHnlXTOGdcIMDkKpw,44211
|
@@ -326,8 +326,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=UHVQUVqcBc3SZvDfO78HSuBzwAsRw
|
|
326
326
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=rq4jOb3lRW2GXvAguk4H1KinO5f-zpygzhBJf-E1Ucw,2773
|
327
327
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=iOMxyE7vOc_LwFB_nBMiSFXkNtvbptA4i-BrTlo7M0A,5854
|
328
328
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=IYUJoMFOMA70knLhLtAnuGoy3OK80RuqeQZ710oyIxE,3631
|
329
|
-
alita_sdk-0.3.
|
330
|
-
alita_sdk-0.3.
|
331
|
-
alita_sdk-0.3.
|
332
|
-
alita_sdk-0.3.
|
333
|
-
alita_sdk-0.3.
|
329
|
+
alita_sdk-0.3.171.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
330
|
+
alita_sdk-0.3.171.dist-info/METADATA,sha256=XzQcB4rHIu9pHDX2k-Nj4edZSzgeTFpQA4xyLyfPUVw,18757
|
331
|
+
alita_sdk-0.3.171.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
332
|
+
alita_sdk-0.3.171.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
333
|
+
alita_sdk-0.3.171.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|