alita-sdk 0.3.206__py3-none-any.whl → 0.3.208__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/clients/client.py +369 -6
- alita_sdk/runtime/langchain/langraph_agent.py +6 -1
- alita_sdk/runtime/langchain/store_manager.py +4 -4
- alita_sdk/runtime/toolkits/tools.py +11 -20
- alita_sdk/runtime/utils/streamlit.py +472 -192
- alita_sdk/runtime/utils/toolkit_runtime.py +147 -0
- alita_sdk/runtime/utils/toolkit_utils.py +157 -0
- alita_sdk/tools/ado/test_plan/test_plan_wrapper.py +82 -11
- alita_sdk/tools/ado/wiki/ado_wrapper.py +62 -2
- alita_sdk/tools/chunkers/sematic/markdown_chunker.py +2 -1
- alita_sdk/tools/memory/__init__.py +54 -10
- alita_sdk/tools/sharepoint/api_wrapper.py +13 -4
- {alita_sdk-0.3.206.dist-info → alita_sdk-0.3.208.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.206.dist-info → alita_sdk-0.3.208.dist-info}/RECORD +17 -24
- alita_sdk/community/analysis/__init__.py +0 -0
- alita_sdk/community/analysis/ado_analyse/__init__.py +0 -103
- alita_sdk/community/analysis/ado_analyse/api_wrapper.py +0 -261
- alita_sdk/community/analysis/github_analyse/__init__.py +0 -98
- alita_sdk/community/analysis/github_analyse/api_wrapper.py +0 -166
- alita_sdk/community/analysis/gitlab_analyse/__init__.py +0 -110
- alita_sdk/community/analysis/gitlab_analyse/api_wrapper.py +0 -172
- alita_sdk/community/analysis/jira_analyse/__init__.py +0 -141
- alita_sdk/community/analysis/jira_analyse/api_wrapper.py +0 -252
- {alita_sdk-0.3.206.dist-info → alita_sdk-0.3.208.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.206.dist-info → alita_sdk-0.3.208.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.206.dist-info → alita_sdk-0.3.208.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,8 @@
|
|
1
1
|
import json
|
2
2
|
import logging
|
3
|
-
from typing import Optional, List, Dict, Any
|
3
|
+
from typing import Optional, List, Dict, Any, Generator
|
4
4
|
|
5
|
+
from ..chunkers import markdown_chunker
|
5
6
|
from ..utils.content_parser import parse_file_content
|
6
7
|
from langchain_core.tools import ToolException
|
7
8
|
from office365.runtime.auth.client_credential import ClientCredential
|
@@ -184,11 +185,19 @@ class SharepointApiWrapper(BaseVectorStoreToolApiWrapper):
|
|
184
185
|
vs = self._init_vector_store(collection_suffix, embeddings=embedding)
|
185
186
|
return vs.index_documents(docs, progress_step=progress_step, clean_index=clean_index)
|
186
187
|
|
187
|
-
def _process_document(self, document: Document) -> Document:
|
188
|
-
|
188
|
+
def _process_document(self, document: Document) -> Generator[Document, None, None]:
|
189
|
+
config = {
|
190
|
+
"max_tokens": self.llm.model_config.get('max_tokens', 512),
|
191
|
+
"token_overlap": self.llm.model_config.get('token_overlap',
|
192
|
+
int(self.llm.model_config.get('max_tokens', 512) * 0.05))
|
193
|
+
}
|
194
|
+
chunks = markdown_chunker(file_content_generator=self._generate_file_content(document), config=config)
|
195
|
+
yield from chunks
|
189
196
|
|
197
|
+
def _generate_file_content(self, document: Document) -> Generator[Document, None, None]:
|
198
|
+
page_content = self.read_file(document.metadata['Path'], is_capture_image=True)
|
190
199
|
document.page_content = json.dumps(str(page_content))
|
191
|
-
|
200
|
+
yield document
|
192
201
|
|
193
202
|
def get_available_tools(self):
|
194
203
|
return [
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: alita_sdk
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.208
|
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
|
@@ -1,19 +1,10 @@
|
|
1
1
|
alita_sdk/__init__.py,sha256=fxeNiqiVpIFAJls31Oomifyrtd5gT9iPUTdkWjDOB2Y,656
|
2
2
|
alita_sdk/community/__init__.py,sha256=8N7wWwPhoyOq3p8wlV3-pb3l3nJCR8TUrtV9iIPLU88,2523
|
3
3
|
alita_sdk/community/utils.py,sha256=lvuCJaNqVPHOORJV6kIPcXJcdprVW_TJvERtYAEgpjM,249
|
4
|
-
alita_sdk/community/analysis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
alita_sdk/community/analysis/ado_analyse/__init__.py,sha256=ADjjyV2z7XmQhOv873Mrz_-W9jWxhWpiDJ0nujm0eZs,4232
|
6
|
-
alita_sdk/community/analysis/ado_analyse/api_wrapper.py,sha256=evWq2GS4SxfOc4bryhhG21QTVHII65_4CmqAJN2iGd0,8721
|
7
|
-
alita_sdk/community/analysis/github_analyse/__init__.py,sha256=QmHgXYaUSBmyFNUVV89OMuhoTe0E6Q-7ftG5s8N3j_w,3682
|
8
|
-
alita_sdk/community/analysis/github_analyse/api_wrapper.py,sha256=w_umxdeSDRuZvckQIAmihty4YL7Be3K28S1wV5hhgRY,6872
|
9
|
-
alita_sdk/community/analysis/gitlab_analyse/__init__.py,sha256=6PgqvD0cX5evpT_vgGv48sXMHCJYn_MPqaOAUxhxS2g,4243
|
10
|
-
alita_sdk/community/analysis/gitlab_analyse/api_wrapper.py,sha256=xGX3io2rT_DJl1PMiP9d6lsw6xhr9L2h910raGk1s4w,6373
|
11
|
-
alita_sdk/community/analysis/jira_analyse/__init__.py,sha256=oyAVkjq4KZmSA1RiAijeo4oh9hNDgFmOCkDilUJ8DWs,6023
|
12
|
-
alita_sdk/community/analysis/jira_analyse/api_wrapper.py,sha256=Ui1GBWizIFGFOi98BtkPWxVITQbrv7xFZxxYjAFq66Q,9701
|
13
4
|
alita_sdk/runtime/__init__.py,sha256=4W0UF-nl3QF2bvET5lnah4o24CoTwSoKXhuN0YnwvEE,828
|
14
5
|
alita_sdk/runtime/clients/__init__.py,sha256=BdehU5GBztN1Qi1Wul0cqlU46FxUfMnI6Vq2Zd_oq1M,296
|
15
6
|
alita_sdk/runtime/clients/artifact.py,sha256=4N2t5x3GibyXLq3Fvrv2o_VA7Z000yNfc-UN4eGsHZg,2679
|
16
|
-
alita_sdk/runtime/clients/client.py,sha256=
|
7
|
+
alita_sdk/runtime/clients/client.py,sha256=xTmrgKWVMfLPZG_BKkMheTMlJUK-a7URCIk6YiFyxVY,41868
|
17
8
|
alita_sdk/runtime/clients/datasource.py,sha256=HAZovoQN9jBg0_-lIlGBQzb4FJdczPhkHehAiVG3Wx0,1020
|
18
9
|
alita_sdk/runtime/clients/prompt.py,sha256=li1RG9eBwgNK_Qf0qUaZ8QNTmsncFrAL2pv3kbxZRZg,1447
|
19
10
|
alita_sdk/runtime/langchain/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -21,10 +12,10 @@ alita_sdk/runtime/langchain/assistant.py,sha256=Bn9vUyZlFAP-D9Bh3zc2G1ZQkh5rr2c2
|
|
21
12
|
alita_sdk/runtime/langchain/chat_message_template.py,sha256=kPz8W2BG6IMyITFDA5oeb5BxVRkHEVZhuiGl4MBZKdc,2176
|
22
13
|
alita_sdk/runtime/langchain/constants.py,sha256=eHVJ_beJNTf1WJo4yq7KMK64fxsRvs3lKc34QCXSbpk,3319
|
23
14
|
alita_sdk/runtime/langchain/indexer.py,sha256=0ENHy5EOhThnAiYFc7QAsaTNp9rr8hDV_hTK8ahbatk,37592
|
24
|
-
alita_sdk/runtime/langchain/langraph_agent.py,sha256=
|
15
|
+
alita_sdk/runtime/langchain/langraph_agent.py,sha256=QwD9NZ74Hp4rZvP7nirzOmjFJhfJ7eiuAvsq7aAW4Uw,43563
|
25
16
|
alita_sdk/runtime/langchain/mixedAgentParser.py,sha256=M256lvtsL3YtYflBCEp-rWKrKtcY1dJIyRGVv7KW9ME,2611
|
26
17
|
alita_sdk/runtime/langchain/mixedAgentRenderes.py,sha256=asBtKqm88QhZRILditjYICwFVKF5KfO38hu2O-WrSWE,5964
|
27
|
-
alita_sdk/runtime/langchain/store_manager.py,sha256=
|
18
|
+
alita_sdk/runtime/langchain/store_manager.py,sha256=i8Fl11IXJhrBXq1F1ukEVln57B1IBe-tqSUvfUmBV4A,2218
|
28
19
|
alita_sdk/runtime/langchain/utils.py,sha256=Npferkn10dvdksnKzLJLBI5bNGQyVWTBwqp3vQtUqmY,6631
|
29
20
|
alita_sdk/runtime/langchain/agents/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
30
21
|
alita_sdk/runtime/langchain/agents/xml_chat.py,sha256=Mx7PK5T97_GrFCwHHZ3JZP42S7MwtUzV0W-_8j6Amt8,6212
|
@@ -70,7 +61,7 @@ alita_sdk/runtime/toolkits/artifact.py,sha256=7fTr9VpGd2zwCB3EwW4aqWa5jVKRTunqV3
|
|
70
61
|
alita_sdk/runtime/toolkits/datasource.py,sha256=qk78OdPoReYPCWwahfkKLbKc4pfsu-061oXRryFLP6I,2498
|
71
62
|
alita_sdk/runtime/toolkits/prompt.py,sha256=WIpTkkVYWqIqOWR_LlSWz3ug8uO9tm5jJ7aZYdiGRn0,1192
|
72
63
|
alita_sdk/runtime/toolkits/subgraph.py,sha256=ZYqI4yVLbEPAjCR8dpXbjbL2ipX598Hk3fL6AgaqFD4,1758
|
73
|
-
alita_sdk/runtime/toolkits/tools.py,sha256=
|
64
|
+
alita_sdk/runtime/toolkits/tools.py,sha256=eYAOzxiCcHzwssPTvgS_qDLNbhBu9BHsyqQWjO41_LA,7587
|
74
65
|
alita_sdk/runtime/toolkits/vectorstore.py,sha256=BGppQADa1ZiLO17fC0uCACTTEvPHlodEDYEzUcBRbAA,2901
|
75
66
|
alita_sdk/runtime/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
76
67
|
alita_sdk/runtime/tools/agent.py,sha256=m98QxOHwnCRTT9j18Olbb5UPS8-ZGeQaGiUyZJSyFck,3162
|
@@ -95,7 +86,9 @@ alita_sdk/runtime/utils/constants.py,sha256=Xntx1b_uxUzT4clwqHA_U6K8y5bBqf_4lSQw
|
|
95
86
|
alita_sdk/runtime/utils/evaluate.py,sha256=iM1P8gzBLHTuSCe85_Ng_h30m52hFuGuhNXJ7kB1tgI,1872
|
96
87
|
alita_sdk/runtime/utils/logging.py,sha256=svPyiW8ztDfhqHFITv5FBCj8UhLxz6hWcqGIY6wpJJE,3331
|
97
88
|
alita_sdk/runtime/utils/save_dataframe.py,sha256=i-E1wp-t4wb17Zq3nA3xYwgSILjoXNizaQAA9opWvxY,1576
|
98
|
-
alita_sdk/runtime/utils/streamlit.py,sha256=
|
89
|
+
alita_sdk/runtime/utils/streamlit.py,sha256=ZgHpibL2ARHt6qrWj5JhK6HNZv2UjxQ04qTk6gmz1Eo,104928
|
90
|
+
alita_sdk/runtime/utils/toolkit_runtime.py,sha256=MU63Fpxj0b5_r1IUUc0Q3-PN9VwL7rUxp2MRR4tmYR8,5136
|
91
|
+
alita_sdk/runtime/utils/toolkit_utils.py,sha256=I9QFqnaqfVgN26LUr6s3XlBlG6y0CoHURnCzG7XcwVs,5311
|
99
92
|
alita_sdk/runtime/utils/utils.py,sha256=FoHtcQZ6JFFU8a1FG_V-W22v-bis0XsIc_XQmjH6Mzg,461
|
100
93
|
alita_sdk/tools/__init__.py,sha256=kTw83lzfWf4HWlvGzfwwHhQlRhpPAbfCAhKkMWCzLFo,10324
|
101
94
|
alita_sdk/tools/elitea_base.py,sha256=WjZYjBb1K5HySsbmkbSXUa9_7HYR3xvTHaMC6XCb_Z4,23391
|
@@ -104,9 +97,9 @@ alita_sdk/tools/ado/utils.py,sha256=PTCludvaQmPLakF2EbCGy66Mro4-rjDtavVP-xcB2Wc,
|
|
104
97
|
alita_sdk/tools/ado/repos/__init__.py,sha256=guYY95Gtyb0S4Jj0V1qO0x2jlRoH0H1cKjHXNwmShow,6388
|
105
98
|
alita_sdk/tools/ado/repos/repos_wrapper.py,sha256=spBq-0QdRRNctz_Qbl4IIDpnjitzQLhvJzRIW_6jKNA,48583
|
106
99
|
alita_sdk/tools/ado/test_plan/__init__.py,sha256=bVywTYTvdm1rUeP2krVVMRN-xDCY--ze7NFdTxJP9ow,4708
|
107
|
-
alita_sdk/tools/ado/test_plan/test_plan_wrapper.py,sha256=
|
100
|
+
alita_sdk/tools/ado/test_plan/test_plan_wrapper.py,sha256=p1S5vQJSSfXXXZ3MH8qaqKZiH9MeT_pCHGU56Xn5UdI,21639
|
108
101
|
alita_sdk/tools/ado/wiki/__init__.py,sha256=WCIKOisU2h3E4SNDvGfWCMZ3nRMxfH_ZhIffmSHH3XI,4576
|
109
|
-
alita_sdk/tools/ado/wiki/ado_wrapper.py,sha256=
|
102
|
+
alita_sdk/tools/ado/wiki/ado_wrapper.py,sha256=2mIuvYbVnX1eYSBzr4PQTrOZa_s0btONCT-e8MWNUbU,15482
|
110
103
|
alita_sdk/tools/ado/work_item/__init__.py,sha256=k6gZ6pEE7gvNWvCDoDV05jltzbqxC_NPm06CEr5Wwcs,4726
|
111
104
|
alita_sdk/tools/ado/work_item/ado_wrapper.py,sha256=aLB-aSNQST0FCwP7I01OXanCpZHKVarZZB1u9j2H1LA,26253
|
112
105
|
alita_sdk/tools/advanced_jira_mining/__init__.py,sha256=pUTzECqGvYaR5qWY3JPUhrImrZgc7pCXuqSe5eWIE80,4604
|
@@ -171,7 +164,7 @@ alita_sdk/tools/chunkers/code/treesitter/treesitter_rs.py,sha256=LgKyNffBy30gIr8
|
|
171
164
|
alita_sdk/tools/chunkers/code/treesitter/treesitter_ts.py,sha256=Qs1a_BBN296iZc5hh8UNF9sc0G0-A_XZVhP3Na1ZNDg,387
|
172
165
|
alita_sdk/tools/chunkers/sematic/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
173
166
|
alita_sdk/tools/chunkers/sematic/base.py,sha256=bRHpCFbOy-KPe4HBGpegrvIhvOsd7sDRfmb06T8tSuU,349
|
174
|
-
alita_sdk/tools/chunkers/sematic/markdown_chunker.py,sha256=
|
167
|
+
alita_sdk/tools/chunkers/sematic/markdown_chunker.py,sha256=NZCZi0Xzi58Bm7-9LzwGoAhdNZhvUERb_sK1bNQpqCQ,2574
|
175
168
|
alita_sdk/tools/chunkers/sematic/proposal_chunker.py,sha256=t8JjX9TH6yHXXaemiDK1E6000tlES2Kl8XfyezmlIoo,5116
|
176
169
|
alita_sdk/tools/chunkers/sematic/statistical_chunker.py,sha256=VDQcMC-ky72GqdWJiHMmcRmfJTTU5XglBF1IWg2Qews,13403
|
177
170
|
alita_sdk/tools/cloud/__init__.py,sha256=ekqANTJAyuURqpjNTn6MmSn2q6qEKwENxEXBUFGkkck,512
|
@@ -232,7 +225,7 @@ alita_sdk/tools/llm/llm_utils.py,sha256=6P2j-42JGbyqpO8lNRuEP8GEhja-LC9E-98jTelK
|
|
232
225
|
alita_sdk/tools/localgit/__init__.py,sha256=NScO0Eu-wl-rc63jjD5Qv1RXXB1qukSIJXx-yS_JQLI,2529
|
233
226
|
alita_sdk/tools/localgit/local_git.py,sha256=gsAftNcK7nMCd8VsIkwDLs2SoG0MgpYdkQG5tmoynkA,18074
|
234
227
|
alita_sdk/tools/localgit/tool.py,sha256=It_B24rMvFPurB355Oy5IShg2BsZTASsEoSS8hu2SXw,998
|
235
|
-
alita_sdk/tools/memory/__init__.py,sha256=
|
228
|
+
alita_sdk/tools/memory/__init__.py,sha256=Z3txBO3BMEk539_uBhGQaT57JWBVImbmZ8oPcLMj9ik,3900
|
236
229
|
alita_sdk/tools/ocr/__init__.py,sha256=pvslKVXyJmK0q23FFDNieuc7RBIuzNXTjTNj-GqhGb0,3335
|
237
230
|
alita_sdk/tools/ocr/api_wrapper.py,sha256=08UF8wj1sR8DcW0z16pw19bgLatLkBF8dySW-Ds8iRk,29649
|
238
231
|
alita_sdk/tools/ocr/text_detection.py,sha256=1DBxt54r3_HdEi93QynSIVta3rH3UpIvy799TPtDTtk,23825
|
@@ -276,7 +269,7 @@ alita_sdk/tools/servicenow/__init__.py,sha256=VHH3qpUbEJ0tdtrIiWakohCmbifUOPgCVX
|
|
276
269
|
alita_sdk/tools/servicenow/api_wrapper.py,sha256=WpH-bBLGFdhehs4g-K-WAkNuaD1CSrwsDpdgB3RG53s,6120
|
277
270
|
alita_sdk/tools/servicenow/servicenow_client.py,sha256=Rdqfu-ll-qbnclMzChLZBsfXRDzgoX_FdeI2WLApWxc,3269
|
278
271
|
alita_sdk/tools/sharepoint/__init__.py,sha256=CiaOmzPl-9WNWZU9AtP-Y-Mg_uBnxeKFTnUjJ5aQbmA,3036
|
279
|
-
alita_sdk/tools/sharepoint/api_wrapper.py,sha256=
|
272
|
+
alita_sdk/tools/sharepoint/api_wrapper.py,sha256=o9z8-_d3F4qfgvonJIed9obVPvTYC06zmkwk2XZ1UfI,10600
|
280
273
|
alita_sdk/tools/sharepoint/authorization_helper.py,sha256=n-nL5dlBoLMK70nHu7P2RYCb8C6c9HMA_gEaw8LxuhE,2007
|
281
274
|
alita_sdk/tools/sharepoint/utils.py,sha256=fZ1YzAu5CTjKSZeslowpOPH974902S8vCp1Wu7L44LM,446
|
282
275
|
alita_sdk/tools/slack/__init__.py,sha256=mbP2JiHybGSAH0ay8pxvPCqeU2eb9CK_NaCKG1uhPE4,3894
|
@@ -306,8 +299,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=VDsSFUTnBne1mFNssX2eLFxThXAhX
|
|
306
299
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=0AI_j27xVO5Gk5HQMFrqPTd4uvuVTpiZUicBrdfEpKg,2796
|
307
300
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
|
308
301
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
|
309
|
-
alita_sdk-0.3.
|
310
|
-
alita_sdk-0.3.
|
311
|
-
alita_sdk-0.3.
|
312
|
-
alita_sdk-0.3.
|
313
|
-
alita_sdk-0.3.
|
302
|
+
alita_sdk-0.3.208.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
303
|
+
alita_sdk-0.3.208.dist-info/METADATA,sha256=uohMy95DqgX2lMhZhmDs2u0PahKqvVC1p93Wu71kwhA,18917
|
304
|
+
alita_sdk-0.3.208.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
305
|
+
alita_sdk-0.3.208.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
306
|
+
alita_sdk-0.3.208.dist-info/RECORD,,
|
File without changes
|
@@ -1,103 +0,0 @@
|
|
1
|
-
from typing import List, Optional, Literal
|
2
|
-
from elitea_analyse.ado.azure_search import AzureSearch
|
3
|
-
from pydantic import SecretStr, create_model, BaseModel, ConfigDict, Field
|
4
|
-
|
5
|
-
from langchain_core.tools import BaseTool, BaseToolkit
|
6
|
-
|
7
|
-
from alita_sdk.tools.utils import get_max_toolkit_length
|
8
|
-
from alita_sdk.tools.base.tool import BaseAction
|
9
|
-
from alita_sdk.runtime.clients.client import AlitaClient # Add this import at the top of the file
|
10
|
-
from alita_sdk.runtime.tools.artifact import ArtifactWrapper
|
11
|
-
from .api_wrapper import AdoAnalyseWrapper
|
12
|
-
|
13
|
-
from ...utils import check_schema
|
14
|
-
|
15
|
-
|
16
|
-
name = "Analyse_Ado"
|
17
|
-
|
18
|
-
|
19
|
-
class AnalyseAdo(BaseToolkit):
|
20
|
-
tools: List[BaseTool] = []
|
21
|
-
toolkit_max_length: int = 0
|
22
|
-
|
23
|
-
@staticmethod
|
24
|
-
def toolkit_config_schema() -> type[BaseModel]:
|
25
|
-
selected_tools = {
|
26
|
-
x["name"]: x["args_schema"].schema()
|
27
|
-
for x in AdoAnalyseWrapper.model_construct().get_available_tools()
|
28
|
-
}
|
29
|
-
AnalyseAdo.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
30
|
-
|
31
|
-
return create_model(
|
32
|
-
"analyse_ado",
|
33
|
-
organization=(str, Field(description="Azure DevOps organization name",
|
34
|
-
json_schema_extra={"toolkit_name": True, "max_toolkit_length": AnalyseAdo.toolkit_max_length})),
|
35
|
-
username=(str, Field(description="Azure DevOps username (e.g., 'john.doe@domain.com')")),
|
36
|
-
token=(SecretStr, Field(description="Azure DevOps Access Token", json_schema_extra={"secret": True})),
|
37
|
-
project_keys=(Optional[str], Field(description="Azure DevOps project keys separated by comma", default=None)),
|
38
|
-
default_branch_name=(Optional[str], Field(description="Default branch name", default="main")),
|
39
|
-
area=(Optional[str], Field(description="Area path filter", default="")),
|
40
|
-
artifact_bucket_path=(Optional[str], Field(description="Artifact Bucket Path", default="analyse-ado")),
|
41
|
-
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={"args_schemas": selected_tools})),
|
42
|
-
__config__=ConfigDict(json_schema_extra={"metadata": {
|
43
|
-
"label": "Analyse_Ado",
|
44
|
-
"icon_url": "ado-icon.svg", # ???
|
45
|
-
"hidden": True,
|
46
|
-
"sections": {
|
47
|
-
"auth": {
|
48
|
-
"required": True,
|
49
|
-
"subsections": [{"name": "Token", "fields": ["token"]}],
|
50
|
-
}
|
51
|
-
},
|
52
|
-
}
|
53
|
-
})
|
54
|
-
)
|
55
|
-
|
56
|
-
@classmethod
|
57
|
-
def get_toolkit(cls, client: "AlitaClient", selected_tools: list[str], **kwargs):
|
58
|
-
|
59
|
-
bucket_path = kwargs.get("artifact_bucket_path") or "analyse-ado"
|
60
|
-
artifact_wrapper = ArtifactWrapper(client=client, bucket=bucket_path)
|
61
|
-
check_schema(artifact_wrapper)
|
62
|
-
|
63
|
-
project_keys = kwargs.get("project_keys") or ""
|
64
|
-
area = kwargs.get("area", "")
|
65
|
-
|
66
|
-
organization = kwargs.get("organization")
|
67
|
-
username = kwargs.get("username")
|
68
|
-
token = kwargs.get("token")
|
69
|
-
|
70
|
-
if not organization or not username or not token:
|
71
|
-
raise ValueError("Organization, username, and token must be provided.")
|
72
|
-
|
73
|
-
ado_search = AzureSearch(organization=organization, user=username, token=token)
|
74
|
-
|
75
|
-
ado_analyse_wrapper = AdoAnalyseWrapper(
|
76
|
-
artifacts_wrapper=artifact_wrapper,
|
77
|
-
project_keys=project_keys,
|
78
|
-
default_branch_name=kwargs.get("default_branch_name", "main"),
|
79
|
-
area=area,
|
80
|
-
ado_search=ado_search,
|
81
|
-
)
|
82
|
-
|
83
|
-
selected_tools = selected_tools or []
|
84
|
-
available_tools = ado_analyse_wrapper.get_available_tools()
|
85
|
-
|
86
|
-
tools = []
|
87
|
-
for tool in available_tools:
|
88
|
-
if selected_tools:
|
89
|
-
if tool["name"] not in selected_tools:
|
90
|
-
continue
|
91
|
-
tools.append(
|
92
|
-
BaseAction(
|
93
|
-
api_wrapper=ado_analyse_wrapper,
|
94
|
-
name=tool["name"],
|
95
|
-
description=tool["description"],
|
96
|
-
args_schema=tool["args_schema"],
|
97
|
-
)
|
98
|
-
)
|
99
|
-
|
100
|
-
return cls(tools=tools)
|
101
|
-
|
102
|
-
def get_tools(self):
|
103
|
-
return self.tools
|
@@ -1,261 +0,0 @@
|
|
1
|
-
import logging
|
2
|
-
|
3
|
-
from typing import Optional, Dict, Any
|
4
|
-
from langchain_core.callbacks import dispatch_custom_event
|
5
|
-
from pydantic import BaseModel, Field
|
6
|
-
|
7
|
-
from elitea_analyse.utils.constants import OUTPUT_WORK_ITEMS_FILE
|
8
|
-
from elitea_analyse.ado.azure_search import AzureSearch
|
9
|
-
from elitea_analyse.ado.main import (
|
10
|
-
OUTPUT_WORK_ITEMS,
|
11
|
-
get_work_items_several_projects,
|
12
|
-
get_commits_several_projects,
|
13
|
-
get_merge_requests_several_projects,
|
14
|
-
get_pipelines_runs_several_projects,
|
15
|
-
)
|
16
|
-
|
17
|
-
|
18
|
-
from alita_sdk.tools.elitea_base import BaseToolApiWrapper
|
19
|
-
|
20
|
-
from alita_sdk.runtime.utils.save_dataframe import save_dataframe_to_artifact
|
21
|
-
from alita_sdk.runtime.tools.artifact import ArtifactWrapper
|
22
|
-
from alita_sdk.runtime.utils.logging import with_streamlit_logs
|
23
|
-
|
24
|
-
|
25
|
-
logger = logging.getLogger(__name__)
|
26
|
-
|
27
|
-
class NoInputArgs(BaseModel):
|
28
|
-
pass
|
29
|
-
|
30
|
-
class GetAdoWorkItemsArgs(BaseModel):
|
31
|
-
resolved_after: str = Field(description="Resolveed after date (i.e. 2023-01-01)")
|
32
|
-
updated_after: str = Field(description="Updated after date (i.e. 2023-01-01)")
|
33
|
-
created_after: str = Field(description="Created after date (i.e. 2023-01-01)")
|
34
|
-
area: Optional[str] = Field(description="Area path filter.", default="")
|
35
|
-
project_keys: Optional[str] = Field(
|
36
|
-
description="One or more projects keys separated with comma.", default=""
|
37
|
-
)
|
38
|
-
|
39
|
-
|
40
|
-
class AdoCommitsArgs(BaseModel):
|
41
|
-
project_keys: Optional[str] = Field(
|
42
|
-
description="One or more projects keys separated with comma.", default=""
|
43
|
-
)
|
44
|
-
since_date: str = Field(description="Get commits after this date 'YYYY-MM-DD'")
|
45
|
-
|
46
|
-
|
47
|
-
class AdoPipelinesArgs(BaseModel):
|
48
|
-
project_keys: Optional[str] = Field(
|
49
|
-
description="One or more projects keys separated with comma.", default=""
|
50
|
-
)
|
51
|
-
|
52
|
-
|
53
|
-
class AdoAnalyseWrapper(BaseToolApiWrapper):
|
54
|
-
artifacts_wrapper: ArtifactWrapper
|
55
|
-
project_keys: str # Comma-separated list of Azure DevOps project names
|
56
|
-
default_branch_name: str = "main"
|
57
|
-
area: str = ""
|
58
|
-
ado_search: AzureSearch # Azure DevOps search client
|
59
|
-
|
60
|
-
class Config:
|
61
|
-
arbitrary_types_allowed = True
|
62
|
-
|
63
|
-
def get_projects_list(self):
|
64
|
-
"""
|
65
|
-
Get all projects in the organization that the authenticated user has access to.
|
66
|
-
Details on a page: https://docs.microsoft.com/en-us/rest/api/azure/devops/core/projects/list
|
67
|
-
"""
|
68
|
-
result = self.ado_search.get_projects_list()
|
69
|
-
|
70
|
-
save_dataframe_to_artifact(
|
71
|
-
self.artifacts_wrapper,
|
72
|
-
result,
|
73
|
-
"projects_info.csv",
|
74
|
-
csv_options={"index": False},
|
75
|
-
)
|
76
|
-
|
77
|
-
return (
|
78
|
-
f"You have access to {len(result)} project. "
|
79
|
-
f"Data has been downloaded to the bucket as 'projects_info.csv'."
|
80
|
-
)
|
81
|
-
|
82
|
-
@with_streamlit_logs(tool_name="get_work_items")
|
83
|
-
def get_work_items(
|
84
|
-
self,
|
85
|
-
resolved_after: str,
|
86
|
-
updated_after: str,
|
87
|
-
created_after: str,
|
88
|
-
area: str = "",
|
89
|
-
project_keys: Optional[str] = None,
|
90
|
-
) -> str:
|
91
|
-
"""
|
92
|
-
Get work items from multiple Azure DevOps projects.
|
93
|
-
|
94
|
-
project_keys: str
|
95
|
-
Comma-separated project names.
|
96
|
-
resolved_after: str
|
97
|
-
Date filter for resolved items 'YYYY-MM-DD'.
|
98
|
-
updated_after: str
|
99
|
-
Date filter for updated items 'YYYY-MM-DD'.
|
100
|
-
created_after: str
|
101
|
-
Date filter for created items 'YYYY-MM-DD'.
|
102
|
-
area: str
|
103
|
-
Area path filter (optional).
|
104
|
-
"""
|
105
|
-
project_keys = project_keys or self.project_keys
|
106
|
-
area = area or self.area
|
107
|
-
|
108
|
-
df_work_items = get_work_items_several_projects(
|
109
|
-
project_keys,
|
110
|
-
resolved_after,
|
111
|
-
updated_after,
|
112
|
-
created_after,
|
113
|
-
area=area,
|
114
|
-
ado_search=self.ado_search,
|
115
|
-
)
|
116
|
-
|
117
|
-
save_dataframe_to_artifact(
|
118
|
-
self.artifacts_wrapper,
|
119
|
-
df_work_items,
|
120
|
-
f"{OUTPUT_WORK_ITEMS_FILE}{project_keys}.csv",
|
121
|
-
csv_options={"index_label": "id"},
|
122
|
-
)
|
123
|
-
|
124
|
-
return (
|
125
|
-
f"Work items for {project_keys} have been successfully retrieved "
|
126
|
-
f"and saved to the bucket as '{OUTPUT_WORK_ITEMS}{project_keys}.csv'."
|
127
|
-
)
|
128
|
-
|
129
|
-
async def get_commits(
|
130
|
-
self,
|
131
|
-
since_date: str,
|
132
|
-
project_keys: Optional[str] = None,
|
133
|
-
new_version: bool = True,
|
134
|
-
with_commit_size: bool = True,
|
135
|
-
) -> str:
|
136
|
-
"""
|
137
|
-
Get commits from multiple Azure DevOps projects.
|
138
|
-
|
139
|
-
since_date: str
|
140
|
-
Get commits after this date 'YYYY-MM-DD'.
|
141
|
-
project_keys: str
|
142
|
-
Comma-separated project names.
|
143
|
-
new_version: bool
|
144
|
-
Use new API version.
|
145
|
-
with_commit_size: bool
|
146
|
-
Include commit size info.
|
147
|
-
"""
|
148
|
-
project_keys = project_keys or self.project_keys
|
149
|
-
|
150
|
-
# Await the coroutine to get commits
|
151
|
-
df_commits = await get_commits_several_projects(
|
152
|
-
project_keys,
|
153
|
-
since_date,
|
154
|
-
new_version=new_version,
|
155
|
-
with_commit_size=with_commit_size,
|
156
|
-
ado_search=self.ado_search,
|
157
|
-
)
|
158
|
-
|
159
|
-
save_dataframe_to_artifact(
|
160
|
-
self.artifacts_wrapper,
|
161
|
-
df_commits,
|
162
|
-
f"commits_details_{project_keys}.csv",
|
163
|
-
csv_options={"index_label": "id"},
|
164
|
-
)
|
165
|
-
|
166
|
-
return (
|
167
|
-
f"Commits for {project_keys} have been successfully retrieved "
|
168
|
-
f"and saved to the bucket as 'commits_details_{project_keys}.csv'."
|
169
|
-
)
|
170
|
-
|
171
|
-
def get_merge_requests(
|
172
|
-
self, since_date: str, project_keys: Optional[str] = None
|
173
|
-
) -> str:
|
174
|
-
"""
|
175
|
-
Get pull requests from multiple Azure DevOps projects.
|
176
|
-
|
177
|
-
project_keys: str
|
178
|
-
Comma-separated project names.
|
179
|
-
since_date: str
|
180
|
-
Get PRs after this date 'YYYY-MM-DD'.
|
181
|
-
"""
|
182
|
-
project_keys = project_keys or self.project_keys
|
183
|
-
|
184
|
-
df_prs = get_merge_requests_several_projects(
|
185
|
-
project_keys, since_date, ado_search=self.ado_search
|
186
|
-
)
|
187
|
-
|
188
|
-
save_dataframe_to_artifact(
|
189
|
-
self.artifacts_wrapper,
|
190
|
-
df_prs,
|
191
|
-
f"merge_requests_details_{project_keys}.csv",
|
192
|
-
csv_options={"index": False},
|
193
|
-
)
|
194
|
-
|
195
|
-
return (
|
196
|
-
f"Pull requests for {project_keys} have been successfully retrieved "
|
197
|
-
f"and saved to the bucket as 'merge_requests_details_{project_keys}.csv'."
|
198
|
-
)
|
199
|
-
|
200
|
-
def get_pipelines_runs(
|
201
|
-
self,
|
202
|
-
project_keys: Optional[str] = None,
|
203
|
-
) -> str:
|
204
|
-
"""
|
205
|
-
Get pipeline runs from multiple Azure DevOps projects.
|
206
|
-
|
207
|
-
project_keys: str
|
208
|
-
Comma-separated project names.
|
209
|
-
"""
|
210
|
-
project_keys = project_keys or self.project_keys
|
211
|
-
pipelines_df = get_pipelines_runs_several_projects(project_keys, ado_search=self.ado_search)
|
212
|
-
|
213
|
-
save_dataframe_to_artifact(
|
214
|
-
self.artifacts_wrapper, pipelines_df, f"pipelines_runs_{project_keys}.csv", csv_options={"index": False}
|
215
|
-
)
|
216
|
-
|
217
|
-
return (
|
218
|
-
f"Pipeline runs for {project_keys} have been successfully retrieved "
|
219
|
-
f"and saved to the bucket as 'pipelines_runs_{project_keys}.csv'."
|
220
|
-
)
|
221
|
-
|
222
|
-
def get_available_tools(self) -> list[Dict[str, Any]]:
|
223
|
-
"""Get a list of available tools."""
|
224
|
-
return [
|
225
|
-
{
|
226
|
-
"name": "get_projects_list",
|
227
|
-
"description": self.get_projects_list.__doc__,
|
228
|
-
"ref": self.get_projects_list,
|
229
|
-
"args_schema": NoInputArgs,
|
230
|
-
},
|
231
|
-
{
|
232
|
-
"name": "get_work_items",
|
233
|
-
"description": self.get_work_items.__doc__,
|
234
|
-
"ref": self.get_work_items,
|
235
|
-
"args_schema": GetAdoWorkItemsArgs,
|
236
|
-
},
|
237
|
-
{
|
238
|
-
"name": "get_commits",
|
239
|
-
"description": self.get_commits.__doc__,
|
240
|
-
"ref": self.get_commits,
|
241
|
-
"args_schema": AdoCommitsArgs,
|
242
|
-
},
|
243
|
-
{
|
244
|
-
"name": "get_merge_requests",
|
245
|
-
"description": self.get_merge_requests.__doc__,
|
246
|
-
"ref": self.get_merge_requests,
|
247
|
-
"args_schema": AdoCommitsArgs,
|
248
|
-
},
|
249
|
-
{
|
250
|
-
"name": "get_pipelines_runs",
|
251
|
-
"description": self.get_pipelines_runs.__doc__,
|
252
|
-
"ref": self.get_pipelines_runs,
|
253
|
-
"args_schema": AdoPipelinesArgs,
|
254
|
-
},
|
255
|
-
]
|
256
|
-
|
257
|
-
def run(self, mode: str, *args: Any, **kwargs: Any):
|
258
|
-
for tool in self.get_available_tools():
|
259
|
-
if tool["name"] == mode:
|
260
|
-
return tool["ref"](*args, **kwargs)
|
261
|
-
raise ValueError(f"Unknown mode: {mode}")
|
@@ -1,98 +0,0 @@
|
|
1
|
-
from typing import List, Optional, Literal
|
2
|
-
from pydantic import SecretStr, create_model, BaseModel, ConfigDict, Field
|
3
|
-
|
4
|
-
from langchain_core.tools import BaseTool, BaseToolkit
|
5
|
-
|
6
|
-
from elitea_analyse.github.github_org import GitHubGetOrgLvl
|
7
|
-
from alita_sdk.runtime.clients.client import AlitaClient
|
8
|
-
from alita_sdk.tools.utils import get_max_toolkit_length
|
9
|
-
from alita_sdk.tools.base.tool import BaseAction
|
10
|
-
|
11
|
-
from alita_sdk.runtime.tools.artifact import ArtifactWrapper
|
12
|
-
from .api_wrapper import GitHubAnalyseWrapper
|
13
|
-
|
14
|
-
from ...utils import check_schema
|
15
|
-
|
16
|
-
|
17
|
-
name = "Analyse_Github"
|
18
|
-
|
19
|
-
|
20
|
-
class AnalyseGithub(BaseToolkit):
|
21
|
-
tools: List[BaseTool] = []
|
22
|
-
toolkit_max_length: int = 0
|
23
|
-
|
24
|
-
@staticmethod
|
25
|
-
def toolkit_config_schema() -> type[BaseModel]:
|
26
|
-
selected_tools = {
|
27
|
-
x["name"]: x["args_schema"].schema()
|
28
|
-
for x in GitHubAnalyseWrapper.model_construct().get_available_tools()
|
29
|
-
}
|
30
|
-
AnalyseGithub.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
31
|
-
|
32
|
-
return create_model(
|
33
|
-
"analyse_github",
|
34
|
-
owner=(str, Field(description="GitHub owner name",
|
35
|
-
json_schema_extra={"toolkit_name": True, "max_toolkit_length": AnalyseGithub.toolkit_max_length})),
|
36
|
-
token=(SecretStr, Field(description="Github Access Token", json_schema_extra={"secret": True})),
|
37
|
-
repos=(Optional[str],
|
38
|
-
Field(description="Comma-separated list of GitHub repository names e.g. 'repo1,repo2'", default=None)),
|
39
|
-
artifact_bucket_path=(Optional[str],
|
40
|
-
Field(description="Artifact Bucket Path", default="analyse-github")),
|
41
|
-
selected_tools=(
|
42
|
-
List[Literal[tuple(selected_tools)]], Field(default=[],
|
43
|
-
json_schema_extra={"args_schemas": selected_tools})
|
44
|
-
),
|
45
|
-
__config__=ConfigDict(json_schema_extra={"metadata": {
|
46
|
-
"label": "Analyse_Github",
|
47
|
-
"icon_url": None, # ?? is exists
|
48
|
-
"hidden": True,
|
49
|
-
"sections": {
|
50
|
-
"auth": {
|
51
|
-
"required": True,
|
52
|
-
"subsections": [{"name": "Token", "fields": ["token"]}],
|
53
|
-
}
|
54
|
-
},
|
55
|
-
}
|
56
|
-
})
|
57
|
-
)
|
58
|
-
|
59
|
-
@classmethod
|
60
|
-
def get_toolkit(cls, client: "AlitaClient", selected_tools: list[str], **kwargs):
|
61
|
-
bucket_path = kwargs.get("artifact_bucket_path") or "analyse-github"
|
62
|
-
artifact_wrapper = ArtifactWrapper(client=client, bucket=bucket_path)
|
63
|
-
check_schema(artifact_wrapper)
|
64
|
-
|
65
|
-
owner = kwargs.get("owner")
|
66
|
-
token = kwargs.get("token")
|
67
|
-
|
68
|
-
if not owner or not token:
|
69
|
-
raise ValueError("GitHub owner and token must be provided.")
|
70
|
-
|
71
|
-
git = GitHubGetOrgLvl(owner=owner, token=token)
|
72
|
-
|
73
|
-
github_analyse_wrapper = GitHubAnalyseWrapper(
|
74
|
-
artifacts_wrapper=artifact_wrapper,
|
75
|
-
repos=kwargs.get("repos") or "",
|
76
|
-
git=git
|
77
|
-
)
|
78
|
-
|
79
|
-
selected_tools = selected_tools or []
|
80
|
-
available_tools = github_analyse_wrapper.get_available_tools()
|
81
|
-
|
82
|
-
tools = []
|
83
|
-
for tool in available_tools:
|
84
|
-
if selected_tools and tool["name"] not in selected_tools:
|
85
|
-
continue
|
86
|
-
tools.append(
|
87
|
-
BaseAction(
|
88
|
-
api_wrapper=github_analyse_wrapper,
|
89
|
-
name=tool["name"],
|
90
|
-
description=tool["description"],
|
91
|
-
args_schema=tool["args_schema"],
|
92
|
-
)
|
93
|
-
)
|
94
|
-
|
95
|
-
return cls(tools=tools)
|
96
|
-
|
97
|
-
def get_tools(self):
|
98
|
-
return self.tools
|