alita-sdk 0.3.562__py3-none-any.whl → 0.3.584__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/cli/agents.py +358 -165
- alita_sdk/configurations/openapi.py +227 -15
- alita_sdk/runtime/langchain/langraph_agent.py +93 -20
- alita_sdk/runtime/langchain/utils.py +30 -14
- alita_sdk/runtime/toolkits/artifact.py +2 -1
- alita_sdk/runtime/toolkits/mcp.py +4 -2
- alita_sdk/runtime/toolkits/skill_router.py +1 -1
- alita_sdk/runtime/toolkits/vectorstore.py +1 -1
- alita_sdk/runtime/tools/data_analysis.py +1 -1
- alita_sdk/runtime/tools/llm.py +30 -11
- alita_sdk/runtime/utils/constants.py +5 -1
- alita_sdk/tools/ado/repos/__init__.py +2 -1
- alita_sdk/tools/ado/test_plan/__init__.py +2 -1
- alita_sdk/tools/ado/wiki/__init__.py +2 -1
- alita_sdk/tools/ado/work_item/__init__.py +2 -1
- alita_sdk/tools/advanced_jira_mining/__init__.py +2 -1
- alita_sdk/tools/aws/delta_lake/__init__.py +2 -1
- alita_sdk/tools/azure_ai/search/__init__.py +2 -1
- alita_sdk/tools/bitbucket/__init__.py +2 -1
- alita_sdk/tools/browser/__init__.py +1 -1
- alita_sdk/tools/carrier/__init__.py +1 -1
- alita_sdk/tools/cloud/aws/__init__.py +2 -1
- alita_sdk/tools/cloud/azure/__init__.py +2 -1
- alita_sdk/tools/cloud/gcp/__init__.py +2 -1
- alita_sdk/tools/cloud/k8s/__init__.py +2 -1
- alita_sdk/tools/code/linter/__init__.py +2 -1
- alita_sdk/tools/code/sonar/__init__.py +2 -1
- alita_sdk/tools/confluence/__init__.py +2 -1
- alita_sdk/tools/custom_open_api/__init__.py +2 -1
- alita_sdk/tools/elastic/__init__.py +2 -1
- alita_sdk/tools/figma/__init__.py +51 -5
- alita_sdk/tools/figma/api_wrapper.py +1157 -123
- alita_sdk/tools/figma/figma_client.py +73 -0
- alita_sdk/tools/figma/toon_tools.py +2748 -0
- alita_sdk/tools/github/__init__.py +2 -1
- alita_sdk/tools/gitlab/__init__.py +2 -1
- alita_sdk/tools/gitlab/api_wrapper.py +32 -0
- alita_sdk/tools/gitlab_org/__init__.py +2 -1
- alita_sdk/tools/google/bigquery/__init__.py +2 -1
- alita_sdk/tools/google_places/__init__.py +2 -1
- alita_sdk/tools/jira/__init__.py +2 -1
- alita_sdk/tools/keycloak/__init__.py +2 -1
- alita_sdk/tools/localgit/__init__.py +2 -1
- alita_sdk/tools/memory/__init__.py +1 -1
- alita_sdk/tools/ocr/__init__.py +2 -1
- alita_sdk/tools/openapi/__init__.py +227 -15
- alita_sdk/tools/openapi/api_wrapper.py +1276 -802
- alita_sdk/tools/pandas/__init__.py +3 -2
- alita_sdk/tools/postman/__init__.py +2 -1
- alita_sdk/tools/pptx/__init__.py +2 -1
- alita_sdk/tools/qtest/__init__.py +2 -1
- alita_sdk/tools/rally/__init__.py +2 -1
- alita_sdk/tools/report_portal/__init__.py +2 -1
- alita_sdk/tools/salesforce/__init__.py +2 -1
- alita_sdk/tools/servicenow/__init__.py +2 -1
- alita_sdk/tools/sharepoint/__init__.py +2 -1
- alita_sdk/tools/slack/__init__.py +3 -2
- alita_sdk/tools/sql/__init__.py +2 -1
- alita_sdk/tools/testio/__init__.py +2 -1
- alita_sdk/tools/testrail/__init__.py +2 -1
- alita_sdk/tools/utils/content_parser.py +68 -2
- alita_sdk/tools/xray/__init__.py +2 -1
- alita_sdk/tools/yagmail/__init__.py +2 -1
- alita_sdk/tools/zephyr/__init__.py +2 -1
- alita_sdk/tools/zephyr_enterprise/__init__.py +2 -1
- alita_sdk/tools/zephyr_essential/__init__.py +2 -1
- alita_sdk/tools/zephyr_scale/__init__.py +2 -1
- alita_sdk/tools/zephyr_squad/__init__.py +2 -1
- {alita_sdk-0.3.562.dist-info → alita_sdk-0.3.584.dist-info}/METADATA +1 -1
- {alita_sdk-0.3.562.dist-info → alita_sdk-0.3.584.dist-info}/RECORD +74 -72
- {alita_sdk-0.3.562.dist-info → alita_sdk-0.3.584.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.562.dist-info → alita_sdk-0.3.584.dist-info}/entry_points.txt +0 -0
- {alita_sdk-0.3.562.dist-info → alita_sdk-0.3.584.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.562.dist-info → alita_sdk-0.3.584.dist-info}/top_level.txt +0 -0
|
@@ -6,6 +6,7 @@ from pydantic import BaseModel, ConfigDict, create_model, Field
|
|
|
6
6
|
from .api_wrapper import PandasWrapper
|
|
7
7
|
from ..base.tool import BaseAction
|
|
8
8
|
from ..utils import clean_string, get_max_toolkit_length
|
|
9
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
9
10
|
|
|
10
11
|
name = "pandas"
|
|
11
12
|
|
|
@@ -54,11 +55,11 @@ class PandasToolkit(BaseToolkit):
|
|
|
54
55
|
description = f"Toolkit: {toolkit_name}\n{description}"
|
|
55
56
|
description = description[:1000]
|
|
56
57
|
tools.append(BaseAction(
|
|
57
|
-
api_wrapper=
|
|
58
|
+
api_wrapper=pandas_api_wrapper,
|
|
58
59
|
name=tool["name"],
|
|
59
60
|
description=description,
|
|
60
61
|
args_schema=tool["args_schema"],
|
|
61
|
-
metadata={
|
|
62
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
62
63
|
))
|
|
63
64
|
return cls(tools=tools)
|
|
64
65
|
|
|
@@ -8,6 +8,7 @@ from ..base.tool import BaseAction
|
|
|
8
8
|
from .api_wrapper import PostmanApiWrapper
|
|
9
9
|
from ..utils import clean_string, get_max_toolkit_length, check_connection_response
|
|
10
10
|
from ...configurations.postman import PostmanConfiguration
|
|
11
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
11
12
|
|
|
12
13
|
name = "postman"
|
|
13
14
|
|
|
@@ -102,7 +103,7 @@ class PostmanToolkit(BaseToolkit):
|
|
|
102
103
|
mode=tool["mode"],
|
|
103
104
|
description=description,
|
|
104
105
|
args_schema=tool["args_schema"],
|
|
105
|
-
metadata={
|
|
106
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
106
107
|
))
|
|
107
108
|
return cls(tools=tools)
|
|
108
109
|
|
alita_sdk/tools/pptx/__init__.py
CHANGED
|
@@ -8,6 +8,7 @@ from .pptx_wrapper import PPTXWrapper
|
|
|
8
8
|
|
|
9
9
|
from ..base.tool import BaseAction
|
|
10
10
|
from ..utils import clean_string, get_max_toolkit_length
|
|
11
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
11
12
|
|
|
12
13
|
logger = logging.getLogger(__name__)
|
|
13
14
|
|
|
@@ -87,7 +88,7 @@ class PPTXToolkit(BaseToolkit):
|
|
|
87
88
|
name=tool["name"],
|
|
88
89
|
description=description,
|
|
89
90
|
args_schema=tool["args_schema"],
|
|
90
|
-
metadata={
|
|
91
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
91
92
|
))
|
|
92
93
|
|
|
93
94
|
return cls(tools=tools)
|
|
@@ -9,6 +9,7 @@ from .tool import QtestAction
|
|
|
9
9
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
10
10
|
from ..utils import clean_string, get_max_toolkit_length, check_connection_response
|
|
11
11
|
from ...configurations.qtest import QtestConfiguration
|
|
12
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
12
13
|
|
|
13
14
|
name = "qtest"
|
|
14
15
|
|
|
@@ -89,7 +90,7 @@ class QtestToolkit(BaseToolkit):
|
|
|
89
90
|
mode=tool["mode"],
|
|
90
91
|
description=description,
|
|
91
92
|
args_schema=tool["args_schema"],
|
|
92
|
-
metadata={
|
|
93
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
93
94
|
))
|
|
94
95
|
return cls(tools=tools)
|
|
95
96
|
|
|
@@ -7,6 +7,7 @@ from ..base.tool import BaseAction
|
|
|
7
7
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
8
8
|
from ..utils import clean_string, get_max_toolkit_length
|
|
9
9
|
from ...configurations.rally import RallyConfiguration
|
|
10
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
10
11
|
|
|
11
12
|
name = "rally"
|
|
12
13
|
|
|
@@ -66,7 +67,7 @@ class RallyToolkit(BaseToolkit):
|
|
|
66
67
|
name=tool["name"],
|
|
67
68
|
description=description,
|
|
68
69
|
args_schema=tool["args_schema"],
|
|
69
|
-
metadata={
|
|
70
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
70
71
|
))
|
|
71
72
|
return cls(tools=tools)
|
|
72
73
|
|
|
@@ -9,6 +9,7 @@ from ..base.tool import BaseAction
|
|
|
9
9
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
10
10
|
from ..utils import clean_string, get_max_toolkit_length
|
|
11
11
|
from ...configurations.report_portal import ReportPortalConfiguration
|
|
12
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
12
13
|
|
|
13
14
|
name = "report_portal"
|
|
14
15
|
|
|
@@ -60,7 +61,7 @@ class ReportPortalToolkit(BaseToolkit):
|
|
|
60
61
|
name=tool["name"],
|
|
61
62
|
description=description,
|
|
62
63
|
args_schema=tool["args_schema"],
|
|
63
|
-
metadata={
|
|
64
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
64
65
|
))
|
|
65
66
|
return cls(tools=tools)
|
|
66
67
|
|
|
@@ -7,6 +7,7 @@ from pydantic import create_model, BaseModel, ConfigDict, Field
|
|
|
7
7
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
8
8
|
from ..utils import clean_string, get_max_toolkit_length
|
|
9
9
|
from ...configurations.salesforce import SalesforceConfiguration
|
|
10
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
10
11
|
|
|
11
12
|
name = "salesforce"
|
|
12
13
|
|
|
@@ -59,7 +60,7 @@ class SalesforceToolkit(BaseToolkit):
|
|
|
59
60
|
name=tool["name"],
|
|
60
61
|
description=description,
|
|
61
62
|
args_schema=tool["args_schema"],
|
|
62
|
-
metadata={
|
|
63
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
63
64
|
))
|
|
64
65
|
|
|
65
66
|
return cls(tools=tools)
|
|
@@ -8,6 +8,7 @@ from pydantic import create_model, BaseModel, ConfigDict, Field
|
|
|
8
8
|
|
|
9
9
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
10
10
|
from ...configurations.service_now import ServiceNowConfiguration
|
|
11
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
name = "service_now"
|
|
@@ -92,7 +93,7 @@ class ServiceNowToolkit(BaseToolkit):
|
|
|
92
93
|
name=tool["name"],
|
|
93
94
|
description=description,
|
|
94
95
|
args_schema=tool["args_schema"],
|
|
95
|
-
metadata={
|
|
96
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
96
97
|
))
|
|
97
98
|
return cls(tools=tools)
|
|
98
99
|
|
|
@@ -8,6 +8,7 @@ from ..elitea_base import filter_missconfigured_index_tools
|
|
|
8
8
|
from ..utils import clean_string, get_max_toolkit_length
|
|
9
9
|
from ...configurations.pgvector import PgVectorConfiguration
|
|
10
10
|
from ...configurations.sharepoint import SharepointConfiguration
|
|
11
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
11
12
|
|
|
12
13
|
name = "sharepoint"
|
|
13
14
|
|
|
@@ -77,7 +78,7 @@ class SharepointToolkit(BaseToolkit):
|
|
|
77
78
|
name=tool["name"],
|
|
78
79
|
description=description,
|
|
79
80
|
args_schema=tool["args_schema"],
|
|
80
|
-
metadata={
|
|
81
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
81
82
|
))
|
|
82
83
|
return cls(tools=tools)
|
|
83
84
|
|
|
@@ -15,6 +15,7 @@ from .api_wrapper import SlackApiWrapper
|
|
|
15
15
|
from ..utils import clean_string, get_max_toolkit_length, check_connection_response
|
|
16
16
|
from slack_sdk.errors import SlackApiError
|
|
17
17
|
from slack_sdk import WebClient
|
|
18
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
18
19
|
|
|
19
20
|
name = "slack"
|
|
20
21
|
|
|
@@ -85,12 +86,12 @@ class SlackToolkit(BaseToolkit):
|
|
|
85
86
|
if toolkit_name:
|
|
86
87
|
description = f"{description}\nToolkit: {toolkit_name}"
|
|
87
88
|
description = description[:1000]
|
|
88
|
-
tools.append(BaseAction(
|
|
89
|
+
tools.append(BaseAction(
|
|
89
90
|
api_wrapper=slack_api_wrapper,
|
|
90
91
|
name=tool["name"],
|
|
91
92
|
description=description,
|
|
92
93
|
args_schema=tool["args_schema"],
|
|
93
|
-
metadata={
|
|
94
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
94
95
|
))
|
|
95
96
|
return cls(tools=tools)
|
|
96
97
|
|
alita_sdk/tools/sql/__init__.py
CHANGED
|
@@ -9,6 +9,7 @@ from .models import SQLDialect
|
|
|
9
9
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
10
10
|
from ..utils import clean_string, get_max_toolkit_length
|
|
11
11
|
from ...configurations.sql import SqlConfiguration
|
|
12
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
12
13
|
|
|
13
14
|
name = "sql"
|
|
14
15
|
|
|
@@ -68,7 +69,7 @@ class SQLToolkit(BaseToolkit):
|
|
|
68
69
|
name=tool["name"],
|
|
69
70
|
description=description,
|
|
70
71
|
args_schema=tool["args_schema"],
|
|
71
|
-
metadata={
|
|
72
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
72
73
|
))
|
|
73
74
|
return cls(tools=tools)
|
|
74
75
|
|
|
@@ -8,6 +8,7 @@ from ..base.tool import BaseAction
|
|
|
8
8
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
9
9
|
from ..utils import clean_string, get_max_toolkit_length
|
|
10
10
|
from ...configurations.testio import TestIOConfiguration
|
|
11
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
11
12
|
|
|
12
13
|
name = "testio"
|
|
13
14
|
|
|
@@ -59,7 +60,7 @@ class TestIOToolkit(BaseToolkit):
|
|
|
59
60
|
name=tool["name"],
|
|
60
61
|
description=description,
|
|
61
62
|
args_schema=tool["args_schema"],
|
|
62
|
-
metadata={
|
|
63
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
63
64
|
))
|
|
64
65
|
return cls(tools=tools)
|
|
65
66
|
|
|
@@ -10,6 +10,7 @@ from ..elitea_base import filter_missconfigured_index_tools
|
|
|
10
10
|
from ..utils import clean_string, get_max_toolkit_length, check_connection_response
|
|
11
11
|
from ...configurations.testrail import TestRailConfiguration
|
|
12
12
|
from ...configurations.pgvector import PgVectorConfiguration
|
|
13
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
13
14
|
|
|
14
15
|
name = "testrail"
|
|
15
16
|
|
|
@@ -90,7 +91,7 @@ class TestrailToolkit(BaseToolkit):
|
|
|
90
91
|
name=tool["name"],
|
|
91
92
|
description=description,
|
|
92
93
|
args_schema=tool["args_schema"],
|
|
93
|
-
metadata={
|
|
94
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
94
95
|
))
|
|
95
96
|
return cls(tools=tools)
|
|
96
97
|
|
|
@@ -130,7 +130,38 @@ def load_file_docs(file_name=None, file_content=None, is_capture_image: bool = F
|
|
|
130
130
|
|
|
131
131
|
def get_loader_kwargs(loader_object, file_name=None, file_content=None, is_capture_image: bool = False, page_number: int = None,
|
|
132
132
|
sheet_name: str = None, llm=None, file_path: str = None, excel_by_sheets: bool = False, prompt=None):
|
|
133
|
-
|
|
133
|
+
"""Build loader kwargs safely without deepcopying non-picklable objects like LLMs.
|
|
134
|
+
|
|
135
|
+
We avoid copying keys that are going to be overridden by this function anyway
|
|
136
|
+
(file_path, file_content, file_name, extract_images, llm, page_number,
|
|
137
|
+
sheet_name, excel_by_sheets, prompt, row_content, json_documents) to
|
|
138
|
+
prevent errors such as `cannot pickle '_thread.RLock' object` when an LLM
|
|
139
|
+
or client with internal locks is stored in the original kwargs.
|
|
140
|
+
"""
|
|
141
|
+
if not loader_object:
|
|
142
|
+
raise ToolException("Loader configuration is missing.")
|
|
143
|
+
|
|
144
|
+
original_kwargs = loader_object.get("kwargs", {}) or {}
|
|
145
|
+
|
|
146
|
+
# Keys that will be overwritten below – skip them when copying
|
|
147
|
+
overridden_keys = {
|
|
148
|
+
"file_path",
|
|
149
|
+
"file_content",
|
|
150
|
+
"file_name",
|
|
151
|
+
"extract_images",
|
|
152
|
+
"llm",
|
|
153
|
+
"page_number",
|
|
154
|
+
"sheet_name",
|
|
155
|
+
"excel_by_sheets",
|
|
156
|
+
"prompt",
|
|
157
|
+
"row_content",
|
|
158
|
+
"json_documents",
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
# Build a safe shallow copy without overridden keys to avoid deepcopy
|
|
162
|
+
# of potentially non-picklable objects (e.g., llm with internal RLock).
|
|
163
|
+
loader_kwargs = {k: v for k, v in original_kwargs.items() if k not in overridden_keys}
|
|
164
|
+
|
|
134
165
|
loader_kwargs.update({
|
|
135
166
|
"file_path": file_path,
|
|
136
167
|
"file_content": file_content,
|
|
@@ -212,6 +243,41 @@ def load_content_from_bytes(file_content: bytes, extension: str = None, loader_e
|
|
|
212
243
|
if temp_file_path and os.path.exists(temp_file_path):
|
|
213
244
|
os.remove(temp_file_path)
|
|
214
245
|
|
|
246
|
+
|
|
247
|
+
def _load_content_from_bytes_with_prompt(file_content: bytes, extension: str = None, loader_extra_config: dict = None, llm = None, prompt: str = image_processing_prompt) -> str:
|
|
248
|
+
"""Internal helper that behaves like load_content_from_bytes but also propagates prompt.
|
|
249
|
+
|
|
250
|
+
This keeps the public load_content_from_bytes API unchanged while allowing newer
|
|
251
|
+
code paths to pass an explicit prompt through to the loader.
|
|
252
|
+
"""
|
|
253
|
+
temp_file_path = None
|
|
254
|
+
try:
|
|
255
|
+
with tempfile.NamedTemporaryFile(mode='w+b', delete=False, suffix=extension or '') as temp_file:
|
|
256
|
+
temp_file.write(file_content)
|
|
257
|
+
temp_file.flush()
|
|
258
|
+
temp_file_path = temp_file.name
|
|
259
|
+
|
|
260
|
+
# Use prepare_loader so that prompt and other kwargs are handled consistently
|
|
261
|
+
loader = prepare_loader(
|
|
262
|
+
file_name=None,
|
|
263
|
+
file_content=None,
|
|
264
|
+
is_capture_image=loader_extra_config.get('extract_images') if loader_extra_config else False,
|
|
265
|
+
page_number=loader_extra_config.get('page_number') if loader_extra_config else None,
|
|
266
|
+
sheet_name=loader_extra_config.get('sheet_name') if loader_extra_config else None,
|
|
267
|
+
llm=llm or (loader_extra_config.get('llm') if loader_extra_config else None),
|
|
268
|
+
file_path=temp_file_path,
|
|
269
|
+
excel_by_sheets=loader_extra_config.get('excel_by_sheets') if loader_extra_config else False,
|
|
270
|
+
prompt=prompt or (loader_extra_config.get('prompt') if loader_extra_config else image_processing_prompt),
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
documents = loader.load()
|
|
274
|
+
page_contents = [doc.page_content for doc in documents]
|
|
275
|
+
return "\n".join(page_contents)
|
|
276
|
+
finally:
|
|
277
|
+
if temp_file_path and os.path.exists(temp_file_path):
|
|
278
|
+
os.remove(temp_file_path)
|
|
279
|
+
|
|
280
|
+
|
|
215
281
|
def process_document_by_type(content, extension_source: str, document: Document = None, llm = None, chunking_config=None) \
|
|
216
282
|
-> Generator[Document, None, None]:
|
|
217
283
|
"""Process the content of a file based on its type using a configured loader cosidering the origin document."""
|
|
@@ -338,4 +404,4 @@ def file_extension_by_chunker(chunker_name: str) -> str | None:
|
|
|
338
404
|
return ".xml"
|
|
339
405
|
if name == "csv":
|
|
340
406
|
return ".csv"
|
|
341
|
-
return None
|
|
407
|
+
return None
|
alita_sdk/tools/xray/__init__.py
CHANGED
|
@@ -11,6 +11,7 @@ from ..elitea_base import filter_missconfigured_index_tools
|
|
|
11
11
|
from ..utils import clean_string, get_max_toolkit_length
|
|
12
12
|
from ...configurations.pgvector import PgVectorConfiguration
|
|
13
13
|
from ...configurations.xray import XrayConfiguration
|
|
14
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
14
15
|
|
|
15
16
|
name = "xray_cloud"
|
|
16
17
|
|
|
@@ -89,7 +90,7 @@ class XrayToolkit(BaseToolkit):
|
|
|
89
90
|
name=tool["name"],
|
|
90
91
|
description=description,
|
|
91
92
|
args_schema=tool["args_schema"],
|
|
92
|
-
metadata={
|
|
93
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
93
94
|
))
|
|
94
95
|
return cls(tools=tools)
|
|
95
96
|
|
|
@@ -6,6 +6,7 @@ from pydantic import create_model, BaseModel, Field, SecretStr
|
|
|
6
6
|
|
|
7
7
|
from .yagmail_wrapper import YagmailWrapper, SMTP_SERVER
|
|
8
8
|
from ..base.tool import BaseAction
|
|
9
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
9
10
|
|
|
10
11
|
name = "yagmail"
|
|
11
12
|
|
|
@@ -53,7 +54,7 @@ class AlitaYagmailToolkit(BaseToolkit):
|
|
|
53
54
|
name=tool["name"],
|
|
54
55
|
description=description,
|
|
55
56
|
args_schema=tool["args_schema"],
|
|
56
|
-
metadata={
|
|
57
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
57
58
|
))
|
|
58
59
|
return cls(tools=tools)
|
|
59
60
|
|
|
@@ -9,6 +9,7 @@ from ..base.tool import BaseAction
|
|
|
9
9
|
from .api_wrapper import ZephyrV1ApiWrapper
|
|
10
10
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
11
11
|
from ..utils import clean_string, get_max_toolkit_length
|
|
12
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
12
13
|
|
|
13
14
|
name = "zephyr"
|
|
14
15
|
|
|
@@ -62,7 +63,7 @@ class ZephyrToolkit(BaseToolkit):
|
|
|
62
63
|
name=tool["name"],
|
|
63
64
|
description=description,
|
|
64
65
|
args_schema=tool["args_schema"],
|
|
65
|
-
metadata={
|
|
66
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
66
67
|
))
|
|
67
68
|
return cls(tools=tools)
|
|
68
69
|
|
|
@@ -8,6 +8,7 @@ from ..elitea_base import filter_missconfigured_index_tools
|
|
|
8
8
|
from ..utils import clean_string, get_max_toolkit_length
|
|
9
9
|
from ...configurations.pgvector import PgVectorConfiguration
|
|
10
10
|
from ...configurations.zephyr_enterprise import ZephyrEnterpriseConfiguration
|
|
11
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
11
12
|
|
|
12
13
|
name = "zephyr_enterprise"
|
|
13
14
|
|
|
@@ -80,7 +81,7 @@ class ZephyrEnterpriseToolkit(BaseToolkit):
|
|
|
80
81
|
name=tool["name"],
|
|
81
82
|
description=description,
|
|
82
83
|
args_schema=tool["args_schema"],
|
|
83
|
-
metadata={
|
|
84
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
84
85
|
))
|
|
85
86
|
return cls(tools=tools)
|
|
86
87
|
|
|
@@ -9,6 +9,7 @@ from ..elitea_base import filter_missconfigured_index_tools
|
|
|
9
9
|
from ..utils import clean_string, get_max_toolkit_length
|
|
10
10
|
from ...configurations.pgvector import PgVectorConfiguration
|
|
11
11
|
from ...configurations.zephyr_essential import ZephyrEssentialConfiguration
|
|
12
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
12
13
|
|
|
13
14
|
name = "zephyr_essential"
|
|
14
15
|
|
|
@@ -75,7 +76,7 @@ class ZephyrEssentialToolkit(BaseToolkit):
|
|
|
75
76
|
name=tool["name"],
|
|
76
77
|
description=description,
|
|
77
78
|
args_schema=tool["args_schema"],
|
|
78
|
-
metadata={
|
|
79
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
79
80
|
))
|
|
80
81
|
return cls(tools=tools)
|
|
81
82
|
|
|
@@ -10,6 +10,7 @@ from ..elitea_base import filter_missconfigured_index_tools
|
|
|
10
10
|
from ..utils import clean_string, get_max_toolkit_length
|
|
11
11
|
from ...configurations.pgvector import PgVectorConfiguration
|
|
12
12
|
from ...configurations.zephyr import ZephyrConfiguration
|
|
13
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
13
14
|
|
|
14
15
|
name = "zephyr_scale"
|
|
15
16
|
|
|
@@ -88,7 +89,7 @@ class ZephyrScaleToolkit(BaseToolkit):
|
|
|
88
89
|
name=tool["name"],
|
|
89
90
|
description=description,
|
|
90
91
|
args_schema=tool["args_schema"],
|
|
91
|
-
metadata={
|
|
92
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
92
93
|
))
|
|
93
94
|
return cls(tools=tools)
|
|
94
95
|
|
|
@@ -7,6 +7,7 @@ from .api_wrapper import ZephyrSquadApiWrapper
|
|
|
7
7
|
from ..base.tool import BaseAction
|
|
8
8
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
9
9
|
from ..utils import clean_string, get_max_toolkit_length
|
|
10
|
+
from ...runtime.utils.constants import TOOLKIT_NAME_META, TOOL_NAME_META, TOOLKIT_TYPE_META
|
|
10
11
|
|
|
11
12
|
name = "zephyr_squad"
|
|
12
13
|
|
|
@@ -56,7 +57,7 @@ class ZephyrSquadToolkit(BaseToolkit):
|
|
|
56
57
|
name=tool["name"],
|
|
57
58
|
description=description,
|
|
58
59
|
args_schema=tool["args_schema"],
|
|
59
|
-
metadata={
|
|
60
|
+
metadata={TOOLKIT_NAME_META: toolkit_name, TOOLKIT_TYPE_META: name, TOOL_NAME_META: tool["name"]} if toolkit_name else {TOOL_NAME_META: tool["name"]}
|
|
60
61
|
))
|
|
61
62
|
return cls(tools=tools)
|
|
62
63
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: alita_sdk
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.584
|
|
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
|