alita-sdk 0.3.351__py3-none-any.whl → 0.3.499__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 +155 -0
- alita_sdk/cli/agent_loader.py +215 -0
- alita_sdk/cli/agent_ui.py +228 -0
- alita_sdk/cli/agents.py +3601 -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 +1256 -0
- alita_sdk/cli/mcp_loader.py +315 -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 +64 -8
- alita_sdk/community/inventory/__init__.py +224 -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/visualize.py +1370 -0
- alita_sdk/configurations/bitbucket.py +94 -2
- alita_sdk/configurations/confluence.py +96 -1
- alita_sdk/configurations/gitlab.py +79 -0
- alita_sdk/configurations/jira.py +103 -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 +1 -1
- alita_sdk/runtime/clients/client.py +214 -42
- 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 +373 -0
- alita_sdk/runtime/langchain/assistant.py +118 -30
- alita_sdk/runtime/langchain/constants.py +8 -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/AlitaJSONLoader.py +4 -1
- alita_sdk/runtime/langchain/document_loaders/AlitaPowerPointLoader.py +41 -12
- alita_sdk/runtime/langchain/document_loaders/AlitaTableLoader.py +1 -1
- alita_sdk/runtime/langchain/document_loaders/constants.py +116 -99
- alita_sdk/runtime/langchain/interfaces/llm_processor.py +2 -2
- alita_sdk/runtime/langchain/langraph_agent.py +307 -71
- alita_sdk/runtime/langchain/utils.py +48 -8
- alita_sdk/runtime/llms/preloaded.py +2 -6
- alita_sdk/runtime/models/mcp_models.py +61 -0
- alita_sdk/runtime/toolkits/__init__.py +26 -0
- alita_sdk/runtime/toolkits/application.py +9 -2
- alita_sdk/runtime/toolkits/artifact.py +18 -6
- alita_sdk/runtime/toolkits/datasource.py +13 -6
- alita_sdk/runtime/toolkits/mcp.py +780 -0
- alita_sdk/runtime/toolkits/planning.py +178 -0
- alita_sdk/runtime/toolkits/tools.py +205 -55
- alita_sdk/runtime/toolkits/vectorstore.py +9 -4
- alita_sdk/runtime/tools/__init__.py +11 -3
- alita_sdk/runtime/tools/application.py +7 -0
- alita_sdk/runtime/tools/artifact.py +225 -12
- alita_sdk/runtime/tools/function.py +95 -5
- alita_sdk/runtime/tools/graph.py +10 -4
- alita_sdk/runtime/tools/image_generation.py +212 -0
- alita_sdk/runtime/tools/llm.py +494 -102
- 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 +4 -4
- 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 -1
- alita_sdk/runtime/tools/sandbox.py +180 -79
- alita_sdk/runtime/tools/vectorstore.py +22 -21
- alita_sdk/runtime/tools/vectorstore_base.py +125 -52
- alita_sdk/runtime/utils/AlitaCallback.py +106 -20
- alita_sdk/runtime/utils/mcp_client.py +465 -0
- alita_sdk/runtime/utils/mcp_oauth.py +244 -0
- alita_sdk/runtime/utils/mcp_sse_client.py +405 -0
- alita_sdk/runtime/utils/mcp_tools_discovery.py +124 -0
- alita_sdk/runtime/utils/streamlit.py +40 -13
- alita_sdk/runtime/utils/toolkit_utils.py +28 -9
- alita_sdk/runtime/utils/utils.py +12 -0
- alita_sdk/tools/__init__.py +77 -33
- alita_sdk/tools/ado/repos/__init__.py +7 -6
- alita_sdk/tools/ado/repos/repos_wrapper.py +11 -11
- alita_sdk/tools/ado/test_plan/__init__.py +7 -7
- alita_sdk/tools/ado/wiki/__init__.py +7 -11
- alita_sdk/tools/ado/wiki/ado_wrapper.py +89 -15
- alita_sdk/tools/ado/work_item/__init__.py +7 -11
- alita_sdk/tools/ado/work_item/ado_wrapper.py +17 -8
- alita_sdk/tools/advanced_jira_mining/__init__.py +8 -7
- alita_sdk/tools/aws/delta_lake/__init__.py +11 -9
- alita_sdk/tools/azure_ai/search/__init__.py +7 -6
- alita_sdk/tools/base_indexer_toolkit.py +345 -70
- alita_sdk/tools/bitbucket/__init__.py +9 -8
- alita_sdk/tools/bitbucket/api_wrapper.py +50 -6
- alita_sdk/tools/browser/__init__.py +4 -4
- alita_sdk/tools/carrier/__init__.py +4 -6
- alita_sdk/tools/chunkers/__init__.py +3 -1
- 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 +7 -6
- alita_sdk/tools/cloud/azure/__init__.py +7 -6
- alita_sdk/tools/cloud/gcp/__init__.py +7 -6
- alita_sdk/tools/cloud/k8s/__init__.py +7 -6
- alita_sdk/tools/code/linter/__init__.py +7 -7
- alita_sdk/tools/code/loaders/codesearcher.py +3 -2
- alita_sdk/tools/code/sonar/__init__.py +8 -7
- alita_sdk/tools/code_indexer_toolkit.py +199 -0
- alita_sdk/tools/confluence/__init__.py +9 -8
- alita_sdk/tools/confluence/api_wrapper.py +171 -75
- alita_sdk/tools/confluence/loader.py +10 -0
- alita_sdk/tools/custom_open_api/__init__.py +9 -4
- alita_sdk/tools/elastic/__init__.py +8 -7
- alita_sdk/tools/elitea_base.py +492 -52
- alita_sdk/tools/figma/__init__.py +7 -7
- alita_sdk/tools/figma/api_wrapper.py +2 -1
- alita_sdk/tools/github/__init__.py +9 -9
- alita_sdk/tools/github/api_wrapper.py +9 -26
- alita_sdk/tools/github/github_client.py +62 -2
- alita_sdk/tools/gitlab/__init__.py +8 -8
- alita_sdk/tools/gitlab/api_wrapper.py +135 -33
- alita_sdk/tools/gitlab_org/__init__.py +7 -8
- alita_sdk/tools/google/bigquery/__init__.py +11 -12
- alita_sdk/tools/google_places/__init__.py +8 -7
- alita_sdk/tools/jira/__init__.py +9 -7
- alita_sdk/tools/jira/api_wrapper.py +100 -52
- alita_sdk/tools/keycloak/__init__.py +8 -7
- alita_sdk/tools/localgit/local_git.py +56 -54
- alita_sdk/tools/memory/__init__.py +1 -1
- alita_sdk/tools/non_code_indexer_toolkit.py +3 -2
- alita_sdk/tools/ocr/__init__.py +8 -7
- alita_sdk/tools/openapi/__init__.py +10 -1
- alita_sdk/tools/pandas/__init__.py +8 -7
- alita_sdk/tools/postman/__init__.py +7 -8
- alita_sdk/tools/postman/api_wrapper.py +19 -8
- alita_sdk/tools/postman/postman_analysis.py +8 -1
- alita_sdk/tools/pptx/__init__.py +8 -9
- alita_sdk/tools/qtest/__init__.py +16 -11
- alita_sdk/tools/qtest/api_wrapper.py +1784 -88
- alita_sdk/tools/rally/__init__.py +7 -8
- alita_sdk/tools/report_portal/__init__.py +9 -7
- alita_sdk/tools/salesforce/__init__.py +7 -7
- alita_sdk/tools/servicenow/__init__.py +10 -10
- alita_sdk/tools/sharepoint/__init__.py +7 -6
- alita_sdk/tools/sharepoint/api_wrapper.py +127 -36
- alita_sdk/tools/sharepoint/authorization_helper.py +191 -1
- alita_sdk/tools/sharepoint/utils.py +8 -2
- alita_sdk/tools/slack/__init__.py +7 -6
- alita_sdk/tools/sql/__init__.py +8 -7
- alita_sdk/tools/sql/api_wrapper.py +71 -23
- alita_sdk/tools/testio/__init__.py +7 -6
- alita_sdk/tools/testrail/__init__.py +8 -9
- alita_sdk/tools/utils/__init__.py +26 -4
- alita_sdk/tools/utils/content_parser.py +88 -60
- alita_sdk/tools/utils/text_operations.py +254 -0
- alita_sdk/tools/vector_adapters/VectorStoreAdapter.py +76 -26
- alita_sdk/tools/xray/__init__.py +9 -7
- alita_sdk/tools/zephyr/__init__.py +7 -6
- alita_sdk/tools/zephyr_enterprise/__init__.py +8 -6
- alita_sdk/tools/zephyr_essential/__init__.py +7 -6
- alita_sdk/tools/zephyr_essential/api_wrapper.py +12 -13
- alita_sdk/tools/zephyr_scale/__init__.py +7 -6
- alita_sdk/tools/zephyr_squad/__init__.py +7 -6
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.499.dist-info}/METADATA +147 -2
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.499.dist-info}/RECORD +206 -130
- alita_sdk-0.3.499.dist-info/entry_points.txt +2 -0
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.499.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.499.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.351.dist-info → alita_sdk-0.3.499.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Inventory Retrieval Toolkit.
|
|
3
|
+
|
|
4
|
+
Provides LangChain-compatible toolkit for querying pre-built knowledge graphs.
|
|
5
|
+
This is a pure retrieval toolkit - for ingestion, use the IngestionPipeline.
|
|
6
|
+
|
|
7
|
+
The toolkit can be added to any agent to provide knowledge graph context.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from typing import Any, Optional, List, Dict, Literal, ClassVar
|
|
11
|
+
|
|
12
|
+
from langchain_core.tools import BaseTool
|
|
13
|
+
from langchain_core.tools import BaseToolkit
|
|
14
|
+
from pydantic import BaseModel, Field, ConfigDict, create_model
|
|
15
|
+
|
|
16
|
+
from .retrieval import InventoryRetrievalApiWrapper
|
|
17
|
+
from ...tools.base.tool import BaseAction
|
|
18
|
+
from ...tools.utils import clean_string, get_max_toolkit_length
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class InventoryRetrievalToolkit(BaseToolkit):
|
|
22
|
+
"""
|
|
23
|
+
Toolkit for querying pre-built Knowledge Graphs.
|
|
24
|
+
|
|
25
|
+
This toolkit provides retrieval-only access to a knowledge graph
|
|
26
|
+
that was built using the IngestionPipeline. It can be added to
|
|
27
|
+
any agent to provide codebase context.
|
|
28
|
+
|
|
29
|
+
Available tools:
|
|
30
|
+
- search_graph: Search entities by name, type, or layer
|
|
31
|
+
- get_entity: Get detailed entity info with relations
|
|
32
|
+
- get_entity_content: Retrieve source code via citation
|
|
33
|
+
- impact_analysis: Analyze upstream/downstream dependencies
|
|
34
|
+
- get_related_entities: Get related entities
|
|
35
|
+
- get_stats: Graph statistics
|
|
36
|
+
- get_citations: Citation summaries
|
|
37
|
+
- list_entities_by_type: List entities of a type
|
|
38
|
+
- list_entities_by_layer: List entities in a layer
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
tools: List[BaseTool] = []
|
|
42
|
+
toolkit_max_length: ClassVar[int] = 0
|
|
43
|
+
|
|
44
|
+
# All available tools in this toolkit
|
|
45
|
+
AVAILABLE_TOOLS: ClassVar[List[str]] = [
|
|
46
|
+
"search_graph",
|
|
47
|
+
"get_entity",
|
|
48
|
+
"get_entity_content",
|
|
49
|
+
"impact_analysis",
|
|
50
|
+
"get_related_entities",
|
|
51
|
+
"get_stats",
|
|
52
|
+
"get_citations",
|
|
53
|
+
"list_entities_by_type",
|
|
54
|
+
"list_entities_by_layer",
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
@staticmethod
|
|
58
|
+
def toolkit_config_schema() -> BaseModel:
|
|
59
|
+
"""Return the configuration schema for this toolkit."""
|
|
60
|
+
selected_tools = {
|
|
61
|
+
x['name']: x['args_schema'].model_json_schema()
|
|
62
|
+
for x in InventoryRetrievalApiWrapper.model_construct().get_available_tools()
|
|
63
|
+
}
|
|
64
|
+
InventoryRetrievalToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
|
65
|
+
|
|
66
|
+
model = create_model(
|
|
67
|
+
'inventory',
|
|
68
|
+
graph_path=(str, Field(
|
|
69
|
+
description="Path to the knowledge graph JSON file (required). "
|
|
70
|
+
"The graph should be built using IngestionPipeline."
|
|
71
|
+
)),
|
|
72
|
+
base_directory=(Optional[str], Field(
|
|
73
|
+
default=None,
|
|
74
|
+
description="Base directory for local content retrieval. "
|
|
75
|
+
"If set, get_entity_content will read from local files."
|
|
76
|
+
)),
|
|
77
|
+
selected_tools=(List[Literal[tuple(selected_tools)]], Field(
|
|
78
|
+
default=[],
|
|
79
|
+
json_schema_extra={'args_schemas': selected_tools}
|
|
80
|
+
)),
|
|
81
|
+
__config__=ConfigDict(json_schema_extra={
|
|
82
|
+
'metadata': {
|
|
83
|
+
"label": "Knowledge Graph Retrieval",
|
|
84
|
+
"icon_url": "inventory-icon.svg",
|
|
85
|
+
"max_length": InventoryRetrievalToolkit.toolkit_max_length,
|
|
86
|
+
"categories": ["knowledge management"],
|
|
87
|
+
"extra_categories": [
|
|
88
|
+
"knowledge graph",
|
|
89
|
+
"code context",
|
|
90
|
+
"impact analysis",
|
|
91
|
+
"code search"
|
|
92
|
+
],
|
|
93
|
+
"description": (
|
|
94
|
+
"Query a pre-built knowledge graph for codebase context. "
|
|
95
|
+
"Use IngestionPipeline to build the graph first."
|
|
96
|
+
),
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
)
|
|
100
|
+
return model
|
|
101
|
+
|
|
102
|
+
@classmethod
|
|
103
|
+
def get_toolkit(
|
|
104
|
+
cls,
|
|
105
|
+
selected_tools: Optional[List[str]] = None,
|
|
106
|
+
toolkit_name: str = "inventory",
|
|
107
|
+
graph_path: Optional[str] = None,
|
|
108
|
+
base_directory: Optional[str] = None,
|
|
109
|
+
source_toolkits: Optional[Dict[str, Any]] = None,
|
|
110
|
+
**kwargs
|
|
111
|
+
) -> "InventoryRetrievalToolkit":
|
|
112
|
+
"""
|
|
113
|
+
Create and return an InventoryRetrievalToolkit instance.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
selected_tools: List of tool names to include (None = all tools)
|
|
117
|
+
toolkit_name: Name for this toolkit instance
|
|
118
|
+
graph_path: Path to the knowledge graph JSON file
|
|
119
|
+
base_directory: Base directory for local content retrieval
|
|
120
|
+
source_toolkits: Dict of source toolkits for remote content retrieval
|
|
121
|
+
**kwargs: Additional configuration
|
|
122
|
+
|
|
123
|
+
Returns:
|
|
124
|
+
Configured InventoryRetrievalToolkit instance
|
|
125
|
+
"""
|
|
126
|
+
# Validate selected tools
|
|
127
|
+
if selected_tools is None:
|
|
128
|
+
selected_tools = cls.AVAILABLE_TOOLS
|
|
129
|
+
else:
|
|
130
|
+
selected_tools = [t for t in selected_tools if t in cls.AVAILABLE_TOOLS]
|
|
131
|
+
if not selected_tools:
|
|
132
|
+
selected_tools = cls.AVAILABLE_TOOLS
|
|
133
|
+
|
|
134
|
+
# Create API wrapper
|
|
135
|
+
api_wrapper = InventoryRetrievalApiWrapper(
|
|
136
|
+
graph_path=graph_path or kwargs.get('graph_path', ''),
|
|
137
|
+
base_directory=base_directory or kwargs.get('base_directory'),
|
|
138
|
+
source_toolkits=source_toolkits or kwargs.get('source_toolkits', {}),
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
# Get available tools from wrapper
|
|
142
|
+
available_tools = api_wrapper.get_available_tools()
|
|
143
|
+
|
|
144
|
+
# Build tool mapping
|
|
145
|
+
tool_map = {t['name']: t for t in available_tools}
|
|
146
|
+
|
|
147
|
+
# Use clean toolkit name for context (max 1000 chars in description)
|
|
148
|
+
toolkit_context = f" [Toolkit: {clean_string(toolkit_name, 0)}]" if toolkit_name else ''
|
|
149
|
+
|
|
150
|
+
tools = []
|
|
151
|
+
for tool_name in selected_tools:
|
|
152
|
+
if tool_name in tool_map:
|
|
153
|
+
tool_info = tool_map[tool_name]
|
|
154
|
+
# Add toolkit context to description with character limit
|
|
155
|
+
description = tool_info['description']
|
|
156
|
+
if toolkit_context and len(description + toolkit_context) <= 1000:
|
|
157
|
+
description = description + toolkit_context
|
|
158
|
+
tools.append(BaseAction(
|
|
159
|
+
api_wrapper=api_wrapper,
|
|
160
|
+
name=tool_name,
|
|
161
|
+
description=description,
|
|
162
|
+
args_schema=tool_info['args_schema']
|
|
163
|
+
))
|
|
164
|
+
|
|
165
|
+
return cls(tools=tools)
|
|
166
|
+
|
|
167
|
+
def get_tools(self) -> List[BaseTool]:
|
|
168
|
+
"""Return list of tools in this toolkit."""
|
|
169
|
+
return self.tools
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
# Keep backward compatibility alias
|
|
173
|
+
InventoryToolkit = InventoryRetrievalToolkit
|