alita-sdk 0.3.257__py3-none-any.whl → 0.3.562__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 +1073 -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 +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 +11 -0
- alita_sdk/configurations/ado.py +148 -2
- alita_sdk/configurations/azure_search.py +1 -1
- alita_sdk/configurations/bigquery.py +1 -1
- alita_sdk/configurations/bitbucket.py +94 -2
- alita_sdk/configurations/browser.py +18 -0
- alita_sdk/configurations/carrier.py +19 -0
- alita_sdk/configurations/confluence.py +130 -1
- alita_sdk/configurations/delta_lake.py +1 -1
- alita_sdk/configurations/figma.py +76 -5
- alita_sdk/configurations/github.py +65 -1
- alita_sdk/configurations/gitlab.py +81 -0
- alita_sdk/configurations/google_places.py +17 -0
- alita_sdk/configurations/jira.py +103 -0
- alita_sdk/configurations/openapi.py +111 -0
- alita_sdk/configurations/postman.py +1 -1
- alita_sdk/configurations/qtest.py +72 -3
- alita_sdk/configurations/report_portal.py +115 -0
- alita_sdk/configurations/salesforce.py +19 -0
- alita_sdk/configurations/service_now.py +1 -12
- alita_sdk/configurations/sharepoint.py +167 -0
- alita_sdk/configurations/sonar.py +18 -0
- alita_sdk/configurations/sql.py +20 -0
- alita_sdk/configurations/testio.py +101 -0
- alita_sdk/configurations/testrail.py +88 -0
- alita_sdk/configurations/xray.py +94 -1
- alita_sdk/configurations/zephyr_enterprise.py +94 -1
- alita_sdk/configurations/zephyr_essential.py +95 -0
- alita_sdk/runtime/clients/artifact.py +21 -4
- alita_sdk/runtime/clients/client.py +458 -67
- 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 +352 -0
- alita_sdk/runtime/langchain/_constants_bkup.py +1318 -0
- alita_sdk/runtime/langchain/assistant.py +183 -43
- 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 +209 -31
- alita_sdk/runtime/langchain/document_loaders/AlitaImageLoader.py +1 -1
- alita_sdk/runtime/langchain/document_loaders/AlitaJSONLinesLoader.py +77 -0
- alita_sdk/runtime/langchain/document_loaders/AlitaJSONLoader.py +10 -3
- alita_sdk/runtime/langchain/document_loaders/AlitaMarkdownLoader.py +66 -0
- alita_sdk/runtime/langchain/document_loaders/AlitaPDFLoader.py +79 -10
- alita_sdk/runtime/langchain/document_loaders/AlitaPowerPointLoader.py +52 -15
- alita_sdk/runtime/langchain/document_loaders/AlitaPythonLoader.py +9 -0
- alita_sdk/runtime/langchain/document_loaders/AlitaTableLoader.py +1 -4
- alita_sdk/runtime/langchain/document_loaders/AlitaTextLoader.py +15 -2
- alita_sdk/runtime/langchain/document_loaders/ImageParser.py +30 -0
- alita_sdk/runtime/langchain/document_loaders/constants.py +189 -41
- alita_sdk/runtime/langchain/interfaces/llm_processor.py +4 -2
- alita_sdk/runtime/langchain/langraph_agent.py +407 -92
- alita_sdk/runtime/langchain/utils.py +102 -8
- 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 +28 -0
- alita_sdk/runtime/toolkits/application.py +14 -4
- alita_sdk/runtime/toolkits/artifact.py +24 -9
- 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/skill_router.py +238 -0
- alita_sdk/runtime/toolkits/subgraph.py +11 -6
- alita_sdk/runtime/toolkits/tools.py +314 -70
- alita_sdk/runtime/toolkits/vectorstore.py +11 -5
- alita_sdk/runtime/tools/__init__.py +24 -0
- alita_sdk/runtime/tools/application.py +16 -4
- alita_sdk/runtime/tools/artifact.py +367 -33
- alita_sdk/runtime/tools/data_analysis.py +183 -0
- alita_sdk/runtime/tools/function.py +100 -4
- alita_sdk/runtime/tools/graph.py +81 -0
- alita_sdk/runtime/tools/image_generation.py +218 -0
- alita_sdk/runtime/tools/llm.py +1013 -177
- 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 +3 -1
- 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 +375 -0
- alita_sdk/runtime/tools/skill_router.py +776 -0
- alita_sdk/runtime/tools/tool.py +3 -1
- alita_sdk/runtime/tools/vectorstore.py +69 -65
- alita_sdk/runtime/tools/vectorstore_base.py +163 -90
- alita_sdk/runtime/utils/AlitaCallback.py +137 -21
- 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/streamlit.py +41 -14
- alita_sdk/runtime/utils/toolkit_utils.py +28 -9
- alita_sdk/runtime/utils/utils.py +48 -0
- alita_sdk/tools/__init__.py +135 -37
- alita_sdk/tools/ado/__init__.py +2 -2
- alita_sdk/tools/ado/repos/__init__.py +15 -19
- alita_sdk/tools/ado/repos/repos_wrapper.py +12 -20
- alita_sdk/tools/ado/test_plan/__init__.py +26 -8
- alita_sdk/tools/ado/test_plan/test_plan_wrapper.py +56 -28
- alita_sdk/tools/ado/wiki/__init__.py +27 -12
- alita_sdk/tools/ado/wiki/ado_wrapper.py +114 -40
- alita_sdk/tools/ado/work_item/__init__.py +27 -12
- alita_sdk/tools/ado/work_item/ado_wrapper.py +95 -11
- alita_sdk/tools/advanced_jira_mining/__init__.py +12 -8
- alita_sdk/tools/aws/delta_lake/__init__.py +14 -11
- alita_sdk/tools/aws/delta_lake/tool.py +5 -1
- alita_sdk/tools/azure_ai/search/__init__.py +13 -8
- alita_sdk/tools/base/tool.py +5 -1
- alita_sdk/tools/base_indexer_toolkit.py +454 -110
- alita_sdk/tools/bitbucket/__init__.py +27 -19
- alita_sdk/tools/bitbucket/api_wrapper.py +285 -27
- alita_sdk/tools/bitbucket/cloud_api_wrapper.py +5 -5
- alita_sdk/tools/browser/__init__.py +41 -16
- alita_sdk/tools/browser/crawler.py +3 -1
- alita_sdk/tools/browser/utils.py +15 -6
- alita_sdk/tools/carrier/__init__.py +18 -17
- alita_sdk/tools/carrier/backend_reports_tool.py +8 -4
- alita_sdk/tools/carrier/excel_reporter.py +8 -4
- alita_sdk/tools/chunkers/__init__.py +3 -1
- alita_sdk/tools/chunkers/code/codeparser.py +1 -1
- alita_sdk/tools/chunkers/sematic/json_chunker.py +2 -1
- 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 +11 -7
- alita_sdk/tools/cloud/azure/__init__.py +11 -7
- alita_sdk/tools/cloud/gcp/__init__.py +11 -7
- alita_sdk/tools/cloud/k8s/__init__.py +11 -7
- alita_sdk/tools/code/linter/__init__.py +9 -8
- alita_sdk/tools/code/loaders/codesearcher.py +3 -2
- alita_sdk/tools/code/sonar/__init__.py +20 -13
- alita_sdk/tools/code_indexer_toolkit.py +199 -0
- alita_sdk/tools/confluence/__init__.py +21 -14
- alita_sdk/tools/confluence/api_wrapper.py +197 -58
- alita_sdk/tools/confluence/loader.py +14 -2
- alita_sdk/tools/custom_open_api/__init__.py +11 -5
- alita_sdk/tools/elastic/__init__.py +10 -8
- alita_sdk/tools/elitea_base.py +546 -64
- alita_sdk/tools/figma/__init__.py +11 -8
- alita_sdk/tools/figma/api_wrapper.py +352 -153
- alita_sdk/tools/github/__init__.py +17 -17
- alita_sdk/tools/github/api_wrapper.py +9 -26
- alita_sdk/tools/github/github_client.py +81 -12
- alita_sdk/tools/github/schemas.py +2 -1
- alita_sdk/tools/github/tool.py +5 -1
- alita_sdk/tools/gitlab/__init__.py +18 -13
- alita_sdk/tools/gitlab/api_wrapper.py +224 -80
- alita_sdk/tools/gitlab_org/__init__.py +13 -10
- alita_sdk/tools/google/bigquery/__init__.py +13 -13
- alita_sdk/tools/google/bigquery/tool.py +5 -1
- alita_sdk/tools/google_places/__init__.py +20 -11
- alita_sdk/tools/jira/__init__.py +21 -11
- alita_sdk/tools/jira/api_wrapper.py +315 -168
- alita_sdk/tools/keycloak/__init__.py +10 -8
- alita_sdk/tools/localgit/__init__.py +8 -3
- alita_sdk/tools/localgit/local_git.py +62 -54
- alita_sdk/tools/localgit/tool.py +5 -1
- alita_sdk/tools/memory/__init__.py +38 -14
- alita_sdk/tools/non_code_indexer_toolkit.py +7 -2
- alita_sdk/tools/ocr/__init__.py +10 -8
- alita_sdk/tools/openapi/__init__.py +281 -108
- alita_sdk/tools/openapi/api_wrapper.py +883 -0
- alita_sdk/tools/openapi/tool.py +20 -0
- alita_sdk/tools/pandas/__init__.py +18 -11
- alita_sdk/tools/pandas/api_wrapper.py +40 -45
- alita_sdk/tools/pandas/dataframe/generator/base.py +3 -1
- alita_sdk/tools/postman/__init__.py +10 -11
- alita_sdk/tools/postman/api_wrapper.py +19 -8
- alita_sdk/tools/postman/postman_analysis.py +8 -1
- alita_sdk/tools/pptx/__init__.py +10 -10
- alita_sdk/tools/qtest/__init__.py +21 -14
- alita_sdk/tools/qtest/api_wrapper.py +1784 -88
- alita_sdk/tools/rally/__init__.py +12 -10
- alita_sdk/tools/report_portal/__init__.py +22 -16
- alita_sdk/tools/salesforce/__init__.py +21 -16
- alita_sdk/tools/servicenow/__init__.py +20 -16
- alita_sdk/tools/servicenow/api_wrapper.py +1 -1
- alita_sdk/tools/sharepoint/__init__.py +16 -14
- alita_sdk/tools/sharepoint/api_wrapper.py +179 -39
- alita_sdk/tools/sharepoint/authorization_helper.py +191 -1
- alita_sdk/tools/sharepoint/utils.py +8 -2
- alita_sdk/tools/slack/__init__.py +11 -7
- alita_sdk/tools/sql/__init__.py +21 -19
- alita_sdk/tools/sql/api_wrapper.py +71 -23
- alita_sdk/tools/testio/__init__.py +20 -13
- alita_sdk/tools/testrail/__init__.py +12 -11
- alita_sdk/tools/testrail/api_wrapper.py +214 -46
- alita_sdk/tools/utils/__init__.py +28 -4
- alita_sdk/tools/utils/content_parser.py +182 -62
- alita_sdk/tools/utils/text_operations.py +254 -0
- alita_sdk/tools/vector_adapters/VectorStoreAdapter.py +83 -27
- alita_sdk/tools/xray/__init__.py +17 -14
- alita_sdk/tools/xray/api_wrapper.py +58 -113
- alita_sdk/tools/yagmail/__init__.py +8 -3
- alita_sdk/tools/zephyr/__init__.py +11 -7
- alita_sdk/tools/zephyr_enterprise/__init__.py +15 -9
- alita_sdk/tools/zephyr_enterprise/api_wrapper.py +30 -15
- alita_sdk/tools/zephyr_essential/__init__.py +15 -10
- alita_sdk/tools/zephyr_essential/api_wrapper.py +297 -54
- alita_sdk/tools/zephyr_essential/client.py +6 -4
- alita_sdk/tools/zephyr_scale/__init__.py +12 -8
- alita_sdk/tools/zephyr_scale/api_wrapper.py +39 -31
- alita_sdk/tools/zephyr_squad/__init__.py +11 -7
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.562.dist-info}/METADATA +184 -37
- alita_sdk-0.3.562.dist-info/RECORD +450 -0
- alita_sdk-0.3.562.dist-info/entry_points.txt +2 -0
- alita_sdk/tools/bitbucket/tools.py +0 -304
- alita_sdk-0.3.257.dist-info/RECORD +0 -343
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.562.dist-info}/WHEEL +0 -0
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.562.dist-info}/licenses/LICENSE +0 -0
- {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.562.dist-info}/top_level.txt +0 -0
|
@@ -2,6 +2,8 @@ from abc import ABC, abstractmethod
|
|
|
2
2
|
from typing import Any, Dict, Optional, List
|
|
3
3
|
from logging import getLogger
|
|
4
4
|
|
|
5
|
+
from ...runtime.utils.utils import IndexerKeywords
|
|
6
|
+
|
|
5
7
|
logger = getLogger(__name__)
|
|
6
8
|
|
|
7
9
|
|
|
@@ -24,13 +26,13 @@ class VectorStoreAdapter(ABC):
|
|
|
24
26
|
pass
|
|
25
27
|
|
|
26
28
|
@abstractmethod
|
|
27
|
-
def get_indexed_ids(self, vectorstore_wrapper,
|
|
29
|
+
def get_indexed_ids(self, vectorstore_wrapper, index_name: Optional[str] = '') -> List[str]:
|
|
28
30
|
"""Get all indexed document IDs from vectorstore"""
|
|
29
31
|
pass
|
|
30
32
|
|
|
31
33
|
@abstractmethod
|
|
32
|
-
def clean_collection(self, vectorstore_wrapper,
|
|
33
|
-
"""Clean the vectorstore collection by deleting all indexed data."""
|
|
34
|
+
def clean_collection(self, vectorstore_wrapper, index_name: str = '', including_index_meta: bool = False):
|
|
35
|
+
"""Clean the vectorstore collection by deleting all indexed data. If including_index_meta is True, skip the index_meta records."""
|
|
34
36
|
pass
|
|
35
37
|
|
|
36
38
|
@abstractmethod
|
|
@@ -39,7 +41,7 @@ class VectorStoreAdapter(ABC):
|
|
|
39
41
|
pass
|
|
40
42
|
|
|
41
43
|
@abstractmethod
|
|
42
|
-
def get_code_indexed_data(self, vectorstore_wrapper,
|
|
44
|
+
def get_code_indexed_data(self, vectorstore_wrapper, index_name) -> Dict[str, Dict[str, Any]]:
|
|
43
45
|
"""Get all indexed data from vectorstore for code content"""
|
|
44
46
|
pass
|
|
45
47
|
|
|
@@ -48,15 +50,26 @@ class VectorStoreAdapter(ABC):
|
|
|
48
50
|
"""Add a new collection name to the metadata"""
|
|
49
51
|
pass
|
|
50
52
|
|
|
53
|
+
@abstractmethod
|
|
54
|
+
def get_index_meta(self, vectorstore_wrapper, index_name: str) -> List[Dict[str, Any]]:
|
|
55
|
+
"""Get all index_meta entries from the vector store."""
|
|
56
|
+
pass
|
|
57
|
+
|
|
51
58
|
|
|
52
59
|
class PGVectorAdapter(VectorStoreAdapter):
|
|
53
60
|
"""Adapter for PGVector database operations."""
|
|
54
61
|
|
|
55
62
|
def get_vectorstore_params(self, collection_name: str, connection_string: Optional[str] = None) -> Dict[str, Any]:
|
|
63
|
+
try:
|
|
64
|
+
from tools import this # pylint: disable=E0401,C0415
|
|
65
|
+
worker_config = this.for_module("indexer_worker").descriptor.config
|
|
66
|
+
except: # pylint: disable=W0702
|
|
67
|
+
worker_config = {}
|
|
68
|
+
#
|
|
56
69
|
return {
|
|
57
70
|
"use_jsonb": True,
|
|
58
71
|
"collection_name": collection_name,
|
|
59
|
-
"create_extension": True,
|
|
72
|
+
"create_extension": worker_config.get("pgvector_create_extension", True),
|
|
60
73
|
"alita_sdk_options": {
|
|
61
74
|
"target_schema": collection_name,
|
|
62
75
|
},
|
|
@@ -93,20 +106,25 @@ class PGVectorAdapter(VectorStoreAdapter):
|
|
|
93
106
|
session.commit()
|
|
94
107
|
logger.info(f"Schema '{schema_name}' has been dropped.")
|
|
95
108
|
|
|
96
|
-
def get_indexed_ids(self, vectorstore_wrapper,
|
|
109
|
+
def get_indexed_ids(self, vectorstore_wrapper, index_name: Optional[str] = '') -> List[str]:
|
|
97
110
|
"""Get all indexed document IDs from PGVector"""
|
|
98
111
|
from sqlalchemy.orm import Session
|
|
99
|
-
from sqlalchemy import func
|
|
112
|
+
from sqlalchemy import func, or_
|
|
100
113
|
|
|
101
114
|
store = vectorstore_wrapper.vectorstore
|
|
102
115
|
try:
|
|
103
116
|
with Session(store.session_maker.bind) as session:
|
|
104
117
|
# Start building the query
|
|
105
118
|
query = session.query(store.EmbeddingStore.id)
|
|
106
|
-
# Apply filter only if
|
|
107
|
-
if
|
|
119
|
+
# Apply filter only if index_name is provided
|
|
120
|
+
if index_name:
|
|
108
121
|
query = query.filter(
|
|
109
|
-
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'collection') ==
|
|
122
|
+
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'collection') == index_name,
|
|
123
|
+
or_(
|
|
124
|
+
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'type').is_(None),
|
|
125
|
+
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata,
|
|
126
|
+
'type') != IndexerKeywords.INDEX_META_TYPE.value
|
|
127
|
+
)
|
|
110
128
|
)
|
|
111
129
|
ids = query.all()
|
|
112
130
|
return [str(id_tuple[0]) for id_tuple in ids]
|
|
@@ -114,25 +132,37 @@ class PGVectorAdapter(VectorStoreAdapter):
|
|
|
114
132
|
logger.error(f"Failed to get indexed IDs from PGVector: {str(e)}")
|
|
115
133
|
return []
|
|
116
134
|
|
|
117
|
-
def clean_collection(self, vectorstore_wrapper,
|
|
118
|
-
"""Clean the vectorstore collection by deleting all indexed data."""
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
vectorstore_wrapper.vectorstore
|
|
135
|
+
def clean_collection(self, vectorstore_wrapper, index_name: str = '', including_index_meta: bool = False):
|
|
136
|
+
"""Clean the vectorstore collection by deleting all indexed data. If including_index_meta is True, skip the index_meta records."""
|
|
137
|
+
from sqlalchemy.orm import Session
|
|
138
|
+
from sqlalchemy import func, or_
|
|
139
|
+
store = vectorstore_wrapper.vectorstore
|
|
140
|
+
with Session(store.session_maker.bind) as session:
|
|
141
|
+
if including_index_meta:
|
|
142
|
+
session.query(store.EmbeddingStore).filter(
|
|
143
|
+
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'collection') == index_name
|
|
144
|
+
).delete(synchronize_session=False)
|
|
145
|
+
else:
|
|
146
|
+
session.query(store.EmbeddingStore).filter(
|
|
147
|
+
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'collection') == index_name,
|
|
148
|
+
or_(func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'type').is_(None),
|
|
149
|
+
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'type') != IndexerKeywords.INDEX_META_TYPE.value)
|
|
150
|
+
).delete(synchronize_session=False)
|
|
151
|
+
session.commit()
|
|
122
152
|
|
|
123
153
|
def is_vectorstore_type(self, vectorstore) -> bool:
|
|
124
154
|
"""Check if the vectorstore is a PGVector store."""
|
|
125
155
|
return hasattr(vectorstore, 'session_maker') and hasattr(vectorstore, 'EmbeddingStore')
|
|
126
156
|
|
|
127
|
-
def get_indexed_data(self, vectorstore_wrapper,
|
|
128
|
-
"""Get all indexed data from PGVector for non-code content per
|
|
157
|
+
def get_indexed_data(self, vectorstore_wrapper, index_name: str)-> Dict[str, Dict[str, Any]]:
|
|
158
|
+
"""Get all indexed data from PGVector for non-code content per index_name."""
|
|
129
159
|
from sqlalchemy.orm import Session
|
|
130
160
|
from sqlalchemy import func
|
|
131
161
|
from ...runtime.utils.utils import IndexerKeywords
|
|
132
162
|
|
|
133
163
|
result = {}
|
|
134
164
|
try:
|
|
135
|
-
vectorstore_wrapper.
|
|
165
|
+
vectorstore_wrapper._log_tool_event("Retrieving already indexed data from PGVector vectorstore",
|
|
136
166
|
tool_name="get_indexed_data")
|
|
137
167
|
store = vectorstore_wrapper.vectorstore
|
|
138
168
|
with Session(store.session_maker.bind) as session:
|
|
@@ -141,7 +171,7 @@ class PGVectorAdapter(VectorStoreAdapter):
|
|
|
141
171
|
store.EmbeddingStore.document,
|
|
142
172
|
store.EmbeddingStore.cmetadata
|
|
143
173
|
).filter(
|
|
144
|
-
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'collection') ==
|
|
174
|
+
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'collection') == index_name
|
|
145
175
|
).all()
|
|
146
176
|
|
|
147
177
|
# Process the retrieved data
|
|
@@ -174,14 +204,14 @@ class PGVectorAdapter(VectorStoreAdapter):
|
|
|
174
204
|
|
|
175
205
|
return result
|
|
176
206
|
|
|
177
|
-
def get_code_indexed_data(self, vectorstore_wrapper,
|
|
207
|
+
def get_code_indexed_data(self, vectorstore_wrapper, index_name: str) -> Dict[str, Dict[str, Any]]:
|
|
178
208
|
"""Get all indexed code data from PGVector per collection suffix."""
|
|
179
209
|
from sqlalchemy.orm import Session
|
|
180
210
|
from sqlalchemy import func
|
|
181
211
|
|
|
182
212
|
result = {}
|
|
183
213
|
try:
|
|
184
|
-
vectorstore_wrapper.
|
|
214
|
+
vectorstore_wrapper._log_tool_event(message="Retrieving already indexed code data from PGVector vectorstore",
|
|
185
215
|
tool_name="index_code_data")
|
|
186
216
|
store = vectorstore_wrapper.vectorstore
|
|
187
217
|
with (Session(store.session_maker.bind) as session):
|
|
@@ -189,7 +219,7 @@ class PGVectorAdapter(VectorStoreAdapter):
|
|
|
189
219
|
store.EmbeddingStore.id,
|
|
190
220
|
store.EmbeddingStore.cmetadata
|
|
191
221
|
).filter(
|
|
192
|
-
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'collection') ==
|
|
222
|
+
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'collection') == index_name
|
|
193
223
|
).all()
|
|
194
224
|
|
|
195
225
|
for db_id, meta in docs:
|
|
@@ -259,6 +289,29 @@ class PGVectorAdapter(VectorStoreAdapter):
|
|
|
259
289
|
except Exception as e:
|
|
260
290
|
logger.error(f"Failed to update collection for entry ID {entry_id}: {str(e)}")
|
|
261
291
|
|
|
292
|
+
def get_index_meta(self, vectorstore_wrapper, index_name: str) -> List[Dict[str, Any]]:
|
|
293
|
+
from sqlalchemy.orm import Session
|
|
294
|
+
from sqlalchemy import func
|
|
295
|
+
|
|
296
|
+
store = vectorstore_wrapper.vectorstore
|
|
297
|
+
try:
|
|
298
|
+
with Session(store.session_maker.bind) as session:
|
|
299
|
+
meta = session.query(
|
|
300
|
+
store.EmbeddingStore.id,
|
|
301
|
+
store.EmbeddingStore.document,
|
|
302
|
+
store.EmbeddingStore.cmetadata
|
|
303
|
+
).filter(
|
|
304
|
+
store.EmbeddingStore.cmetadata['type'].astext == IndexerKeywords.INDEX_META_TYPE.value,
|
|
305
|
+
func.jsonb_extract_path_text(store.EmbeddingStore.cmetadata, 'collection') == index_name
|
|
306
|
+
).all()
|
|
307
|
+
result = []
|
|
308
|
+
for id, document, cmetadata in meta:
|
|
309
|
+
result.append({"id": id, "content": document, "metadata": cmetadata})
|
|
310
|
+
return result
|
|
311
|
+
except Exception as e:
|
|
312
|
+
logger.error(f"Failed to get index_meta from PGVector: {str(e)}")
|
|
313
|
+
raise e
|
|
314
|
+
|
|
262
315
|
|
|
263
316
|
class ChromaAdapter(VectorStoreAdapter):
|
|
264
317
|
"""Adapter for Chroma database operations."""
|
|
@@ -276,7 +329,7 @@ class ChromaAdapter(VectorStoreAdapter):
|
|
|
276
329
|
def remove_collection(self, vectorstore_wrapper, collection_name: str):
|
|
277
330
|
vectorstore_wrapper.vectorstore.delete_collection()
|
|
278
331
|
|
|
279
|
-
def get_indexed_ids(self, vectorstore_wrapper,
|
|
332
|
+
def get_indexed_ids(self, vectorstore_wrapper, index_name: Optional[str] = '') -> List[str]:
|
|
280
333
|
"""Get all indexed document IDs from Chroma"""
|
|
281
334
|
try:
|
|
282
335
|
data = vectorstore_wrapper.vectorstore.get(include=[]) # Only get IDs, no metadata
|
|
@@ -285,9 +338,9 @@ class ChromaAdapter(VectorStoreAdapter):
|
|
|
285
338
|
logger.error(f"Failed to get indexed IDs from Chroma: {str(e)}")
|
|
286
339
|
return []
|
|
287
340
|
|
|
288
|
-
def clean_collection(self, vectorstore_wrapper,
|
|
289
|
-
"""Clean the vectorstore collection by deleting all indexed data."""
|
|
290
|
-
vectorstore_wrapper.vectorstore.delete(ids=self.get_indexed_ids(vectorstore_wrapper,
|
|
341
|
+
def clean_collection(self, vectorstore_wrapper, index_name: str = '', including_index_meta: bool = False):
|
|
342
|
+
"""Clean the vectorstore collection by deleting all indexed data. including_index_meta is ignored."""
|
|
343
|
+
vectorstore_wrapper.vectorstore.delete(ids=self.get_indexed_ids(vectorstore_wrapper, index_name))
|
|
291
344
|
|
|
292
345
|
def get_indexed_data(self, vectorstore_wrapper):
|
|
293
346
|
"""Get all indexed data from Chroma for non-code content"""
|
|
@@ -325,7 +378,7 @@ class ChromaAdapter(VectorStoreAdapter):
|
|
|
325
378
|
|
|
326
379
|
return result
|
|
327
380
|
|
|
328
|
-
def get_code_indexed_data(self, vectorstore_wrapper,
|
|
381
|
+
def get_code_indexed_data(self, vectorstore_wrapper, index_name) -> Dict[str, Dict[str, Any]]:
|
|
329
382
|
"""Get all indexed code data from Chroma."""
|
|
330
383
|
result = {}
|
|
331
384
|
try:
|
|
@@ -355,6 +408,9 @@ class ChromaAdapter(VectorStoreAdapter):
|
|
|
355
408
|
# This is a simplified implementation - in practice, you might need more complex logic
|
|
356
409
|
logger.warning("add_to_collection for Chroma is not fully implemented yet")
|
|
357
410
|
|
|
411
|
+
def get_index_meta(self, vectorstore_wrapper, index_name: str) -> List[Dict[str, Any]]:
|
|
412
|
+
logger.warning("get_index_meta for Chroma is not implemented yet")
|
|
413
|
+
|
|
358
414
|
|
|
359
415
|
class VectorStoreAdapterFactory:
|
|
360
416
|
"""Factory for creating vector store adapters."""
|
alita_sdk/tools/xray/__init__.py
CHANGED
|
@@ -7,7 +7,8 @@ from pydantic import create_model, BaseModel, Field
|
|
|
7
7
|
|
|
8
8
|
from .api_wrapper import XrayApiWrapper
|
|
9
9
|
from ..base.tool import BaseAction
|
|
10
|
-
from ..
|
|
10
|
+
from ..elitea_base import filter_missconfigured_index_tools
|
|
11
|
+
from ..utils import clean_string, get_max_toolkit_length
|
|
11
12
|
from ...configurations.pgvector import PgVectorConfiguration
|
|
12
13
|
from ...configurations.xray import XrayConfiguration
|
|
13
14
|
|
|
@@ -17,34 +18,30 @@ name = "xray_cloud"
|
|
|
17
18
|
def get_tools(tool):
|
|
18
19
|
return XrayToolkit().get_toolkit(
|
|
19
20
|
selected_tools=tool['settings'].get('selected_tools', []),
|
|
20
|
-
|
|
21
|
-
client_id=tool['settings'].get('client_id', None),
|
|
22
|
-
client_secret=tool['settings'].get('client_secret', None),
|
|
21
|
+
xray_configuration=tool['settings'].get('xray_configuration', {}),
|
|
23
22
|
limit=tool['settings'].get('limit', 20),
|
|
24
23
|
verify_ssl=tool['settings'].get('verify_ssl', True),
|
|
25
24
|
toolkit_name=tool.get('toolkit_name'),
|
|
25
|
+
llm=tool['settings'].get('llm', None),
|
|
26
26
|
alita=tool['settings'].get('alita', None),
|
|
27
27
|
|
|
28
28
|
# indexer settings
|
|
29
29
|
pgvector_configuration=tool['settings'].get('pgvector_configuration', {}),
|
|
30
30
|
embedding_model=tool['settings'].get('embedding_model'),
|
|
31
31
|
collection_name=str(tool['toolkit_name']),
|
|
32
|
-
vectorstore_type="PGVector"
|
|
33
32
|
).get_tools()
|
|
34
33
|
|
|
35
34
|
|
|
36
35
|
class XrayToolkit(BaseToolkit):
|
|
37
36
|
tools: List[BaseTool] = []
|
|
38
|
-
toolkit_max_length: int = 0
|
|
39
37
|
|
|
40
38
|
@staticmethod
|
|
41
39
|
def toolkit_config_schema() -> BaseModel:
|
|
42
40
|
selected_tools = {x['name']: x['args_schema'].schema() for x in XrayApiWrapper.model_construct().get_available_tools()}
|
|
43
|
-
XrayToolkit.toolkit_max_length = get_max_toolkit_length(selected_tools)
|
|
44
41
|
return create_model(
|
|
45
42
|
name,
|
|
46
43
|
limit=(Optional[int], Field(description="Limit", default=100)),
|
|
47
|
-
xray_configuration=(
|
|
44
|
+
xray_configuration=(XrayConfiguration, Field(description="Xray Configuration", json_schema_extra={'configuration_types': ['xray']})),
|
|
48
45
|
pgvector_configuration=(Optional[PgVectorConfiguration], Field(default=None,
|
|
49
46
|
description="PgVector Configuration",
|
|
50
47
|
json_schema_extra={
|
|
@@ -57,7 +54,7 @@ class XrayToolkit(BaseToolkit):
|
|
|
57
54
|
{
|
|
58
55
|
'metadata': {
|
|
59
56
|
"label": "XRAY cloud", "icon_url": "xray.svg",
|
|
60
|
-
|
|
57
|
+
"categories": ["test management"],
|
|
61
58
|
"extra_categories": ["test automation", "test case management", "test planning"]
|
|
62
59
|
}
|
|
63
60
|
}
|
|
@@ -65,28 +62,34 @@ class XrayToolkit(BaseToolkit):
|
|
|
65
62
|
)
|
|
66
63
|
|
|
67
64
|
@classmethod
|
|
65
|
+
@filter_missconfigured_index_tools
|
|
68
66
|
def get_toolkit(cls, selected_tools: list[str] | None = None, toolkit_name: Optional[str] = None, **kwargs):
|
|
69
67
|
if selected_tools is None:
|
|
70
68
|
selected_tools = []
|
|
71
69
|
wrapper_payload = {
|
|
72
70
|
**kwargs,
|
|
73
71
|
# Use xray_configuration fields
|
|
74
|
-
**kwargs.get('xray_configuration'
|
|
72
|
+
**(kwargs.get('xray_configuration') or {}),
|
|
75
73
|
**(kwargs.get('pgvector_configuration') or {}),
|
|
76
74
|
}
|
|
77
75
|
xray_api_wrapper = XrayApiWrapper(**wrapper_payload)
|
|
78
|
-
prefix = clean_string(toolkit_name, cls.toolkit_max_length) + TOOLKIT_SPLITTER if toolkit_name else ''
|
|
79
76
|
available_tools = xray_api_wrapper.get_available_tools()
|
|
80
77
|
tools = []
|
|
81
78
|
for tool in available_tools:
|
|
82
79
|
if selected_tools:
|
|
83
80
|
if tool["name"] not in selected_tools:
|
|
84
81
|
continue
|
|
82
|
+
description = tool["description"]
|
|
83
|
+
if toolkit_name:
|
|
84
|
+
description = f"Toolkit: {toolkit_name}\n{description}"
|
|
85
|
+
description = description + "\nXray instance: " + xray_api_wrapper.base_url
|
|
86
|
+
description = description[:1000]
|
|
85
87
|
tools.append(BaseAction(
|
|
86
88
|
api_wrapper=xray_api_wrapper,
|
|
87
|
-
name=
|
|
88
|
-
description=
|
|
89
|
-
args_schema=tool["args_schema"]
|
|
89
|
+
name=tool["name"],
|
|
90
|
+
description=description,
|
|
91
|
+
args_schema=tool["args_schema"],
|
|
92
|
+
metadata={"toolkit_name": toolkit_name} if toolkit_name else {}
|
|
90
93
|
))
|
|
91
94
|
return cls(tools=tools)
|
|
92
95
|
|