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.
Files changed (278) hide show
  1. alita_sdk/cli/__init__.py +10 -0
  2. alita_sdk/cli/__main__.py +17 -0
  3. alita_sdk/cli/agent/__init__.py +5 -0
  4. alita_sdk/cli/agent/default.py +258 -0
  5. alita_sdk/cli/agent_executor.py +155 -0
  6. alita_sdk/cli/agent_loader.py +215 -0
  7. alita_sdk/cli/agent_ui.py +228 -0
  8. alita_sdk/cli/agents.py +3601 -0
  9. alita_sdk/cli/callbacks.py +647 -0
  10. alita_sdk/cli/cli.py +168 -0
  11. alita_sdk/cli/config.py +306 -0
  12. alita_sdk/cli/context/__init__.py +30 -0
  13. alita_sdk/cli/context/cleanup.py +198 -0
  14. alita_sdk/cli/context/manager.py +731 -0
  15. alita_sdk/cli/context/message.py +285 -0
  16. alita_sdk/cli/context/strategies.py +289 -0
  17. alita_sdk/cli/context/token_estimation.py +127 -0
  18. alita_sdk/cli/formatting.py +182 -0
  19. alita_sdk/cli/input_handler.py +419 -0
  20. alita_sdk/cli/inventory.py +1073 -0
  21. alita_sdk/cli/mcp_loader.py +315 -0
  22. alita_sdk/cli/toolkit.py +327 -0
  23. alita_sdk/cli/toolkit_loader.py +85 -0
  24. alita_sdk/cli/tools/__init__.py +43 -0
  25. alita_sdk/cli/tools/approval.py +224 -0
  26. alita_sdk/cli/tools/filesystem.py +1751 -0
  27. alita_sdk/cli/tools/planning.py +389 -0
  28. alita_sdk/cli/tools/terminal.py +414 -0
  29. alita_sdk/community/__init__.py +72 -12
  30. alita_sdk/community/inventory/__init__.py +236 -0
  31. alita_sdk/community/inventory/config.py +257 -0
  32. alita_sdk/community/inventory/enrichment.py +2137 -0
  33. alita_sdk/community/inventory/extractors.py +1469 -0
  34. alita_sdk/community/inventory/ingestion.py +3172 -0
  35. alita_sdk/community/inventory/knowledge_graph.py +1457 -0
  36. alita_sdk/community/inventory/parsers/__init__.py +218 -0
  37. alita_sdk/community/inventory/parsers/base.py +295 -0
  38. alita_sdk/community/inventory/parsers/csharp_parser.py +907 -0
  39. alita_sdk/community/inventory/parsers/go_parser.py +851 -0
  40. alita_sdk/community/inventory/parsers/html_parser.py +389 -0
  41. alita_sdk/community/inventory/parsers/java_parser.py +593 -0
  42. alita_sdk/community/inventory/parsers/javascript_parser.py +629 -0
  43. alita_sdk/community/inventory/parsers/kotlin_parser.py +768 -0
  44. alita_sdk/community/inventory/parsers/markdown_parser.py +362 -0
  45. alita_sdk/community/inventory/parsers/python_parser.py +604 -0
  46. alita_sdk/community/inventory/parsers/rust_parser.py +858 -0
  47. alita_sdk/community/inventory/parsers/swift_parser.py +832 -0
  48. alita_sdk/community/inventory/parsers/text_parser.py +322 -0
  49. alita_sdk/community/inventory/parsers/yaml_parser.py +370 -0
  50. alita_sdk/community/inventory/patterns/__init__.py +61 -0
  51. alita_sdk/community/inventory/patterns/ast_adapter.py +380 -0
  52. alita_sdk/community/inventory/patterns/loader.py +348 -0
  53. alita_sdk/community/inventory/patterns/registry.py +198 -0
  54. alita_sdk/community/inventory/presets.py +535 -0
  55. alita_sdk/community/inventory/retrieval.py +1403 -0
  56. alita_sdk/community/inventory/toolkit.py +173 -0
  57. alita_sdk/community/inventory/toolkit_utils.py +176 -0
  58. alita_sdk/community/inventory/visualize.py +1370 -0
  59. alita_sdk/configurations/__init__.py +11 -0
  60. alita_sdk/configurations/ado.py +148 -2
  61. alita_sdk/configurations/azure_search.py +1 -1
  62. alita_sdk/configurations/bigquery.py +1 -1
  63. alita_sdk/configurations/bitbucket.py +94 -2
  64. alita_sdk/configurations/browser.py +18 -0
  65. alita_sdk/configurations/carrier.py +19 -0
  66. alita_sdk/configurations/confluence.py +130 -1
  67. alita_sdk/configurations/delta_lake.py +1 -1
  68. alita_sdk/configurations/figma.py +76 -5
  69. alita_sdk/configurations/github.py +65 -1
  70. alita_sdk/configurations/gitlab.py +81 -0
  71. alita_sdk/configurations/google_places.py +17 -0
  72. alita_sdk/configurations/jira.py +103 -0
  73. alita_sdk/configurations/openapi.py +111 -0
  74. alita_sdk/configurations/postman.py +1 -1
  75. alita_sdk/configurations/qtest.py +72 -3
  76. alita_sdk/configurations/report_portal.py +115 -0
  77. alita_sdk/configurations/salesforce.py +19 -0
  78. alita_sdk/configurations/service_now.py +1 -12
  79. alita_sdk/configurations/sharepoint.py +167 -0
  80. alita_sdk/configurations/sonar.py +18 -0
  81. alita_sdk/configurations/sql.py +20 -0
  82. alita_sdk/configurations/testio.py +101 -0
  83. alita_sdk/configurations/testrail.py +88 -0
  84. alita_sdk/configurations/xray.py +94 -1
  85. alita_sdk/configurations/zephyr_enterprise.py +94 -1
  86. alita_sdk/configurations/zephyr_essential.py +95 -0
  87. alita_sdk/runtime/clients/artifact.py +21 -4
  88. alita_sdk/runtime/clients/client.py +458 -67
  89. alita_sdk/runtime/clients/mcp_discovery.py +342 -0
  90. alita_sdk/runtime/clients/mcp_manager.py +262 -0
  91. alita_sdk/runtime/clients/sandbox_client.py +352 -0
  92. alita_sdk/runtime/langchain/_constants_bkup.py +1318 -0
  93. alita_sdk/runtime/langchain/assistant.py +183 -43
  94. alita_sdk/runtime/langchain/constants.py +647 -1
  95. alita_sdk/runtime/langchain/document_loaders/AlitaDocxMammothLoader.py +315 -3
  96. alita_sdk/runtime/langchain/document_loaders/AlitaExcelLoader.py +209 -31
  97. alita_sdk/runtime/langchain/document_loaders/AlitaImageLoader.py +1 -1
  98. alita_sdk/runtime/langchain/document_loaders/AlitaJSONLinesLoader.py +77 -0
  99. alita_sdk/runtime/langchain/document_loaders/AlitaJSONLoader.py +10 -3
  100. alita_sdk/runtime/langchain/document_loaders/AlitaMarkdownLoader.py +66 -0
  101. alita_sdk/runtime/langchain/document_loaders/AlitaPDFLoader.py +79 -10
  102. alita_sdk/runtime/langchain/document_loaders/AlitaPowerPointLoader.py +52 -15
  103. alita_sdk/runtime/langchain/document_loaders/AlitaPythonLoader.py +9 -0
  104. alita_sdk/runtime/langchain/document_loaders/AlitaTableLoader.py +1 -4
  105. alita_sdk/runtime/langchain/document_loaders/AlitaTextLoader.py +15 -2
  106. alita_sdk/runtime/langchain/document_loaders/ImageParser.py +30 -0
  107. alita_sdk/runtime/langchain/document_loaders/constants.py +189 -41
  108. alita_sdk/runtime/langchain/interfaces/llm_processor.py +4 -2
  109. alita_sdk/runtime/langchain/langraph_agent.py +407 -92
  110. alita_sdk/runtime/langchain/utils.py +102 -8
  111. alita_sdk/runtime/llms/preloaded.py +2 -6
  112. alita_sdk/runtime/models/mcp_models.py +61 -0
  113. alita_sdk/runtime/skills/__init__.py +91 -0
  114. alita_sdk/runtime/skills/callbacks.py +498 -0
  115. alita_sdk/runtime/skills/discovery.py +540 -0
  116. alita_sdk/runtime/skills/executor.py +610 -0
  117. alita_sdk/runtime/skills/input_builder.py +371 -0
  118. alita_sdk/runtime/skills/models.py +330 -0
  119. alita_sdk/runtime/skills/registry.py +355 -0
  120. alita_sdk/runtime/skills/skill_runner.py +330 -0
  121. alita_sdk/runtime/toolkits/__init__.py +28 -0
  122. alita_sdk/runtime/toolkits/application.py +14 -4
  123. alita_sdk/runtime/toolkits/artifact.py +24 -9
  124. alita_sdk/runtime/toolkits/datasource.py +13 -6
  125. alita_sdk/runtime/toolkits/mcp.py +780 -0
  126. alita_sdk/runtime/toolkits/planning.py +178 -0
  127. alita_sdk/runtime/toolkits/skill_router.py +238 -0
  128. alita_sdk/runtime/toolkits/subgraph.py +11 -6
  129. alita_sdk/runtime/toolkits/tools.py +314 -70
  130. alita_sdk/runtime/toolkits/vectorstore.py +11 -5
  131. alita_sdk/runtime/tools/__init__.py +24 -0
  132. alita_sdk/runtime/tools/application.py +16 -4
  133. alita_sdk/runtime/tools/artifact.py +367 -33
  134. alita_sdk/runtime/tools/data_analysis.py +183 -0
  135. alita_sdk/runtime/tools/function.py +100 -4
  136. alita_sdk/runtime/tools/graph.py +81 -0
  137. alita_sdk/runtime/tools/image_generation.py +218 -0
  138. alita_sdk/runtime/tools/llm.py +1013 -177
  139. alita_sdk/runtime/tools/loop.py +3 -1
  140. alita_sdk/runtime/tools/loop_output.py +3 -1
  141. alita_sdk/runtime/tools/mcp_inspect_tool.py +284 -0
  142. alita_sdk/runtime/tools/mcp_remote_tool.py +181 -0
  143. alita_sdk/runtime/tools/mcp_server_tool.py +3 -1
  144. alita_sdk/runtime/tools/planning/__init__.py +36 -0
  145. alita_sdk/runtime/tools/planning/models.py +246 -0
  146. alita_sdk/runtime/tools/planning/wrapper.py +607 -0
  147. alita_sdk/runtime/tools/router.py +2 -1
  148. alita_sdk/runtime/tools/sandbox.py +375 -0
  149. alita_sdk/runtime/tools/skill_router.py +776 -0
  150. alita_sdk/runtime/tools/tool.py +3 -1
  151. alita_sdk/runtime/tools/vectorstore.py +69 -65
  152. alita_sdk/runtime/tools/vectorstore_base.py +163 -90
  153. alita_sdk/runtime/utils/AlitaCallback.py +137 -21
  154. alita_sdk/runtime/utils/mcp_client.py +492 -0
  155. alita_sdk/runtime/utils/mcp_oauth.py +361 -0
  156. alita_sdk/runtime/utils/mcp_sse_client.py +434 -0
  157. alita_sdk/runtime/utils/mcp_tools_discovery.py +124 -0
  158. alita_sdk/runtime/utils/streamlit.py +41 -14
  159. alita_sdk/runtime/utils/toolkit_utils.py +28 -9
  160. alita_sdk/runtime/utils/utils.py +48 -0
  161. alita_sdk/tools/__init__.py +135 -37
  162. alita_sdk/tools/ado/__init__.py +2 -2
  163. alita_sdk/tools/ado/repos/__init__.py +15 -19
  164. alita_sdk/tools/ado/repos/repos_wrapper.py +12 -20
  165. alita_sdk/tools/ado/test_plan/__init__.py +26 -8
  166. alita_sdk/tools/ado/test_plan/test_plan_wrapper.py +56 -28
  167. alita_sdk/tools/ado/wiki/__init__.py +27 -12
  168. alita_sdk/tools/ado/wiki/ado_wrapper.py +114 -40
  169. alita_sdk/tools/ado/work_item/__init__.py +27 -12
  170. alita_sdk/tools/ado/work_item/ado_wrapper.py +95 -11
  171. alita_sdk/tools/advanced_jira_mining/__init__.py +12 -8
  172. alita_sdk/tools/aws/delta_lake/__init__.py +14 -11
  173. alita_sdk/tools/aws/delta_lake/tool.py +5 -1
  174. alita_sdk/tools/azure_ai/search/__init__.py +13 -8
  175. alita_sdk/tools/base/tool.py +5 -1
  176. alita_sdk/tools/base_indexer_toolkit.py +454 -110
  177. alita_sdk/tools/bitbucket/__init__.py +27 -19
  178. alita_sdk/tools/bitbucket/api_wrapper.py +285 -27
  179. alita_sdk/tools/bitbucket/cloud_api_wrapper.py +5 -5
  180. alita_sdk/tools/browser/__init__.py +41 -16
  181. alita_sdk/tools/browser/crawler.py +3 -1
  182. alita_sdk/tools/browser/utils.py +15 -6
  183. alita_sdk/tools/carrier/__init__.py +18 -17
  184. alita_sdk/tools/carrier/backend_reports_tool.py +8 -4
  185. alita_sdk/tools/carrier/excel_reporter.py +8 -4
  186. alita_sdk/tools/chunkers/__init__.py +3 -1
  187. alita_sdk/tools/chunkers/code/codeparser.py +1 -1
  188. alita_sdk/tools/chunkers/sematic/json_chunker.py +2 -1
  189. alita_sdk/tools/chunkers/sematic/markdown_chunker.py +97 -6
  190. alita_sdk/tools/chunkers/sematic/proposal_chunker.py +1 -1
  191. alita_sdk/tools/chunkers/universal_chunker.py +270 -0
  192. alita_sdk/tools/cloud/aws/__init__.py +11 -7
  193. alita_sdk/tools/cloud/azure/__init__.py +11 -7
  194. alita_sdk/tools/cloud/gcp/__init__.py +11 -7
  195. alita_sdk/tools/cloud/k8s/__init__.py +11 -7
  196. alita_sdk/tools/code/linter/__init__.py +9 -8
  197. alita_sdk/tools/code/loaders/codesearcher.py +3 -2
  198. alita_sdk/tools/code/sonar/__init__.py +20 -13
  199. alita_sdk/tools/code_indexer_toolkit.py +199 -0
  200. alita_sdk/tools/confluence/__init__.py +21 -14
  201. alita_sdk/tools/confluence/api_wrapper.py +197 -58
  202. alita_sdk/tools/confluence/loader.py +14 -2
  203. alita_sdk/tools/custom_open_api/__init__.py +11 -5
  204. alita_sdk/tools/elastic/__init__.py +10 -8
  205. alita_sdk/tools/elitea_base.py +546 -64
  206. alita_sdk/tools/figma/__init__.py +11 -8
  207. alita_sdk/tools/figma/api_wrapper.py +352 -153
  208. alita_sdk/tools/github/__init__.py +17 -17
  209. alita_sdk/tools/github/api_wrapper.py +9 -26
  210. alita_sdk/tools/github/github_client.py +81 -12
  211. alita_sdk/tools/github/schemas.py +2 -1
  212. alita_sdk/tools/github/tool.py +5 -1
  213. alita_sdk/tools/gitlab/__init__.py +18 -13
  214. alita_sdk/tools/gitlab/api_wrapper.py +224 -80
  215. alita_sdk/tools/gitlab_org/__init__.py +13 -10
  216. alita_sdk/tools/google/bigquery/__init__.py +13 -13
  217. alita_sdk/tools/google/bigquery/tool.py +5 -1
  218. alita_sdk/tools/google_places/__init__.py +20 -11
  219. alita_sdk/tools/jira/__init__.py +21 -11
  220. alita_sdk/tools/jira/api_wrapper.py +315 -168
  221. alita_sdk/tools/keycloak/__init__.py +10 -8
  222. alita_sdk/tools/localgit/__init__.py +8 -3
  223. alita_sdk/tools/localgit/local_git.py +62 -54
  224. alita_sdk/tools/localgit/tool.py +5 -1
  225. alita_sdk/tools/memory/__init__.py +38 -14
  226. alita_sdk/tools/non_code_indexer_toolkit.py +7 -2
  227. alita_sdk/tools/ocr/__init__.py +10 -8
  228. alita_sdk/tools/openapi/__init__.py +281 -108
  229. alita_sdk/tools/openapi/api_wrapper.py +883 -0
  230. alita_sdk/tools/openapi/tool.py +20 -0
  231. alita_sdk/tools/pandas/__init__.py +18 -11
  232. alita_sdk/tools/pandas/api_wrapper.py +40 -45
  233. alita_sdk/tools/pandas/dataframe/generator/base.py +3 -1
  234. alita_sdk/tools/postman/__init__.py +10 -11
  235. alita_sdk/tools/postman/api_wrapper.py +19 -8
  236. alita_sdk/tools/postman/postman_analysis.py +8 -1
  237. alita_sdk/tools/pptx/__init__.py +10 -10
  238. alita_sdk/tools/qtest/__init__.py +21 -14
  239. alita_sdk/tools/qtest/api_wrapper.py +1784 -88
  240. alita_sdk/tools/rally/__init__.py +12 -10
  241. alita_sdk/tools/report_portal/__init__.py +22 -16
  242. alita_sdk/tools/salesforce/__init__.py +21 -16
  243. alita_sdk/tools/servicenow/__init__.py +20 -16
  244. alita_sdk/tools/servicenow/api_wrapper.py +1 -1
  245. alita_sdk/tools/sharepoint/__init__.py +16 -14
  246. alita_sdk/tools/sharepoint/api_wrapper.py +179 -39
  247. alita_sdk/tools/sharepoint/authorization_helper.py +191 -1
  248. alita_sdk/tools/sharepoint/utils.py +8 -2
  249. alita_sdk/tools/slack/__init__.py +11 -7
  250. alita_sdk/tools/sql/__init__.py +21 -19
  251. alita_sdk/tools/sql/api_wrapper.py +71 -23
  252. alita_sdk/tools/testio/__init__.py +20 -13
  253. alita_sdk/tools/testrail/__init__.py +12 -11
  254. alita_sdk/tools/testrail/api_wrapper.py +214 -46
  255. alita_sdk/tools/utils/__init__.py +28 -4
  256. alita_sdk/tools/utils/content_parser.py +182 -62
  257. alita_sdk/tools/utils/text_operations.py +254 -0
  258. alita_sdk/tools/vector_adapters/VectorStoreAdapter.py +83 -27
  259. alita_sdk/tools/xray/__init__.py +17 -14
  260. alita_sdk/tools/xray/api_wrapper.py +58 -113
  261. alita_sdk/tools/yagmail/__init__.py +8 -3
  262. alita_sdk/tools/zephyr/__init__.py +11 -7
  263. alita_sdk/tools/zephyr_enterprise/__init__.py +15 -9
  264. alita_sdk/tools/zephyr_enterprise/api_wrapper.py +30 -15
  265. alita_sdk/tools/zephyr_essential/__init__.py +15 -10
  266. alita_sdk/tools/zephyr_essential/api_wrapper.py +297 -54
  267. alita_sdk/tools/zephyr_essential/client.py +6 -4
  268. alita_sdk/tools/zephyr_scale/__init__.py +12 -8
  269. alita_sdk/tools/zephyr_scale/api_wrapper.py +39 -31
  270. alita_sdk/tools/zephyr_squad/__init__.py +11 -7
  271. {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.562.dist-info}/METADATA +184 -37
  272. alita_sdk-0.3.562.dist-info/RECORD +450 -0
  273. alita_sdk-0.3.562.dist-info/entry_points.txt +2 -0
  274. alita_sdk/tools/bitbucket/tools.py +0 -304
  275. alita_sdk-0.3.257.dist-info/RECORD +0 -343
  276. {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.562.dist-info}/WHEEL +0 -0
  277. {alita_sdk-0.3.257.dist-info → alita_sdk-0.3.562.dist-info}/licenses/LICENSE +0 -0
  278. {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, collection_suffix: Optional[str] = '') -> List[str]:
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, collection_suffix: str = ''):
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, collection_suffix) -> Dict[str, Dict[str, Any]]:
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, collection_suffix: Optional[str] = '') -> List[str]:
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 collection_suffix is provided
107
- if collection_suffix:
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') == collection_suffix
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, collection_suffix: str = ''):
118
- """Clean the vectorstore collection by deleting all indexed data."""
119
- # This logic deletes all data from the vectorstore collection without removal of collection.
120
- # Collection itself remains available for future indexing.
121
- vectorstore_wrapper.vectorstore.delete(ids=self.get_indexed_ids(vectorstore_wrapper, collection_suffix))
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, collection_suffix: str)-> Dict[str, Dict[str, Any]]:
128
- """Get all indexed data from PGVector for non-code content per collection_suffix."""
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._log_data("Retrieving already indexed data from PGVector vectorstore",
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') == collection_suffix
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, collection_suffix: str) -> Dict[str, Dict[str, Any]]:
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._log_data("Retrieving already indexed code data from PGVector vectorstore",
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') == collection_suffix
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, collection_suffix: Optional[str] = '') -> List[str]:
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, collection_suffix: str = ''):
289
- """Clean the vectorstore collection by deleting all indexed data."""
290
- vectorstore_wrapper.vectorstore.delete(ids=self.get_indexed_ids(vectorstore_wrapper, collection_suffix))
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, collection_suffix) -> Dict[str, Dict[str, Any]]:
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."""
@@ -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 ..utils import clean_string, get_max_toolkit_length, TOOLKIT_SPLITTER
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
- base_url=tool['settings'].get('base_url', None),
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=(Optional[XrayConfiguration], Field(description="Xray Configuration", json_schema_extra={'configuration_types': ['xray']})),
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
- "categories": ["test management"],
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=prefix + tool["name"],
88
- description=tool["description"] + "\nXray instance: " + xray_api_wrapper.base_url,
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