alita-sdk 0.3.351__py3-none-any.whl → 0.3.353__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/langchain/document_loaders/constants.py +39 -1
- alita_sdk/runtime/tools/llm.py +1 -1
- alita_sdk/tools/ado/repos/repos_wrapper.py +3 -0
- alita_sdk/tools/ado/wiki/ado_wrapper.py +68 -8
- alita_sdk/tools/utils/content_parser.py +2 -1
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.353.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.353.dist-info}/RECORD +10 -10
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.353.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.353.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.353.dist-info}/top_level.txt +0 -0
|
@@ -300,5 +300,43 @@ document_loaders_map = {
|
|
|
300
300
|
}
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
+
code_extensions = [
|
|
304
|
+
# '.py', # Python
|
|
305
|
+
'.js', # JavaScript
|
|
306
|
+
'.ts', # TypeScript
|
|
307
|
+
'.java', # Java
|
|
308
|
+
'.cpp', # C++
|
|
309
|
+
'.c', # C
|
|
310
|
+
'.cs', # C#
|
|
311
|
+
'.rb', # Ruby
|
|
312
|
+
'.go', # Go
|
|
313
|
+
'.php', # PHP
|
|
314
|
+
'.swift', # Swift
|
|
315
|
+
'.kt', # Kotlin
|
|
316
|
+
'.rs', # Rust
|
|
317
|
+
'.m', # Objective-C
|
|
318
|
+
'.scala', # Scala
|
|
319
|
+
'.pl', # Perl
|
|
320
|
+
'.sh', # Shell
|
|
321
|
+
'.bat', # Batch
|
|
322
|
+
'.lua', # Lua
|
|
323
|
+
'.r', # R
|
|
324
|
+
'.pas', # Pascal
|
|
325
|
+
'.asm', # Assembly
|
|
326
|
+
'.dart', # Dart
|
|
327
|
+
'.groovy', # Groovy
|
|
328
|
+
'.sql', # SQL
|
|
329
|
+
]
|
|
330
|
+
|
|
331
|
+
default_loader_config = {
|
|
332
|
+
'class': AlitaTextLoader,
|
|
333
|
+
'mime_type': 'text/plain',
|
|
334
|
+
'is_multimodal_processing': False,
|
|
335
|
+
'kwargs': {},
|
|
336
|
+
'allowed_to_override': ['max_tokens']
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
code_loaders_map = {ext: default_loader_config for ext in code_extensions}
|
|
340
|
+
|
|
303
341
|
# Combined mapping for backward compatibility
|
|
304
|
-
loaders_map = {**image_loaders_map, **document_loaders_map}
|
|
342
|
+
loaders_map = {**image_loaders_map, **document_loaders_map, **code_loaders_map}
|
alita_sdk/runtime/tools/llm.py
CHANGED
|
@@ -95,7 +95,7 @@ class LLMNode(BaseTool):
|
|
|
95
95
|
messages = state.get("messages", []) if isinstance(state, dict) else []
|
|
96
96
|
if messages:
|
|
97
97
|
# the last message has to be HumanMessage
|
|
98
|
-
if not isinstance(messages[
|
|
98
|
+
if not isinstance(messages[-1], HumanMessage):
|
|
99
99
|
raise ToolException("LLMNode requires the last message to be a HumanMessage")
|
|
100
100
|
else:
|
|
101
101
|
raise ToolException("LLMNode requires 'messages' in state for chat-based interaction")
|
|
@@ -644,6 +644,9 @@ class ReposApiWrapper(BaseCodeToolApiWrapper):
|
|
|
644
644
|
|
|
645
645
|
return dumps(data)
|
|
646
646
|
|
|
647
|
+
def download_file(self, path):
|
|
648
|
+
return b"".join(self._client.get_item_content(self.repository_id, path=path, project=self.project, download=True))
|
|
649
|
+
|
|
647
650
|
def get_file_content(self, commit_id, path):
|
|
648
651
|
version_descriptor = GitVersionDescriptor(
|
|
649
652
|
version=commit_id, version_type="commit"
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import hashlib
|
|
2
2
|
import logging
|
|
3
|
+
import re
|
|
4
|
+
import requests
|
|
3
5
|
from typing import Generator, Literal, Optional
|
|
4
6
|
|
|
5
7
|
from azure.devops.connection import Connection
|
|
@@ -15,8 +17,11 @@ from pydantic import create_model, PrivateAttr, SecretStr
|
|
|
15
17
|
from pydantic import model_validator
|
|
16
18
|
from pydantic.fields import Field
|
|
17
19
|
|
|
20
|
+
import alita_sdk.tools.ado.work_item
|
|
21
|
+
from ..repos import ReposApiWrapper
|
|
18
22
|
from ...non_code_indexer_toolkit import NonCodeIndexerToolkit
|
|
19
23
|
from ...utils.available_tools_decorator import extend_with_parent_available_tools
|
|
24
|
+
from ...utils.content_parser import parse_file_content
|
|
20
25
|
from ....runtime.utils.utils import IndexerKeywords
|
|
21
26
|
|
|
22
27
|
logger = logging.getLogger(__name__)
|
|
@@ -29,13 +34,17 @@ GetWikiInput = create_model(
|
|
|
29
34
|
GetPageByPathInput = create_model(
|
|
30
35
|
"GetPageByPathInput",
|
|
31
36
|
wiki_identified=(str, Field(description="Wiki ID or wiki name")),
|
|
32
|
-
page_name=(str, Field(description="Wiki page path"))
|
|
37
|
+
page_name=(str, Field(description="Wiki page path")),
|
|
38
|
+
image_description_prompt=(Optional[str],
|
|
39
|
+
Field(description="Prompt which is used for image description", default=None))
|
|
33
40
|
)
|
|
34
41
|
|
|
35
42
|
GetPageByIdInput = create_model(
|
|
36
43
|
"GetPageByIdInput",
|
|
37
44
|
wiki_identified=(str, Field(description="Wiki ID or wiki name")),
|
|
38
|
-
page_id=(int, Field(description="Wiki page ID"))
|
|
45
|
+
page_id=(int, Field(description="Wiki page ID")),
|
|
46
|
+
image_description_prompt=(Optional[str],
|
|
47
|
+
Field(description="Prompt which is used for image description", default=None))
|
|
39
48
|
)
|
|
40
49
|
|
|
41
50
|
ModifyPageInput = create_model(
|
|
@@ -94,24 +103,75 @@ class AzureDevOpsApiWrapper(NonCodeIndexerToolkit):
|
|
|
94
103
|
logger.error(f"Error during the attempt to extract wiki: {str(e)}")
|
|
95
104
|
return ToolException(f"Error during the attempt to extract wiki: {str(e)}")
|
|
96
105
|
|
|
97
|
-
def get_wiki_page_by_path(self, wiki_identified: str, page_name: str):
|
|
106
|
+
def get_wiki_page_by_path(self, wiki_identified: str, page_name: str, image_description_prompt=None):
|
|
98
107
|
"""Extract ADO wiki page content."""
|
|
99
108
|
try:
|
|
100
|
-
return self._client.get_page(project=self.project, wiki_identifier=wiki_identified, path=page_name,
|
|
101
|
-
include_content=True).page.content
|
|
109
|
+
return self._process_images(self._client.get_page(project=self.project, wiki_identifier=wiki_identified, path=page_name,
|
|
110
|
+
include_content=True).page.content,
|
|
111
|
+
image_description_prompt=image_description_prompt)
|
|
102
112
|
except Exception as e:
|
|
103
113
|
logger.error(f"Error during the attempt to extract wiki page: {str(e)}")
|
|
104
114
|
return ToolException(f"Error during the attempt to extract wiki page: {str(e)}")
|
|
105
115
|
|
|
106
|
-
def get_wiki_page_by_id(self, wiki_identified: str, page_id: int):
|
|
116
|
+
def get_wiki_page_by_id(self, wiki_identified: str, page_id: int, image_description_prompt=None):
|
|
107
117
|
"""Extract ADO wiki page content."""
|
|
108
118
|
try:
|
|
109
|
-
return (self._client.get_page_by_id(project=self.project, wiki_identifier=wiki_identified, id=page_id,
|
|
110
|
-
include_content=True).page.content
|
|
119
|
+
return self._process_images(self._client.get_page_by_id(project=self.project, wiki_identifier=wiki_identified, id=page_id,
|
|
120
|
+
include_content=True).page.content,
|
|
121
|
+
image_description_prompt=image_description_prompt)
|
|
111
122
|
except Exception as e:
|
|
112
123
|
logger.error(f"Error during the attempt to extract wiki page: {str(e)}")
|
|
113
124
|
return ToolException(f"Error during the attempt to extract wiki page: {str(e)}")
|
|
114
125
|
|
|
126
|
+
def _process_images(self, page_content: str, image_description_prompt=None):
|
|
127
|
+
|
|
128
|
+
image_pattern = r"!\[(.*?)\]\((.*?)\)"
|
|
129
|
+
matches = re.findall(image_pattern, page_content)
|
|
130
|
+
|
|
131
|
+
for image_name, image_url in matches:
|
|
132
|
+
if image_url.startswith("/.attachments/"):
|
|
133
|
+
try:
|
|
134
|
+
description = self.process_attachment(attachment_url=image_url,
|
|
135
|
+
attachment_name=image_name,
|
|
136
|
+
image_description_prompt=image_description_prompt)
|
|
137
|
+
except Exception as e:
|
|
138
|
+
logger.error(f"Error parsing attachment: {str(e)}")
|
|
139
|
+
description = f"Error parsing attachment: {image_url}"
|
|
140
|
+
else:
|
|
141
|
+
try:
|
|
142
|
+
response = requests.get(image_url)
|
|
143
|
+
response.raise_for_status()
|
|
144
|
+
file_content = response.content
|
|
145
|
+
description = parse_file_content(
|
|
146
|
+
file_content=file_content,
|
|
147
|
+
file_name="image.png",
|
|
148
|
+
llm=self.llm,
|
|
149
|
+
prompt=image_description_prompt
|
|
150
|
+
)
|
|
151
|
+
except Exception as e:
|
|
152
|
+
logger.error(f"Error fetching external image: {str(e)}")
|
|
153
|
+
description = f"Error fetching external image: image_url"
|
|
154
|
+
|
|
155
|
+
new_image_markdown = f""
|
|
156
|
+
page_content = page_content.replace(f"", new_image_markdown)
|
|
157
|
+
return page_content
|
|
158
|
+
|
|
159
|
+
def process_attachment(self, attachment_url, attachment_name, image_description_prompt):
|
|
160
|
+
wiki_master_branch = "wikiMaster"
|
|
161
|
+
repos_wrapper = ReposApiWrapper(organization_url=self.organization_url,
|
|
162
|
+
project=self.project,
|
|
163
|
+
token=self.token.get_secret_value(),
|
|
164
|
+
repository_id="Test_agent.wiki",
|
|
165
|
+
base_branch=wiki_master_branch,
|
|
166
|
+
active_branch=wiki_master_branch)
|
|
167
|
+
attachment_content = repos_wrapper.download_file(path=attachment_url)
|
|
168
|
+
return parse_file_content(
|
|
169
|
+
file_content=attachment_content,
|
|
170
|
+
file_name=attachment_name,
|
|
171
|
+
llm=self.llm,
|
|
172
|
+
prompt=image_description_prompt
|
|
173
|
+
)
|
|
174
|
+
|
|
115
175
|
def delete_page_by_path(self, wiki_identified: str, page_name: str):
|
|
116
176
|
"""Extract ADO wiki page content."""
|
|
117
177
|
try:
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
from copy import deepcopy
|
|
1
2
|
import os
|
|
2
3
|
import re
|
|
3
4
|
import tempfile
|
|
@@ -126,7 +127,7 @@ def load_file_docs(file_name=None, file_content=None, is_capture_image: bool = F
|
|
|
126
127
|
|
|
127
128
|
def get_loader_kwargs(loader_object, file_name=None, file_content=None, is_capture_image: bool = False, page_number: int = None,
|
|
128
129
|
sheet_name: str = None, llm=None, file_path: str = None, excel_by_sheets: bool = False, prompt=None):
|
|
129
|
-
loader_kwargs = loader_object['kwargs']
|
|
130
|
+
loader_kwargs = deepcopy(loader_object['kwargs'])
|
|
130
131
|
loader_kwargs.update({
|
|
131
132
|
"file_path": file_path,
|
|
132
133
|
"file_content": file_content,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: alita_sdk
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.353
|
|
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
|
|
@@ -70,7 +70,7 @@ alita_sdk/runtime/langchain/document_loaders/AlitaTableLoader.py,sha256=nI8lyndV
|
|
|
70
70
|
alita_sdk/runtime/langchain/document_loaders/AlitaTextLoader.py,sha256=EiCIAF_OxSrbuwgOFk2IpxRMvFbctITt2jAI0g_atpk,3586
|
|
71
71
|
alita_sdk/runtime/langchain/document_loaders/ImageParser.py,sha256=RQ4zGdSw42ec8c6Eb48uFadayWuiT4FbwhGVwhSw60s,1065
|
|
72
72
|
alita_sdk/runtime/langchain/document_loaders/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
73
|
-
alita_sdk/runtime/langchain/document_loaders/constants.py,sha256=
|
|
73
|
+
alita_sdk/runtime/langchain/document_loaders/constants.py,sha256=9nkREtd-gmkQpuKxcPiW8MEEbyF1KZ_8HR_n6I05Y8g,10401
|
|
74
74
|
alita_sdk/runtime/langchain/document_loaders/utils.py,sha256=9xghESf3axBbwxATyVuS0Yu-TWe8zWZnXgCD1ZVyNW0,2414
|
|
75
75
|
alita_sdk/runtime/langchain/interfaces/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
76
76
|
alita_sdk/runtime/langchain/interfaces/kwextractor.py,sha256=kSJA9L8g8UArmHu7Bd9dIO0Rrq86JPUb8RYNlnN68FQ,3072
|
|
@@ -112,7 +112,7 @@ alita_sdk/runtime/tools/echo.py,sha256=spw9eCweXzixJqHnZofHE1yWiSUa04L4VKycf3KCE
|
|
|
112
112
|
alita_sdk/runtime/tools/function.py,sha256=0iZJ-UxaPbtcXAVX9G5Vsn7vmD7lrz3cBG1qylto1gs,2844
|
|
113
113
|
alita_sdk/runtime/tools/graph.py,sha256=MbnZYqdmvZY7SGDp43lOVVIjUt5ARHSgj43mdtBjSjQ,3092
|
|
114
114
|
alita_sdk/runtime/tools/indexer_tool.py,sha256=whSLPevB4WD6dhh2JDXEivDmTvbjiMV1MrPl9cz5eLA,4375
|
|
115
|
-
alita_sdk/runtime/tools/llm.py,sha256=
|
|
115
|
+
alita_sdk/runtime/tools/llm.py,sha256=OhkDTSd9k_YLWUXuAGv2J6HKhFh88Wk7qpyo79zpXAw,14062
|
|
116
116
|
alita_sdk/runtime/tools/loop.py,sha256=uds0WhZvwMxDVFI6MZHrcmMle637cQfBNg682iLxoJA,8335
|
|
117
117
|
alita_sdk/runtime/tools/loop_output.py,sha256=U4hO9PCQgWlXwOq6jdmCGbegtAxGAPXObSxZQ3z38uk,8069
|
|
118
118
|
alita_sdk/runtime/tools/mcp_server_tool.py,sha256=MhLxZJ44LYrB_0GrojmkyqKoDRaqIHkEQAsg718ipog,4277
|
|
@@ -140,11 +140,11 @@ alita_sdk/tools/non_code_indexer_toolkit.py,sha256=B3QvhpT1F9QidkCcsOi3J_QrTOaNl
|
|
|
140
140
|
alita_sdk/tools/ado/__init__.py,sha256=NnNYpNFW0_N_v1td_iekYOoQRRB7PIunbpT2f9ZFJM4,1201
|
|
141
141
|
alita_sdk/tools/ado/utils.py,sha256=PTCludvaQmPLakF2EbCGy66Mro4-rjDtavVP-xcB2Wc,1252
|
|
142
142
|
alita_sdk/tools/ado/repos/__init__.py,sha256=rR-c40Pw_WpQeOXtEuS-COvgRUs1_cTkcJfHlK09N88,5339
|
|
143
|
-
alita_sdk/tools/ado/repos/repos_wrapper.py,sha256=
|
|
143
|
+
alita_sdk/tools/ado/repos/repos_wrapper.py,sha256=zAvcCPUQ2U0QnQv8btIkqj1pG1KtFHXw1rlc2mVtWEc,49928
|
|
144
144
|
alita_sdk/tools/ado/test_plan/__init__.py,sha256=qANjEjxwEEs0aTarH9LaQ745Dv_6iRdXxMKP8RDoeGs,5344
|
|
145
145
|
alita_sdk/tools/ado/test_plan/test_plan_wrapper.py,sha256=MHM1WJUUWIgOUxGPjQUhNUxOj_Et2MAowIbhbU99h4I,22222
|
|
146
146
|
alita_sdk/tools/ado/wiki/__init__.py,sha256=ela6FOuT1fqN3FvHGBflzAh16HS1SSPsJYS2SldRX7A,5272
|
|
147
|
-
alita_sdk/tools/ado/wiki/ado_wrapper.py,sha256=
|
|
147
|
+
alita_sdk/tools/ado/wiki/ado_wrapper.py,sha256=qqKJw755X-kgB2KkcwFECa464xLKmlKrhqKfZ5Da5Gs,18188
|
|
148
148
|
alita_sdk/tools/ado/work_item/__init__.py,sha256=jml_zSkdC7gdGIoX2ZqRgDb45nhT3ZWzNsZ0II0iVJI,5474
|
|
149
149
|
alita_sdk/tools/ado/work_item/ado_wrapper.py,sha256=LTZl9yiqjsoKdy-6zD4as3NCZg1NY1Ogp9LQbiV-IZw,30851
|
|
150
150
|
alita_sdk/tools/advanced_jira_mining/__init__.py,sha256=GdrFVsyG8h43BnQwBKUtZ_ca_0atP1rQ_0adkd9mssc,4703
|
|
@@ -328,7 +328,7 @@ alita_sdk/tools/testrail/__init__.py,sha256=Xg4nVjULL_D8JpIXLYXppnwUfGF4-lguFwKH
|
|
|
328
328
|
alita_sdk/tools/testrail/api_wrapper.py,sha256=tQcGlFJmftvs5ZiO4tsP19fCo4CrJeq_UEvQR1liVfE,39891
|
|
329
329
|
alita_sdk/tools/utils/__init__.py,sha256=W9rCCUPtHCP5nGAbWp0n5jaNA84572aiRoqKneBnaS4,3330
|
|
330
330
|
alita_sdk/tools/utils/available_tools_decorator.py,sha256=IbrdfeQkswxUFgvvN7-dyLMZMyXLiwvX7kgi3phciCk,273
|
|
331
|
-
alita_sdk/tools/utils/content_parser.py,sha256=
|
|
331
|
+
alita_sdk/tools/utils/content_parser.py,sha256=eBqUI1HSgZYfPQgnDrz7dnhjKvpgPv9kqrbb_LWTh08,14473
|
|
332
332
|
alita_sdk/tools/vector_adapters/VectorStoreAdapter.py,sha256=ypBEAkFRGHv5edW0N9rdo1yKurNGQ4pRVEWtrN_7SeA,17656
|
|
333
333
|
alita_sdk/tools/vector_adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
334
334
|
alita_sdk/tools/xray/__init__.py,sha256=eOMWP8VamFbbJgt1xrGpGPqB9ByOTA0Cd3LCaETzGk4,4376
|
|
@@ -350,8 +350,8 @@ alita_sdk/tools/zephyr_scale/api_wrapper.py,sha256=kT0TbmMvuKhDUZc0i7KO18O38JM9S
|
|
|
350
350
|
alita_sdk/tools/zephyr_squad/__init__.py,sha256=0ne8XLJEQSLOWfzd2HdnqOYmQlUliKHbBED5kW_Vias,2895
|
|
351
351
|
alita_sdk/tools/zephyr_squad/api_wrapper.py,sha256=kmw_xol8YIYFplBLWTqP_VKPRhL_1ItDD0_vXTe_UuI,14906
|
|
352
352
|
alita_sdk/tools/zephyr_squad/zephyr_squad_cloud_client.py,sha256=R371waHsms4sllHCbijKYs90C-9Yu0sSR3N4SUfQOgU,5066
|
|
353
|
-
alita_sdk-0.3.
|
|
354
|
-
alita_sdk-0.3.
|
|
355
|
-
alita_sdk-0.3.
|
|
356
|
-
alita_sdk-0.3.
|
|
357
|
-
alita_sdk-0.3.
|
|
353
|
+
alita_sdk-0.3.353.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
354
|
+
alita_sdk-0.3.353.dist-info/METADATA,sha256=3Qu0R3L6lAV2TQopb04Sv8fl34C5OCS4QpkU31OTPkA,19071
|
|
355
|
+
alita_sdk-0.3.353.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
356
|
+
alita_sdk-0.3.353.dist-info/top_level.txt,sha256=0vJYy5p_jK6AwVb1aqXr7Kgqgk3WDtQ6t5C-XI9zkmg,10
|
|
357
|
+
alita_sdk-0.3.353.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|