alita-sdk 0.3.379__py3-none-any.whl → 0.3.627__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/cli/__init__.py +10 -0
- alita_sdk/cli/__main__.py +17 -0
- alita_sdk/cli/agent/__init__.py +5 -0
- alita_sdk/cli/agent/default.py +258 -0
- alita_sdk/cli/agent_executor.py +156 -0
- alita_sdk/cli/agent_loader.py +245 -0
- alita_sdk/cli/agent_ui.py +228 -0
- alita_sdk/cli/agents.py +3113 -0
- alita_sdk/cli/callbacks.py +647 -0
- alita_sdk/cli/cli.py +168 -0
- alita_sdk/cli/config.py +306 -0
- alita_sdk/cli/context/__init__.py +30 -0
- alita_sdk/cli/context/cleanup.py +198 -0
- alita_sdk/cli/context/manager.py +731 -0
- alita_sdk/cli/context/message.py +285 -0
- alita_sdk/cli/context/strategies.py +289 -0
- alita_sdk/cli/context/token_estimation.py +127 -0
- alita_sdk/cli/formatting.py +182 -0
- alita_sdk/cli/input_handler.py +419 -0
- alita_sdk/cli/inventory.py +1073 -0
- alita_sdk/cli/mcp_loader.py +315 -0
- alita_sdk/cli/testcases/__init__.py +94 -0
- alita_sdk/cli/testcases/data_generation.py +119 -0
- alita_sdk/cli/testcases/discovery.py +96 -0
- alita_sdk/cli/testcases/executor.py +84 -0
- alita_sdk/cli/testcases/logger.py +85 -0
- alita_sdk/cli/testcases/parser.py +172 -0
- alita_sdk/cli/testcases/prompts.py +91 -0
- alita_sdk/cli/testcases/reporting.py +125 -0
- alita_sdk/cli/testcases/setup.py +108 -0
- alita_sdk/cli/testcases/test_runner.py +282 -0
- alita_sdk/cli/testcases/utils.py +39 -0
- alita_sdk/cli/testcases/validation.py +90 -0
- alita_sdk/cli/testcases/workflow.py +196 -0
- alita_sdk/cli/toolkit.py +327 -0
- alita_sdk/cli/toolkit_loader.py +85 -0
- alita_sdk/cli/tools/__init__.py +43 -0
- alita_sdk/cli/tools/approval.py +224 -0
- alita_sdk/cli/tools/filesystem.py +1751 -0
- alita_sdk/cli/tools/planning.py +389 -0
- alita_sdk/cli/tools/terminal.py +414 -0
- alita_sdk/community/__init__.py +72 -12
- alita_sdk/community/inventory/__init__.py +236 -0
- alita_sdk/community/inventory/config.py +257 -0
- alita_sdk/community/inventory/enrichment.py +2137 -0
- alita_sdk/community/inventory/extractors.py +1469 -0
- alita_sdk/community/inventory/ingestion.py +3172 -0
- alita_sdk/community/inventory/knowledge_graph.py +1457 -0
- alita_sdk/community/inventory/parsers/__init__.py +218 -0
- alita_sdk/community/inventory/parsers/base.py +295 -0
- alita_sdk/community/inventory/parsers/csharp_parser.py +907 -0
- alita_sdk/community/inventory/parsers/go_parser.py +851 -0
- alita_sdk/community/inventory/parsers/html_parser.py +389 -0
- alita_sdk/community/inventory/parsers/java_parser.py +593 -0
- alita_sdk/community/inventory/parsers/javascript_parser.py +629 -0
- alita_sdk/community/inventory/parsers/kotlin_parser.py +768 -0
- alita_sdk/community/inventory/parsers/markdown_parser.py +362 -0
- alita_sdk/community/inventory/parsers/python_parser.py +604 -0
- alita_sdk/community/inventory/parsers/rust_parser.py +858 -0
- alita_sdk/community/inventory/parsers/swift_parser.py +832 -0
- alita_sdk/community/inventory/parsers/text_parser.py +322 -0
- alita_sdk/community/inventory/parsers/yaml_parser.py +370 -0
- alita_sdk/community/inventory/patterns/__init__.py +61 -0
- alita_sdk/community/inventory/patterns/ast_adapter.py +380 -0
- alita_sdk/community/inventory/patterns/loader.py +348 -0
- alita_sdk/community/inventory/patterns/registry.py +198 -0
- alita_sdk/community/inventory/presets.py +535 -0
- alita_sdk/community/inventory/retrieval.py +1403 -0
- alita_sdk/community/inventory/toolkit.py +173 -0
- alita_sdk/community/inventory/toolkit_utils.py +176 -0
- alita_sdk/community/inventory/visualize.py +1370 -0
- alita_sdk/configurations/__init__.py +1 -1
- alita_sdk/configurations/ado.py +141 -20
- alita_sdk/configurations/bitbucket.py +94 -2
- alita_sdk/configurations/confluence.py +130 -1
- alita_sdk/configurations/figma.py +76 -0
- alita_sdk/configurations/gitlab.py +91 -0
- alita_sdk/configurations/jira.py +103 -0
- alita_sdk/configurations/openapi.py +329 -0
- alita_sdk/configurations/qtest.py +72 -1
- alita_sdk/configurations/report_portal.py +96 -0
- alita_sdk/configurations/sharepoint.py +148 -0
- alita_sdk/configurations/testio.py +83 -0
- alita_sdk/configurations/testrail.py +88 -0
- alita_sdk/configurations/xray.py +93 -0
- alita_sdk/configurations/zephyr_enterprise.py +93 -0
- alita_sdk/configurations/zephyr_essential.py +75 -0
- alita_sdk/runtime/clients/artifact.py +3 -3
- alita_sdk/runtime/clients/client.py +388 -46
- alita_sdk/runtime/clients/mcp_discovery.py +342 -0
- alita_sdk/runtime/clients/mcp_manager.py +262 -0
- alita_sdk/runtime/clients/sandbox_client.py +8 -21
- alita_sdk/runtime/langchain/_constants_bkup.py +1318 -0
- alita_sdk/runtime/langchain/assistant.py +157 -39
- alita_sdk/runtime/langchain/constants.py +647 -1
- alita_sdk/runtime/langchain/document_loaders/AlitaDocxMammothLoader.py +315 -3
- alita_sdk/runtime/langchain/document_loaders/AlitaExcelLoader.py +103 -60
- alita_sdk/runtime/langchain/document_loaders/AlitaJSONLinesLoader.py +77 -0
- alita_sdk/runtime/langchain/document_loaders/AlitaJSONLoader.py +10 -4
- alita_sdk/runtime/langchain/document_loaders/AlitaPowerPointLoader.py +226 -7
- alita_sdk/runtime/langchain/document_loaders/AlitaTextLoader.py +5 -2
- alita_sdk/runtime/langchain/document_loaders/constants.py +40 -19
- alita_sdk/runtime/langchain/langraph_agent.py +405 -84
- alita_sdk/runtime/langchain/utils.py +106 -7
- alita_sdk/runtime/llms/preloaded.py +2 -6
- alita_sdk/runtime/models/mcp_models.py +61 -0
- alita_sdk/runtime/skills/__init__.py +91 -0
- alita_sdk/runtime/skills/callbacks.py +498 -0
- alita_sdk/runtime/skills/discovery.py +540 -0
- alita_sdk/runtime/skills/executor.py +610 -0
- alita_sdk/runtime/skills/input_builder.py +371 -0
- alita_sdk/runtime/skills/models.py +330 -0
- alita_sdk/runtime/skills/registry.py +355 -0
- alita_sdk/runtime/skills/skill_runner.py +330 -0
- alita_sdk/runtime/toolkits/__init__.py +31 -0
- alita_sdk/runtime/toolkits/application.py +29 -10
- alita_sdk/runtime/toolkits/artifact.py +20 -11
- alita_sdk/runtime/toolkits/datasource.py +13 -6
- alita_sdk/runtime/toolkits/mcp.py +783 -0
- alita_sdk/runtime/toolkits/mcp_config.py +1048 -0
- alita_sdk/runtime/toolkits/planning.py +178 -0
- alita_sdk/runtime/toolkits/skill_router.py +238 -0
- alita_sdk/runtime/toolkits/subgraph.py +251 -6
- alita_sdk/runtime/toolkits/tools.py +356 -69
- alita_sdk/runtime/toolkits/vectorstore.py +11 -5
- alita_sdk/runtime/tools/__init__.py +10 -3
- alita_sdk/runtime/tools/application.py +27 -6
- alita_sdk/runtime/tools/artifact.py +511 -28
- alita_sdk/runtime/tools/data_analysis.py +183 -0
- alita_sdk/runtime/tools/function.py +67 -35
- alita_sdk/runtime/tools/graph.py +10 -4
- alita_sdk/runtime/tools/image_generation.py +148 -46
- alita_sdk/runtime/tools/llm.py +1003 -128
- alita_sdk/runtime/tools/loop.py +3 -1
- alita_sdk/runtime/tools/loop_output.py +3 -1
- alita_sdk/runtime/tools/mcp_inspect_tool.py +284 -0
- alita_sdk/runtime/tools/mcp_remote_tool.py +181 -0
- alita_sdk/runtime/tools/mcp_server_tool.py +8 -5
- alita_sdk/runtime/tools/planning/__init__.py +36 -0
- alita_sdk/runtime/tools/planning/models.py +246 -0
- alita_sdk/runtime/tools/planning/wrapper.py +607 -0
- alita_sdk/runtime/tools/router.py +2 -4
- alita_sdk/runtime/tools/sandbox.py +65 -48
- alita_sdk/runtime/tools/skill_router.py +776 -0
- alita_sdk/runtime/tools/tool.py +3 -1
- alita_sdk/runtime/tools/vectorstore.py +9 -3
- alita_sdk/runtime/tools/vectorstore_base.py +70 -14
- alita_sdk/runtime/utils/AlitaCallback.py +137 -21
- alita_sdk/runtime/utils/constants.py +5 -1
- alita_sdk/runtime/utils/mcp_client.py +492 -0
- alita_sdk/runtime/utils/mcp_oauth.py +361 -0
- alita_sdk/runtime/utils/mcp_sse_client.py +434 -0
- alita_sdk/runtime/utils/mcp_tools_discovery.py +124 -0
- alita_sdk/runtime/utils/serialization.py +155 -0
- alita_sdk/runtime/utils/streamlit.py +40 -13
- alita_sdk/runtime/utils/toolkit_utils.py +30 -9
- alita_sdk/runtime/utils/utils.py +36 -0
- alita_sdk/tools/__init__.py +134 -35
- alita_sdk/tools/ado/repos/__init__.py +51 -32
- alita_sdk/tools/ado/repos/repos_wrapper.py +148 -89
- alita_sdk/tools/ado/test_plan/__init__.py +25 -9
- alita_sdk/tools/ado/test_plan/test_plan_wrapper.py +23 -1
- alita_sdk/tools/ado/utils.py +1 -18
- alita_sdk/tools/ado/wiki/__init__.py +25 -12
- alita_sdk/tools/ado/wiki/ado_wrapper.py +291 -22
- alita_sdk/tools/ado/work_item/__init__.py +26 -13
- alita_sdk/tools/ado/work_item/ado_wrapper.py +73 -11
- alita_sdk/tools/advanced_jira_mining/__init__.py +11 -8
- alita_sdk/tools/aws/delta_lake/__init__.py +13 -9
- alita_sdk/tools/aws/delta_lake/tool.py +5 -1
- alita_sdk/tools/azure_ai/search/__init__.py +11 -8
- alita_sdk/tools/azure_ai/search/api_wrapper.py +1 -1
- alita_sdk/tools/base/tool.py +5 -1
- alita_sdk/tools/base_indexer_toolkit.py +271 -84
- alita_sdk/tools/bitbucket/__init__.py +17 -11
- alita_sdk/tools/bitbucket/api_wrapper.py +59 -11
- alita_sdk/tools/bitbucket/cloud_api_wrapper.py +49 -35
- alita_sdk/tools/browser/__init__.py +5 -4
- alita_sdk/tools/carrier/__init__.py +5 -6
- alita_sdk/tools/carrier/backend_reports_tool.py +6 -6
- alita_sdk/tools/carrier/run_ui_test_tool.py +6 -6
- alita_sdk/tools/carrier/ui_reports_tool.py +5 -5
- alita_sdk/tools/chunkers/__init__.py +3 -1
- alita_sdk/tools/chunkers/code/treesitter/treesitter.py +37 -13
- alita_sdk/tools/chunkers/sematic/json_chunker.py +1 -0
- alita_sdk/tools/chunkers/sematic/markdown_chunker.py +97 -6
- alita_sdk/tools/chunkers/sematic/proposal_chunker.py +1 -1
- alita_sdk/tools/chunkers/universal_chunker.py +270 -0
- alita_sdk/tools/cloud/aws/__init__.py +10 -7
- alita_sdk/tools/cloud/azure/__init__.py +10 -7
- alita_sdk/tools/cloud/gcp/__init__.py +10 -7
- alita_sdk/tools/cloud/k8s/__init__.py +10 -7
- alita_sdk/tools/code/linter/__init__.py +10 -8
- alita_sdk/tools/code/loaders/codesearcher.py +3 -2
- alita_sdk/tools/code/sonar/__init__.py +11 -8
- alita_sdk/tools/code_indexer_toolkit.py +82 -22
- alita_sdk/tools/confluence/__init__.py +22 -16
- alita_sdk/tools/confluence/api_wrapper.py +107 -30
- alita_sdk/tools/confluence/loader.py +14 -2
- alita_sdk/tools/custom_open_api/__init__.py +12 -5
- alita_sdk/tools/elastic/__init__.py +11 -8
- alita_sdk/tools/elitea_base.py +493 -30
- alita_sdk/tools/figma/__init__.py +58 -11
- alita_sdk/tools/figma/api_wrapper.py +1235 -143
- alita_sdk/tools/figma/figma_client.py +73 -0
- alita_sdk/tools/figma/toon_tools.py +2748 -0
- alita_sdk/tools/github/__init__.py +14 -15
- alita_sdk/tools/github/github_client.py +224 -100
- alita_sdk/tools/github/graphql_client_wrapper.py +119 -33
- alita_sdk/tools/github/schemas.py +14 -5
- alita_sdk/tools/github/tool.py +5 -1
- alita_sdk/tools/github/tool_prompts.py +9 -22
- alita_sdk/tools/gitlab/__init__.py +16 -11
- alita_sdk/tools/gitlab/api_wrapper.py +218 -48
- alita_sdk/tools/gitlab_org/__init__.py +10 -9
- alita_sdk/tools/gitlab_org/api_wrapper.py +63 -64
- alita_sdk/tools/google/bigquery/__init__.py +13 -12
- alita_sdk/tools/google/bigquery/tool.py +5 -1
- alita_sdk/tools/google_places/__init__.py +11 -8
- alita_sdk/tools/google_places/api_wrapper.py +1 -1
- alita_sdk/tools/jira/__init__.py +17 -10
- alita_sdk/tools/jira/api_wrapper.py +92 -41
- alita_sdk/tools/keycloak/__init__.py +11 -8
- alita_sdk/tools/localgit/__init__.py +9 -3
- alita_sdk/tools/localgit/local_git.py +62 -54
- alita_sdk/tools/localgit/tool.py +5 -1
- alita_sdk/tools/memory/__init__.py +12 -4
- alita_sdk/tools/non_code_indexer_toolkit.py +1 -0
- alita_sdk/tools/ocr/__init__.py +11 -8
- alita_sdk/tools/openapi/__init__.py +491 -106
- alita_sdk/tools/openapi/api_wrapper.py +1368 -0
- alita_sdk/tools/openapi/tool.py +20 -0
- alita_sdk/tools/pandas/__init__.py +20 -12
- alita_sdk/tools/pandas/api_wrapper.py +38 -25
- alita_sdk/tools/pandas/dataframe/generator/base.py +3 -1
- alita_sdk/tools/postman/__init__.py +10 -9
- alita_sdk/tools/pptx/__init__.py +11 -10
- alita_sdk/tools/pptx/pptx_wrapper.py +1 -1
- alita_sdk/tools/qtest/__init__.py +31 -11
- alita_sdk/tools/qtest/api_wrapper.py +2135 -86
- alita_sdk/tools/rally/__init__.py +10 -9
- alita_sdk/tools/rally/api_wrapper.py +1 -1
- alita_sdk/tools/report_portal/__init__.py +12 -8
- alita_sdk/tools/salesforce/__init__.py +10 -8
- alita_sdk/tools/servicenow/__init__.py +17 -15
- alita_sdk/tools/servicenow/api_wrapper.py +1 -1
- alita_sdk/tools/sharepoint/__init__.py +10 -7
- alita_sdk/tools/sharepoint/api_wrapper.py +129 -38
- alita_sdk/tools/sharepoint/authorization_helper.py +191 -1
- alita_sdk/tools/sharepoint/utils.py +8 -2
- alita_sdk/tools/slack/__init__.py +10 -7
- alita_sdk/tools/slack/api_wrapper.py +2 -2
- alita_sdk/tools/sql/__init__.py +12 -9
- alita_sdk/tools/testio/__init__.py +10 -7
- alita_sdk/tools/testrail/__init__.py +11 -10
- alita_sdk/tools/testrail/api_wrapper.py +1 -1
- alita_sdk/tools/utils/__init__.py +9 -4
- alita_sdk/tools/utils/content_parser.py +103 -18
- alita_sdk/tools/utils/text_operations.py +410 -0
- alita_sdk/tools/utils/tool_prompts.py +79 -0
- alita_sdk/tools/vector_adapters/VectorStoreAdapter.py +30 -13
- alita_sdk/tools/xray/__init__.py +13 -9
- alita_sdk/tools/yagmail/__init__.py +9 -3
- alita_sdk/tools/zephyr/__init__.py +10 -7
- alita_sdk/tools/zephyr_enterprise/__init__.py +11 -7
- alita_sdk/tools/zephyr_essential/__init__.py +10 -7
- alita_sdk/tools/zephyr_essential/api_wrapper.py +30 -13
- alita_sdk/tools/zephyr_essential/client.py +2 -2
- alita_sdk/tools/zephyr_scale/__init__.py +11 -8
- alita_sdk/tools/zephyr_scale/api_wrapper.py +2 -2
- alita_sdk/tools/zephyr_squad/__init__.py +10 -7
- {alita_sdk-0.3.379.dist-info → alita_sdk-0.3.627.dist-info}/METADATA +154 -8
- alita_sdk-0.3.627.dist-info/RECORD +468 -0
- alita_sdk-0.3.627.dist-info/entry_points.txt +2 -0
- alita_sdk-0.3.379.dist-info/RECORD +0 -360
- {alita_sdk-0.3.379.dist-info → alita_sdk-0.3.627.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.379.dist-info → alita_sdk-0.3.627.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.379.dist-info → alita_sdk-0.3.627.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from typing import Optional, Type
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel, Field, field_validator
|
|
4
|
+
|
|
5
|
+
from ..base.tool import BaseAction
|
|
6
|
+
from .api_wrapper import OpenApiApiWrapper
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class OpenApiAction(BaseAction):
|
|
10
|
+
"""Tool for executing a single OpenAPI operation."""
|
|
11
|
+
|
|
12
|
+
api_wrapper: OpenApiApiWrapper = Field(default_factory=OpenApiApiWrapper)
|
|
13
|
+
name: str
|
|
14
|
+
description: str = ""
|
|
15
|
+
args_schema: Optional[Type[BaseModel]] = None
|
|
16
|
+
|
|
17
|
+
@field_validator('name', mode='before')
|
|
18
|
+
@classmethod
|
|
19
|
+
def remove_spaces(cls, v: str) -> str:
|
|
20
|
+
return v.replace(' ', '')
|
|
@@ -5,7 +5,8 @@ from pydantic import BaseModel, ConfigDict, create_model, Field
|
|
|
5
5
|
|
|
6
6
|
from .api_wrapper import PandasWrapper
|
|
7
7
|
from ..base.tool import BaseAction
|
|
8
|
-
from ..utils import clean_string,
|
|
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
|
|
|
@@ -21,19 +22,22 @@ def get_tools(tool):
|
|
|
21
22
|
|
|
22
23
|
class PandasToolkit(BaseToolkit):
|
|
23
24
|
tools: List[BaseTool] = []
|
|
24
|
-
toolkit_max_length: int = 0
|
|
25
25
|
|
|
26
26
|
@staticmethod
|
|
27
27
|
def toolkit_config_schema() -> BaseModel:
|
|
28
28
|
selected_tools = {x['name']: x['args_schema'].schema() for x in PandasWrapper.model_construct().get_available_tools()}
|
|
29
|
-
PandasToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
|
30
29
|
return create_model(
|
|
31
30
|
name,
|
|
32
|
-
bucket_name=(str, Field(default=None, title="Bucket name", description="Bucket where the content file is stored"
|
|
31
|
+
bucket_name=(Optional[str], Field(default=None, title="Bucket name", description="Bucket where the content file is stored")),
|
|
33
32
|
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
|
34
|
-
__config__=ConfigDict(json_schema_extra={'metadata': {
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
__config__=ConfigDict(json_schema_extra={'metadata': {
|
|
34
|
+
"label": "Pandas (Deprecated)",
|
|
35
|
+
"icon_url": "pandas-icon.svg",
|
|
36
|
+
"categories": ["analysis"],
|
|
37
|
+
"deprecated": True,
|
|
38
|
+
"deprecation_message": "This toolkit is deprecated. Use the 'Data Analysis' internal tool instead. Enable it via the 'Internal Tools' menu in chat.",
|
|
39
|
+
"extra_categories": ["data science", "data manipulation", "dataframes"]
|
|
40
|
+
}})
|
|
37
41
|
)
|
|
38
42
|
|
|
39
43
|
@classmethod
|
|
@@ -41,17 +45,21 @@ class PandasToolkit(BaseToolkit):
|
|
|
41
45
|
if selected_tools is None:
|
|
42
46
|
selected_tools = []
|
|
43
47
|
csv_tool_api_wrapper = PandasWrapper(**kwargs)
|
|
44
|
-
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
|
45
48
|
available_tools = csv_tool_api_wrapper.get_available_tools()
|
|
46
49
|
tools = []
|
|
47
50
|
for tool in available_tools:
|
|
48
51
|
if selected_tools and tool["name"] not in selected_tools:
|
|
49
52
|
continue
|
|
53
|
+
description = tool["description"]
|
|
54
|
+
if toolkit_name:
|
|
55
|
+
description = f"Toolkit: {toolkit_name}\n{description}"
|
|
56
|
+
description = description[:1000]
|
|
50
57
|
tools.append(BaseAction(
|
|
51
|
-
api_wrapper=
|
|
52
|
-
name=
|
|
53
|
-
description=
|
|
54
|
-
args_schema=tool["args_schema"]
|
|
58
|
+
api_wrapper=pandas_api_wrapper,
|
|
59
|
+
name=tool["name"],
|
|
60
|
+
description=description,
|
|
61
|
+
args_schema=tool["args_schema"],
|
|
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"]}
|
|
55
63
|
))
|
|
56
64
|
return cls(tools=tools)
|
|
57
65
|
|
|
@@ -158,39 +158,62 @@ class PandasWrapper(BaseToolApiWrapper):
|
|
|
158
158
|
f"Retrying Code Generation ({attempts}/{max_retries})..."
|
|
159
159
|
)
|
|
160
160
|
|
|
161
|
-
def
|
|
162
|
-
"""Analyze
|
|
161
|
+
def pandas_analyze_data(self, query: str, filename: str) -> str:
|
|
162
|
+
"""Analyze data from a file using natural language query.
|
|
163
|
+
|
|
164
|
+
This tool allows you to perform data analysis operations on files using natural language.
|
|
165
|
+
It automatically generates and executes Python pandas code based on your query.
|
|
166
|
+
|
|
167
|
+
Supported file formats: CSV, Excel (.xlsx, .xls), Parquet, JSON, XML, HDF5, Feather, Pickle
|
|
168
|
+
|
|
169
|
+
Parameters:
|
|
170
|
+
query: Natural language description of the analysis to perform. Examples:
|
|
171
|
+
- "Calculate the average sales by region"
|
|
172
|
+
- "Show me a bar chart of products by revenue"
|
|
173
|
+
- "Filter rows where price > 100 and status is 'active'"
|
|
174
|
+
- "What is the correlation between age and income?"
|
|
175
|
+
filename: Name of the file in the artifact bucket (e.g., 'sales_data.csv', 'report.xlsx')
|
|
176
|
+
|
|
177
|
+
Returns:
|
|
178
|
+
Analysis results as text, or confirmation message if a chart was generated and saved.
|
|
179
|
+
Charts are automatically saved to the artifact bucket as PNG files.
|
|
180
|
+
|
|
181
|
+
Examples:
|
|
182
|
+
- pandas_analyze_data(query="Show summary statistics", filename="data.csv")
|
|
183
|
+
- pandas_analyze_data(query="Create a histogram of ages", filename="customers.xlsx")
|
|
184
|
+
- pandas_analyze_data(query="What's the total revenue by month?", filename="sales.parquet")
|
|
185
|
+
"""
|
|
163
186
|
df = self._get_dataframe(filename)
|
|
164
187
|
code = self.generate_code_with_retries(df, query)
|
|
165
|
-
self._log_tool_event(tool_name="
|
|
188
|
+
self._log_tool_event(tool_name="pandas_analyze_data",
|
|
166
189
|
message=f"Executing generated code... \n\n```python\n{code}\n```")
|
|
167
190
|
try:
|
|
168
191
|
result = self.execute_code(df, code)
|
|
169
192
|
except Exception as e:
|
|
170
193
|
logger.error(f"Code execution failed: {format_exc()}")
|
|
171
|
-
self._log_tool_event(tool_name="process_query",
|
|
172
|
-
message=f"Executing generated code... \n\n```python\n{code}\n```")
|
|
173
194
|
raise
|
|
174
|
-
self._log_tool_event(tool_name="process_query",
|
|
175
|
-
message=f"Executing generated code... \n\n```python\n{code}\n```")
|
|
176
195
|
if result.get("df") is not None:
|
|
177
196
|
df = result.pop("df")
|
|
178
197
|
# Not saving dataframe to artifact repo for now
|
|
179
198
|
# self._save_dataframe(df, filename)
|
|
180
199
|
if result.get('chart'):
|
|
200
|
+
chart_results = []
|
|
181
201
|
if isinstance(result['chart'], list):
|
|
182
202
|
for ind, chart in enumerate(result['chart']):
|
|
183
203
|
chart_filename = f"chart_{uuid4()}.png"
|
|
184
204
|
chart_data = base64.b64decode(chart)
|
|
185
205
|
self.alita.create_artifact(self.bucket_name, chart_filename, chart_data)
|
|
186
|
-
|
|
206
|
+
chart_url = f"{self.alita.base_url}/api/v1/artifacts/artifact/default/{self.alita.project_id}/{self.bucket_name}/{chart_filename}"
|
|
207
|
+
chart_results.append(f"Chart #{ind+1} saved and available at: {chart_url}")
|
|
208
|
+
result['result'] = "\n".join(chart_results)
|
|
187
209
|
else:
|
|
188
210
|
# Handle single chart case (not in a list)
|
|
189
211
|
chart = result['chart']
|
|
190
212
|
chart_filename = f"chart_{uuid4()}.png"
|
|
191
213
|
chart_data = base64.b64decode(chart)
|
|
192
214
|
self.alita.create_artifact(self.bucket_name, chart_filename, chart_data)
|
|
193
|
-
|
|
215
|
+
chart_url = f"{self.alita.base_url}/api/v1/artifacts/artifact/default/{self.alita.project_id}/{self.bucket_name}/{chart_filename}"
|
|
216
|
+
result['result'] = f"Chart saved and available at: {chart_url}\n\nYou can embed this image in your response using markdown: "
|
|
194
217
|
return result.get("result", None)
|
|
195
218
|
|
|
196
219
|
def save_dataframe(self, source_df: str, target_file: str) -> str:
|
|
@@ -253,23 +276,13 @@ class PandasWrapper(BaseToolApiWrapper):
|
|
|
253
276
|
def get_available_tools(self):
|
|
254
277
|
return [
|
|
255
278
|
{
|
|
256
|
-
"name": "
|
|
257
|
-
"ref": self.
|
|
258
|
-
"description": self.
|
|
259
|
-
"args_schema": create_model(
|
|
260
|
-
"ProcessQueryModel",
|
|
261
|
-
query=(str, Field(description="Task to solve")),
|
|
262
|
-
filename=(str, Field(description="File to be processed"))
|
|
263
|
-
)
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
"name": "save_dataframe",
|
|
267
|
-
"ref": self.save_dataframe,
|
|
268
|
-
"description": self.save_dataframe.__doc__,
|
|
279
|
+
"name": "pandas_analyze_data",
|
|
280
|
+
"ref": self.pandas_analyze_data,
|
|
281
|
+
"description": self.pandas_analyze_data.__doc__,
|
|
269
282
|
"args_schema": create_model(
|
|
270
|
-
"
|
|
271
|
-
|
|
272
|
-
|
|
283
|
+
"AnalyseDataModel",
|
|
284
|
+
query=(str, Field(description="Natural language query describing what analysis to perform on the data")),
|
|
285
|
+
filename=(str, Field(description="Name of the file to analyze (e.g., 'data.csv', 'report.xlsx')"))
|
|
273
286
|
)
|
|
274
287
|
}
|
|
275
288
|
]
|
|
@@ -39,7 +39,9 @@ class CodeGenerator:
|
|
|
39
39
|
{"role": "user", "content": [{"type": "text", "text": prompt}]}
|
|
40
40
|
]
|
|
41
41
|
# Generate the code
|
|
42
|
-
|
|
42
|
+
from alita_sdk.runtime.langchain.utils import extract_text_from_completion
|
|
43
|
+
completion = self.llm.invoke(messages)
|
|
44
|
+
code = extract_text_from_completion(completion)
|
|
43
45
|
return self.validate_and_clean_code(code)
|
|
44
46
|
|
|
45
47
|
except Exception as e:
|
|
@@ -6,8 +6,9 @@ from pydantic import create_model, BaseModel, ConfigDict, Field, field_validator
|
|
|
6
6
|
from ..base.tool import BaseAction
|
|
7
7
|
|
|
8
8
|
from .api_wrapper import PostmanApiWrapper
|
|
9
|
-
from ..utils import clean_string, get_max_toolkit_length,
|
|
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
|
|
|
@@ -43,14 +44,11 @@ def get_tools(tool):
|
|
|
43
44
|
|
|
44
45
|
class PostmanToolkit(BaseToolkit):
|
|
45
46
|
tools: List[BaseTool] = []
|
|
46
|
-
toolkit_max_length: int = 0
|
|
47
47
|
|
|
48
48
|
@staticmethod
|
|
49
49
|
def toolkit_config_schema() -> BaseModel:
|
|
50
50
|
selected_tools = {x['name']: x['args_schema'].schema(
|
|
51
51
|
) for x in PostmanApiWrapper.model_construct().get_available_tools()}
|
|
52
|
-
PostmanToolkit.toolkit_max_length = get_max_toolkit_length(
|
|
53
|
-
selected_tools)
|
|
54
52
|
m = create_model(
|
|
55
53
|
name,
|
|
56
54
|
postman_configuration=(Optional[PostmanConfiguration], Field(description="Postman Configuration",
|
|
@@ -89,20 +87,23 @@ class PostmanToolkit(BaseToolkit):
|
|
|
89
87
|
**kwargs['postman_configuration'],
|
|
90
88
|
}
|
|
91
89
|
postman_api_wrapper = PostmanApiWrapper(**wrapper_payload)
|
|
92
|
-
prefix = clean_string(str(toolkit_name), cls.toolkit_max_length) + \
|
|
93
|
-
TOOLKIT_SPLITTER if toolkit_name else ''
|
|
94
90
|
available_tools = postman_api_wrapper.get_available_tools()
|
|
95
91
|
tools = []
|
|
96
92
|
for tool in available_tools:
|
|
97
93
|
if selected_tools:
|
|
98
94
|
if tool["name"] not in selected_tools:
|
|
99
95
|
continue
|
|
96
|
+
description = f"{tool['description']}\nAPI URL: {postman_api_wrapper.base_url}"
|
|
97
|
+
if toolkit_name:
|
|
98
|
+
description = f"{description}\nToolkit: {toolkit_name}"
|
|
99
|
+
description = description[:1000]
|
|
100
100
|
tools.append(PostmanAction(
|
|
101
101
|
api_wrapper=postman_api_wrapper,
|
|
102
|
-
name=
|
|
102
|
+
name=tool["name"],
|
|
103
103
|
mode=tool["mode"],
|
|
104
|
-
description=
|
|
105
|
-
args_schema=tool["args_schema"]
|
|
104
|
+
description=description,
|
|
105
|
+
args_schema=tool["args_schema"],
|
|
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
|
@@ -7,7 +7,8 @@ from pydantic import create_model, BaseModel, ConfigDict, Field
|
|
|
7
7
|
from .pptx_wrapper import PPTXWrapper
|
|
8
8
|
|
|
9
9
|
from ..base.tool import BaseAction
|
|
10
|
-
from ..utils import clean_string,
|
|
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
|
|
|
@@ -27,8 +28,6 @@ def get_tools(tool):
|
|
|
27
28
|
).get_tools()
|
|
28
29
|
|
|
29
30
|
|
|
30
|
-
TOOLKIT_MAX_LENGTH = 25
|
|
31
|
-
|
|
32
31
|
class PPTXToolkit(BaseToolkit):
|
|
33
32
|
"""
|
|
34
33
|
PowerPoint (PPTX) manipulation toolkit for Alita.
|
|
@@ -45,8 +44,7 @@ class PPTXToolkit(BaseToolkit):
|
|
|
45
44
|
|
|
46
45
|
return create_model(
|
|
47
46
|
name,
|
|
48
|
-
bucket_name=(str, Field(description="Bucket name where PPTX files are stored",
|
|
49
|
-
json_schema_extra={'toolkit_name': True, 'max_toolkit_length': TOOLKIT_MAX_LENGTH})),
|
|
47
|
+
bucket_name=(str, Field(description="Bucket name where PPTX files are stored")),
|
|
50
48
|
selected_tools=(List[Literal[tuple(selected_tools)]], Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
|
51
49
|
__config__=ConfigDict(json_schema_extra={
|
|
52
50
|
'metadata': {
|
|
@@ -75,19 +73,22 @@ class PPTXToolkit(BaseToolkit):
|
|
|
75
73
|
selected_tools = []
|
|
76
74
|
|
|
77
75
|
pptx_api_wrapper = PPTXWrapper(**kwargs)
|
|
78
|
-
prefix = clean_string(toolkit_name, TOOLKIT_MAX_LENGTH) + TOOLKIT_SPLITTER if toolkit_name else ''
|
|
79
76
|
available_tools = pptx_api_wrapper.get_available_tools()
|
|
80
77
|
tools = []
|
|
81
78
|
|
|
82
79
|
for tool in available_tools:
|
|
83
80
|
if selected_tools and tool["name"] not in selected_tools:
|
|
84
81
|
continue
|
|
85
|
-
|
|
82
|
+
description = tool["description"]
|
|
83
|
+
if toolkit_name:
|
|
84
|
+
description = f"Toolkit: {toolkit_name}\n{description}"
|
|
85
|
+
description = description[:1000]
|
|
86
86
|
tools.append(BaseAction(
|
|
87
87
|
api_wrapper=pptx_api_wrapper,
|
|
88
|
-
name=
|
|
89
|
-
description=
|
|
90
|
-
args_schema=tool["args_schema"]
|
|
88
|
+
name=tool["name"],
|
|
89
|
+
description=description,
|
|
90
|
+
args_schema=tool["args_schema"],
|
|
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)
|
|
@@ -547,7 +547,7 @@ class PPTXWrapper(BaseToolApiWrapper):
|
|
|
547
547
|
file_name=(str, Field(description="PPTX file name in the bucket")),
|
|
548
548
|
output_file_name=(str, Field(description="Output PPTX file name to save in the bucket")),
|
|
549
549
|
content_description=(str, Field(description="Detailed description of what content to put where in the template")),
|
|
550
|
-
pdf_file_name=(str, Field(description="Optional PDF file name in the bucket that matches the PPTX template 1:1", default=None))
|
|
550
|
+
pdf_file_name=(Optional[str], Field(description="Optional PDF file name in the bucket that matches the PPTX template 1:1", default=None))
|
|
551
551
|
)
|
|
552
552
|
},{
|
|
553
553
|
"name": "translate_presentation",
|
|
@@ -7,8 +7,10 @@ from pydantic import create_model, BaseModel, ConfigDict, Field, SecretStr
|
|
|
7
7
|
from .api_wrapper import QtestApiWrapper
|
|
8
8
|
from .tool import QtestAction
|
|
9
9
|
from ..elitea_base import filter_missconfigured_index_tools
|
|
10
|
-
from ..utils import clean_string, get_max_toolkit_length,
|
|
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
|
|
13
|
+
from ...configurations.pgvector import PgVectorConfiguration
|
|
12
14
|
|
|
13
15
|
name = "qtest"
|
|
14
16
|
|
|
@@ -20,27 +22,40 @@ def get_tools(tool):
|
|
|
20
22
|
no_of_tests_shown_in_dql_search=tool['settings'].get('no_of_tests_shown_in_dql_search'),
|
|
21
23
|
qtest_configuration=tool['settings']['qtest_configuration'],
|
|
22
24
|
toolkit_name=tool.get('toolkit_name'),
|
|
23
|
-
llm=tool['settings'].get('llm', None)
|
|
25
|
+
llm=tool['settings'].get('llm', None),
|
|
26
|
+
alita=tool['settings'].get('alita', None),
|
|
27
|
+
|
|
28
|
+
# indexer settings
|
|
29
|
+
pgvector_configuration=tool['settings'].get('pgvector_configuration', {}),
|
|
30
|
+
collection_name=str(tool.get('toolkit_name', '')),
|
|
31
|
+
embedding_model=tool['settings'].get('embedding_model', None),
|
|
32
|
+
vectorstore_type="PGVector"
|
|
24
33
|
)
|
|
25
34
|
return toolkit.tools
|
|
26
35
|
|
|
27
36
|
|
|
28
37
|
class QtestToolkit(BaseToolkit):
|
|
29
38
|
tools: List[BaseTool] = []
|
|
30
|
-
toolkit_max_length: int = 0
|
|
31
39
|
|
|
32
40
|
@staticmethod
|
|
33
41
|
def toolkit_config_schema() -> BaseModel:
|
|
34
42
|
selected_tools = {x['name']: x['args_schema'].schema() for x in QtestApiWrapper.model_construct().get_available_tools()}
|
|
35
|
-
QtestToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
|
36
43
|
m = create_model(
|
|
37
44
|
name,
|
|
38
45
|
qtest_configuration=(QtestConfiguration, Field(description="QTest API token", json_schema_extra={
|
|
39
46
|
'configuration_types': ['qtest']})),
|
|
40
|
-
qtest_project_id=(int, Field(
|
|
41
|
-
'max_toolkit_length': QtestToolkit.toolkit_max_length})),
|
|
47
|
+
qtest_project_id=(int, Field(description="QTest project id")),
|
|
42
48
|
no_of_tests_shown_in_dql_search=(Optional[int], Field(description="Max number of items returned by dql search",
|
|
43
49
|
default=10)),
|
|
50
|
+
# indexer configuration
|
|
51
|
+
pgvector_configuration=(Optional[PgVectorConfiguration], Field(
|
|
52
|
+
default=None,
|
|
53
|
+
description="PgVector Configuration for indexing",
|
|
54
|
+
json_schema_extra={'configuration_types': ['pgvector']})),
|
|
55
|
+
embedding_model=(Optional[str], Field(
|
|
56
|
+
default=None,
|
|
57
|
+
description="Embedding model configuration for indexing",
|
|
58
|
+
json_schema_extra={'configuration_model': 'embedding'})),
|
|
44
59
|
|
|
45
60
|
selected_tools=(List[Literal[tuple(selected_tools)]],
|
|
46
61
|
Field(default=[], json_schema_extra={'args_schemas': selected_tools})),
|
|
@@ -74,23 +89,28 @@ class QtestToolkit(BaseToolkit):
|
|
|
74
89
|
**kwargs,
|
|
75
90
|
# TODO use qtest_configuration fields
|
|
76
91
|
**kwargs['qtest_configuration'],
|
|
92
|
+
**(kwargs.get('pgvector_configuration') or {}),
|
|
77
93
|
}
|
|
78
94
|
qtest_api_wrapper = QtestApiWrapper(**wrapper_payload)
|
|
79
|
-
prefix = clean_string(str(toolkit_name), cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
|
80
95
|
available_tools = qtest_api_wrapper.get_available_tools()
|
|
81
96
|
tools = []
|
|
82
97
|
for tool in available_tools:
|
|
83
98
|
if selected_tools:
|
|
84
99
|
if tool["name"] not in selected_tools:
|
|
85
100
|
continue
|
|
101
|
+
description = f"{tool['description']}\nUrl: {qtest_api_wrapper.base_url}. Project id: {qtest_api_wrapper.qtest_project_id}"
|
|
102
|
+
if toolkit_name:
|
|
103
|
+
description = f"{description}\nToolkit: {toolkit_name}"
|
|
104
|
+
description = description[:1000]
|
|
86
105
|
tools.append(QtestAction(
|
|
87
106
|
api_wrapper=qtest_api_wrapper,
|
|
88
|
-
name=
|
|
107
|
+
name=tool["name"],
|
|
89
108
|
mode=tool["mode"],
|
|
90
|
-
description=
|
|
91
|
-
args_schema=tool["args_schema"]
|
|
109
|
+
description=description,
|
|
110
|
+
args_schema=tool["args_schema"],
|
|
111
|
+
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
112
|
))
|
|
93
113
|
return cls(tools=tools)
|
|
94
114
|
|
|
95
115
|
def get_tools(self):
|
|
96
|
-
return self.tools
|
|
116
|
+
return self.tools
|