aiecs 1.0.1__py3-none-any.whl → 1.7.17__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of aiecs might be problematic. Click here for more details.

Files changed (340) hide show
  1. aiecs/__init__.py +13 -16
  2. aiecs/__main__.py +7 -7
  3. aiecs/aiecs_client.py +269 -75
  4. aiecs/application/executors/operation_executor.py +79 -54
  5. aiecs/application/knowledge_graph/__init__.py +7 -0
  6. aiecs/application/knowledge_graph/builder/__init__.py +37 -0
  7. aiecs/application/knowledge_graph/builder/data_quality.py +302 -0
  8. aiecs/application/knowledge_graph/builder/data_reshaping.py +293 -0
  9. aiecs/application/knowledge_graph/builder/document_builder.py +369 -0
  10. aiecs/application/knowledge_graph/builder/graph_builder.py +490 -0
  11. aiecs/application/knowledge_graph/builder/import_optimizer.py +396 -0
  12. aiecs/application/knowledge_graph/builder/schema_inference.py +462 -0
  13. aiecs/application/knowledge_graph/builder/schema_mapping.py +563 -0
  14. aiecs/application/knowledge_graph/builder/structured_pipeline.py +1384 -0
  15. aiecs/application/knowledge_graph/builder/text_chunker.py +317 -0
  16. aiecs/application/knowledge_graph/extractors/__init__.py +27 -0
  17. aiecs/application/knowledge_graph/extractors/base.py +98 -0
  18. aiecs/application/knowledge_graph/extractors/llm_entity_extractor.py +422 -0
  19. aiecs/application/knowledge_graph/extractors/llm_relation_extractor.py +347 -0
  20. aiecs/application/knowledge_graph/extractors/ner_entity_extractor.py +241 -0
  21. aiecs/application/knowledge_graph/fusion/__init__.py +78 -0
  22. aiecs/application/knowledge_graph/fusion/ab_testing.py +395 -0
  23. aiecs/application/knowledge_graph/fusion/abbreviation_expander.py +327 -0
  24. aiecs/application/knowledge_graph/fusion/alias_index.py +597 -0
  25. aiecs/application/knowledge_graph/fusion/alias_matcher.py +384 -0
  26. aiecs/application/knowledge_graph/fusion/cache_coordinator.py +343 -0
  27. aiecs/application/knowledge_graph/fusion/entity_deduplicator.py +433 -0
  28. aiecs/application/knowledge_graph/fusion/entity_linker.py +511 -0
  29. aiecs/application/knowledge_graph/fusion/evaluation_dataset.py +240 -0
  30. aiecs/application/knowledge_graph/fusion/knowledge_fusion.py +632 -0
  31. aiecs/application/knowledge_graph/fusion/matching_config.py +489 -0
  32. aiecs/application/knowledge_graph/fusion/name_normalizer.py +352 -0
  33. aiecs/application/knowledge_graph/fusion/relation_deduplicator.py +183 -0
  34. aiecs/application/knowledge_graph/fusion/semantic_name_matcher.py +464 -0
  35. aiecs/application/knowledge_graph/fusion/similarity_pipeline.py +534 -0
  36. aiecs/application/knowledge_graph/pattern_matching/__init__.py +21 -0
  37. aiecs/application/knowledge_graph/pattern_matching/pattern_matcher.py +342 -0
  38. aiecs/application/knowledge_graph/pattern_matching/query_executor.py +366 -0
  39. aiecs/application/knowledge_graph/profiling/__init__.py +12 -0
  40. aiecs/application/knowledge_graph/profiling/query_plan_visualizer.py +195 -0
  41. aiecs/application/knowledge_graph/profiling/query_profiler.py +223 -0
  42. aiecs/application/knowledge_graph/reasoning/__init__.py +27 -0
  43. aiecs/application/knowledge_graph/reasoning/evidence_synthesis.py +341 -0
  44. aiecs/application/knowledge_graph/reasoning/inference_engine.py +500 -0
  45. aiecs/application/knowledge_graph/reasoning/logic_form_parser.py +163 -0
  46. aiecs/application/knowledge_graph/reasoning/logic_parser/__init__.py +79 -0
  47. aiecs/application/knowledge_graph/reasoning/logic_parser/ast_builder.py +513 -0
  48. aiecs/application/knowledge_graph/reasoning/logic_parser/ast_nodes.py +913 -0
  49. aiecs/application/knowledge_graph/reasoning/logic_parser/ast_validator.py +866 -0
  50. aiecs/application/knowledge_graph/reasoning/logic_parser/error_handler.py +475 -0
  51. aiecs/application/knowledge_graph/reasoning/logic_parser/parser.py +396 -0
  52. aiecs/application/knowledge_graph/reasoning/logic_parser/query_context.py +208 -0
  53. aiecs/application/knowledge_graph/reasoning/logic_query_integration.py +170 -0
  54. aiecs/application/knowledge_graph/reasoning/query_planner.py +855 -0
  55. aiecs/application/knowledge_graph/reasoning/reasoning_engine.py +518 -0
  56. aiecs/application/knowledge_graph/retrieval/__init__.py +27 -0
  57. aiecs/application/knowledge_graph/retrieval/query_intent_classifier.py +211 -0
  58. aiecs/application/knowledge_graph/retrieval/retrieval_strategies.py +592 -0
  59. aiecs/application/knowledge_graph/retrieval/strategy_types.py +23 -0
  60. aiecs/application/knowledge_graph/search/__init__.py +59 -0
  61. aiecs/application/knowledge_graph/search/hybrid_search.py +457 -0
  62. aiecs/application/knowledge_graph/search/reranker.py +293 -0
  63. aiecs/application/knowledge_graph/search/reranker_strategies.py +535 -0
  64. aiecs/application/knowledge_graph/search/text_similarity.py +392 -0
  65. aiecs/application/knowledge_graph/traversal/__init__.py +15 -0
  66. aiecs/application/knowledge_graph/traversal/enhanced_traversal.py +305 -0
  67. aiecs/application/knowledge_graph/traversal/path_scorer.py +271 -0
  68. aiecs/application/knowledge_graph/validators/__init__.py +13 -0
  69. aiecs/application/knowledge_graph/validators/relation_validator.py +239 -0
  70. aiecs/application/knowledge_graph/visualization/__init__.py +11 -0
  71. aiecs/application/knowledge_graph/visualization/graph_visualizer.py +313 -0
  72. aiecs/common/__init__.py +9 -0
  73. aiecs/common/knowledge_graph/__init__.py +17 -0
  74. aiecs/common/knowledge_graph/runnable.py +471 -0
  75. aiecs/config/__init__.py +20 -5
  76. aiecs/config/config.py +762 -31
  77. aiecs/config/graph_config.py +131 -0
  78. aiecs/config/tool_config.py +435 -0
  79. aiecs/core/__init__.py +29 -13
  80. aiecs/core/interface/__init__.py +2 -2
  81. aiecs/core/interface/execution_interface.py +22 -22
  82. aiecs/core/interface/storage_interface.py +37 -88
  83. aiecs/core/registry/__init__.py +31 -0
  84. aiecs/core/registry/service_registry.py +92 -0
  85. aiecs/domain/__init__.py +270 -1
  86. aiecs/domain/agent/__init__.py +191 -0
  87. aiecs/domain/agent/base_agent.py +3949 -0
  88. aiecs/domain/agent/exceptions.py +99 -0
  89. aiecs/domain/agent/graph_aware_mixin.py +569 -0
  90. aiecs/domain/agent/hybrid_agent.py +1731 -0
  91. aiecs/domain/agent/integration/__init__.py +29 -0
  92. aiecs/domain/agent/integration/context_compressor.py +216 -0
  93. aiecs/domain/agent/integration/context_engine_adapter.py +587 -0
  94. aiecs/domain/agent/integration/protocols.py +281 -0
  95. aiecs/domain/agent/integration/retry_policy.py +218 -0
  96. aiecs/domain/agent/integration/role_config.py +213 -0
  97. aiecs/domain/agent/knowledge_aware_agent.py +1892 -0
  98. aiecs/domain/agent/lifecycle.py +291 -0
  99. aiecs/domain/agent/llm_agent.py +692 -0
  100. aiecs/domain/agent/memory/__init__.py +12 -0
  101. aiecs/domain/agent/memory/conversation.py +1124 -0
  102. aiecs/domain/agent/migration/__init__.py +14 -0
  103. aiecs/domain/agent/migration/conversion.py +163 -0
  104. aiecs/domain/agent/migration/legacy_wrapper.py +86 -0
  105. aiecs/domain/agent/models.py +894 -0
  106. aiecs/domain/agent/observability.py +479 -0
  107. aiecs/domain/agent/persistence.py +449 -0
  108. aiecs/domain/agent/prompts/__init__.py +29 -0
  109. aiecs/domain/agent/prompts/builder.py +159 -0
  110. aiecs/domain/agent/prompts/formatters.py +187 -0
  111. aiecs/domain/agent/prompts/template.py +255 -0
  112. aiecs/domain/agent/registry.py +253 -0
  113. aiecs/domain/agent/tool_agent.py +444 -0
  114. aiecs/domain/agent/tools/__init__.py +15 -0
  115. aiecs/domain/agent/tools/schema_generator.py +377 -0
  116. aiecs/domain/community/__init__.py +155 -0
  117. aiecs/domain/community/agent_adapter.py +469 -0
  118. aiecs/domain/community/analytics.py +432 -0
  119. aiecs/domain/community/collaborative_workflow.py +648 -0
  120. aiecs/domain/community/communication_hub.py +634 -0
  121. aiecs/domain/community/community_builder.py +320 -0
  122. aiecs/domain/community/community_integration.py +796 -0
  123. aiecs/domain/community/community_manager.py +803 -0
  124. aiecs/domain/community/decision_engine.py +849 -0
  125. aiecs/domain/community/exceptions.py +231 -0
  126. aiecs/domain/community/models/__init__.py +33 -0
  127. aiecs/domain/community/models/community_models.py +234 -0
  128. aiecs/domain/community/resource_manager.py +461 -0
  129. aiecs/domain/community/shared_context_manager.py +589 -0
  130. aiecs/domain/context/__init__.py +40 -10
  131. aiecs/domain/context/context_engine.py +1910 -0
  132. aiecs/domain/context/conversation_models.py +87 -53
  133. aiecs/domain/context/graph_memory.py +582 -0
  134. aiecs/domain/execution/model.py +12 -4
  135. aiecs/domain/knowledge_graph/__init__.py +19 -0
  136. aiecs/domain/knowledge_graph/models/__init__.py +52 -0
  137. aiecs/domain/knowledge_graph/models/entity.py +148 -0
  138. aiecs/domain/knowledge_graph/models/evidence.py +178 -0
  139. aiecs/domain/knowledge_graph/models/inference_rule.py +184 -0
  140. aiecs/domain/knowledge_graph/models/path.py +171 -0
  141. aiecs/domain/knowledge_graph/models/path_pattern.py +171 -0
  142. aiecs/domain/knowledge_graph/models/query.py +261 -0
  143. aiecs/domain/knowledge_graph/models/query_plan.py +181 -0
  144. aiecs/domain/knowledge_graph/models/relation.py +202 -0
  145. aiecs/domain/knowledge_graph/schema/__init__.py +23 -0
  146. aiecs/domain/knowledge_graph/schema/entity_type.py +131 -0
  147. aiecs/domain/knowledge_graph/schema/graph_schema.py +253 -0
  148. aiecs/domain/knowledge_graph/schema/property_schema.py +143 -0
  149. aiecs/domain/knowledge_graph/schema/relation_type.py +163 -0
  150. aiecs/domain/knowledge_graph/schema/schema_manager.py +691 -0
  151. aiecs/domain/knowledge_graph/schema/type_enums.py +209 -0
  152. aiecs/domain/task/dsl_processor.py +172 -56
  153. aiecs/domain/task/model.py +20 -8
  154. aiecs/domain/task/task_context.py +27 -24
  155. aiecs/infrastructure/__init__.py +0 -2
  156. aiecs/infrastructure/graph_storage/__init__.py +11 -0
  157. aiecs/infrastructure/graph_storage/base.py +837 -0
  158. aiecs/infrastructure/graph_storage/batch_operations.py +458 -0
  159. aiecs/infrastructure/graph_storage/cache.py +424 -0
  160. aiecs/infrastructure/graph_storage/distributed.py +223 -0
  161. aiecs/infrastructure/graph_storage/error_handling.py +380 -0
  162. aiecs/infrastructure/graph_storage/graceful_degradation.py +294 -0
  163. aiecs/infrastructure/graph_storage/health_checks.py +378 -0
  164. aiecs/infrastructure/graph_storage/in_memory.py +1197 -0
  165. aiecs/infrastructure/graph_storage/index_optimization.py +446 -0
  166. aiecs/infrastructure/graph_storage/lazy_loading.py +431 -0
  167. aiecs/infrastructure/graph_storage/metrics.py +344 -0
  168. aiecs/infrastructure/graph_storage/migration.py +400 -0
  169. aiecs/infrastructure/graph_storage/pagination.py +483 -0
  170. aiecs/infrastructure/graph_storage/performance_monitoring.py +456 -0
  171. aiecs/infrastructure/graph_storage/postgres.py +1563 -0
  172. aiecs/infrastructure/graph_storage/property_storage.py +353 -0
  173. aiecs/infrastructure/graph_storage/protocols.py +76 -0
  174. aiecs/infrastructure/graph_storage/query_optimizer.py +642 -0
  175. aiecs/infrastructure/graph_storage/schema_cache.py +290 -0
  176. aiecs/infrastructure/graph_storage/sqlite.py +1373 -0
  177. aiecs/infrastructure/graph_storage/streaming.py +487 -0
  178. aiecs/infrastructure/graph_storage/tenant.py +412 -0
  179. aiecs/infrastructure/messaging/celery_task_manager.py +92 -54
  180. aiecs/infrastructure/messaging/websocket_manager.py +51 -35
  181. aiecs/infrastructure/monitoring/__init__.py +22 -0
  182. aiecs/infrastructure/monitoring/executor_metrics.py +45 -11
  183. aiecs/infrastructure/monitoring/global_metrics_manager.py +212 -0
  184. aiecs/infrastructure/monitoring/structured_logger.py +3 -7
  185. aiecs/infrastructure/monitoring/tracing_manager.py +63 -35
  186. aiecs/infrastructure/persistence/__init__.py +14 -1
  187. aiecs/infrastructure/persistence/context_engine_client.py +184 -0
  188. aiecs/infrastructure/persistence/database_manager.py +67 -43
  189. aiecs/infrastructure/persistence/file_storage.py +180 -103
  190. aiecs/infrastructure/persistence/redis_client.py +74 -21
  191. aiecs/llm/__init__.py +73 -25
  192. aiecs/llm/callbacks/__init__.py +11 -0
  193. aiecs/llm/{custom_callbacks.py → callbacks/custom_callbacks.py} +26 -19
  194. aiecs/llm/client_factory.py +230 -37
  195. aiecs/llm/client_resolver.py +155 -0
  196. aiecs/llm/clients/__init__.py +38 -0
  197. aiecs/llm/clients/base_client.py +328 -0
  198. aiecs/llm/clients/google_function_calling_mixin.py +415 -0
  199. aiecs/llm/clients/googleai_client.py +314 -0
  200. aiecs/llm/clients/openai_client.py +158 -0
  201. aiecs/llm/clients/openai_compatible_mixin.py +367 -0
  202. aiecs/llm/clients/vertex_client.py +1186 -0
  203. aiecs/llm/clients/xai_client.py +201 -0
  204. aiecs/llm/config/__init__.py +51 -0
  205. aiecs/llm/config/config_loader.py +272 -0
  206. aiecs/llm/config/config_validator.py +206 -0
  207. aiecs/llm/config/model_config.py +143 -0
  208. aiecs/llm/protocols.py +149 -0
  209. aiecs/llm/utils/__init__.py +10 -0
  210. aiecs/llm/utils/validate_config.py +89 -0
  211. aiecs/main.py +140 -121
  212. aiecs/scripts/aid/VERSION_MANAGEMENT.md +138 -0
  213. aiecs/scripts/aid/__init__.py +19 -0
  214. aiecs/scripts/aid/module_checker.py +499 -0
  215. aiecs/scripts/aid/version_manager.py +235 -0
  216. aiecs/scripts/{DEPENDENCY_SYSTEM_SUMMARY.md → dependance_check/DEPENDENCY_SYSTEM_SUMMARY.md} +1 -0
  217. aiecs/scripts/{README_DEPENDENCY_CHECKER.md → dependance_check/README_DEPENDENCY_CHECKER.md} +1 -0
  218. aiecs/scripts/dependance_check/__init__.py +15 -0
  219. aiecs/scripts/dependance_check/dependency_checker.py +1835 -0
  220. aiecs/scripts/{dependency_fixer.py → dependance_check/dependency_fixer.py} +192 -90
  221. aiecs/scripts/{download_nlp_data.py → dependance_check/download_nlp_data.py} +203 -71
  222. aiecs/scripts/dependance_patch/__init__.py +7 -0
  223. aiecs/scripts/dependance_patch/fix_weasel/__init__.py +11 -0
  224. aiecs/scripts/{fix_weasel_validator.py → dependance_patch/fix_weasel/fix_weasel_validator.py} +21 -14
  225. aiecs/scripts/{patch_weasel_library.sh → dependance_patch/fix_weasel/patch_weasel_library.sh} +1 -1
  226. aiecs/scripts/knowledge_graph/__init__.py +3 -0
  227. aiecs/scripts/knowledge_graph/run_threshold_experiments.py +212 -0
  228. aiecs/scripts/migrations/multi_tenancy/README.md +142 -0
  229. aiecs/scripts/tools_develop/README.md +671 -0
  230. aiecs/scripts/tools_develop/README_CONFIG_CHECKER.md +273 -0
  231. aiecs/scripts/tools_develop/TOOLS_CONFIG_GUIDE.md +1287 -0
  232. aiecs/scripts/tools_develop/TOOL_AUTO_DISCOVERY.md +234 -0
  233. aiecs/scripts/tools_develop/__init__.py +21 -0
  234. aiecs/scripts/tools_develop/check_all_tools_config.py +548 -0
  235. aiecs/scripts/tools_develop/check_type_annotations.py +257 -0
  236. aiecs/scripts/tools_develop/pre-commit-schema-coverage.sh +66 -0
  237. aiecs/scripts/tools_develop/schema_coverage.py +511 -0
  238. aiecs/scripts/tools_develop/validate_tool_schemas.py +475 -0
  239. aiecs/scripts/tools_develop/verify_executor_config_fix.py +98 -0
  240. aiecs/scripts/tools_develop/verify_tools.py +352 -0
  241. aiecs/tasks/__init__.py +0 -1
  242. aiecs/tasks/worker.py +115 -47
  243. aiecs/tools/__init__.py +194 -72
  244. aiecs/tools/apisource/__init__.py +99 -0
  245. aiecs/tools/apisource/intelligence/__init__.py +19 -0
  246. aiecs/tools/apisource/intelligence/data_fusion.py +632 -0
  247. aiecs/tools/apisource/intelligence/query_analyzer.py +417 -0
  248. aiecs/tools/apisource/intelligence/search_enhancer.py +385 -0
  249. aiecs/tools/apisource/monitoring/__init__.py +9 -0
  250. aiecs/tools/apisource/monitoring/metrics.py +330 -0
  251. aiecs/tools/apisource/providers/__init__.py +112 -0
  252. aiecs/tools/apisource/providers/base.py +671 -0
  253. aiecs/tools/apisource/providers/census.py +397 -0
  254. aiecs/tools/apisource/providers/fred.py +535 -0
  255. aiecs/tools/apisource/providers/newsapi.py +409 -0
  256. aiecs/tools/apisource/providers/worldbank.py +352 -0
  257. aiecs/tools/apisource/reliability/__init__.py +12 -0
  258. aiecs/tools/apisource/reliability/error_handler.py +363 -0
  259. aiecs/tools/apisource/reliability/fallback_strategy.py +376 -0
  260. aiecs/tools/apisource/tool.py +832 -0
  261. aiecs/tools/apisource/utils/__init__.py +9 -0
  262. aiecs/tools/apisource/utils/validators.py +334 -0
  263. aiecs/tools/base_tool.py +415 -21
  264. aiecs/tools/docs/__init__.py +121 -0
  265. aiecs/tools/docs/ai_document_orchestrator.py +607 -0
  266. aiecs/tools/docs/ai_document_writer_orchestrator.py +2350 -0
  267. aiecs/tools/docs/content_insertion_tool.py +1320 -0
  268. aiecs/tools/docs/document_creator_tool.py +1464 -0
  269. aiecs/tools/docs/document_layout_tool.py +1160 -0
  270. aiecs/tools/docs/document_parser_tool.py +1016 -0
  271. aiecs/tools/docs/document_writer_tool.py +2008 -0
  272. aiecs/tools/knowledge_graph/__init__.py +17 -0
  273. aiecs/tools/knowledge_graph/graph_reasoning_tool.py +807 -0
  274. aiecs/tools/knowledge_graph/graph_search_tool.py +944 -0
  275. aiecs/tools/knowledge_graph/kg_builder_tool.py +524 -0
  276. aiecs/tools/langchain_adapter.py +300 -138
  277. aiecs/tools/schema_generator.py +455 -0
  278. aiecs/tools/search_tool/__init__.py +100 -0
  279. aiecs/tools/search_tool/analyzers.py +581 -0
  280. aiecs/tools/search_tool/cache.py +264 -0
  281. aiecs/tools/search_tool/constants.py +128 -0
  282. aiecs/tools/search_tool/context.py +224 -0
  283. aiecs/tools/search_tool/core.py +778 -0
  284. aiecs/tools/search_tool/deduplicator.py +119 -0
  285. aiecs/tools/search_tool/error_handler.py +242 -0
  286. aiecs/tools/search_tool/metrics.py +343 -0
  287. aiecs/tools/search_tool/rate_limiter.py +172 -0
  288. aiecs/tools/search_tool/schemas.py +275 -0
  289. aiecs/tools/statistics/__init__.py +80 -0
  290. aiecs/tools/statistics/ai_data_analysis_orchestrator.py +646 -0
  291. aiecs/tools/statistics/ai_insight_generator_tool.py +508 -0
  292. aiecs/tools/statistics/ai_report_orchestrator_tool.py +684 -0
  293. aiecs/tools/statistics/data_loader_tool.py +555 -0
  294. aiecs/tools/statistics/data_profiler_tool.py +638 -0
  295. aiecs/tools/statistics/data_transformer_tool.py +580 -0
  296. aiecs/tools/statistics/data_visualizer_tool.py +498 -0
  297. aiecs/tools/statistics/model_trainer_tool.py +507 -0
  298. aiecs/tools/statistics/statistical_analyzer_tool.py +472 -0
  299. aiecs/tools/task_tools/__init__.py +49 -36
  300. aiecs/tools/task_tools/chart_tool.py +200 -184
  301. aiecs/tools/task_tools/classfire_tool.py +268 -267
  302. aiecs/tools/task_tools/image_tool.py +220 -141
  303. aiecs/tools/task_tools/office_tool.py +226 -146
  304. aiecs/tools/task_tools/pandas_tool.py +477 -121
  305. aiecs/tools/task_tools/report_tool.py +390 -142
  306. aiecs/tools/task_tools/research_tool.py +149 -79
  307. aiecs/tools/task_tools/scraper_tool.py +339 -145
  308. aiecs/tools/task_tools/stats_tool.py +448 -209
  309. aiecs/tools/temp_file_manager.py +26 -24
  310. aiecs/tools/tool_executor/__init__.py +18 -16
  311. aiecs/tools/tool_executor/tool_executor.py +364 -52
  312. aiecs/utils/LLM_output_structor.py +74 -48
  313. aiecs/utils/__init__.py +14 -3
  314. aiecs/utils/base_callback.py +0 -3
  315. aiecs/utils/cache_provider.py +696 -0
  316. aiecs/utils/execution_utils.py +50 -31
  317. aiecs/utils/prompt_loader.py +1 -0
  318. aiecs/utils/token_usage_repository.py +37 -11
  319. aiecs/ws/socket_server.py +14 -4
  320. {aiecs-1.0.1.dist-info → aiecs-1.7.17.dist-info}/METADATA +52 -15
  321. aiecs-1.7.17.dist-info/RECORD +337 -0
  322. aiecs-1.7.17.dist-info/entry_points.txt +13 -0
  323. aiecs/config/registry.py +0 -19
  324. aiecs/domain/context/content_engine.py +0 -982
  325. aiecs/llm/base_client.py +0 -99
  326. aiecs/llm/openai_client.py +0 -125
  327. aiecs/llm/vertex_client.py +0 -186
  328. aiecs/llm/xai_client.py +0 -184
  329. aiecs/scripts/dependency_checker.py +0 -857
  330. aiecs/scripts/quick_dependency_check.py +0 -269
  331. aiecs/tools/task_tools/search_api.py +0 -7
  332. aiecs-1.0.1.dist-info/RECORD +0 -90
  333. aiecs-1.0.1.dist-info/entry_points.txt +0 -7
  334. /aiecs/scripts/{setup_nlp_data.sh → dependance_check/setup_nlp_data.sh} +0 -0
  335. /aiecs/scripts/{README_WEASEL_PATCH.md → dependance_patch/fix_weasel/README_WEASEL_PATCH.md} +0 -0
  336. /aiecs/scripts/{fix_weasel_validator.sh → dependance_patch/fix_weasel/fix_weasel_validator.sh} +0 -0
  337. /aiecs/scripts/{run_weasel_patch.sh → dependance_patch/fix_weasel/run_weasel_patch.sh} +0 -0
  338. {aiecs-1.0.1.dist-info → aiecs-1.7.17.dist-info}/WHEEL +0 -0
  339. {aiecs-1.0.1.dist-info → aiecs-1.7.17.dist-info}/licenses/LICENSE +0 -0
  340. {aiecs-1.0.1.dist-info → aiecs-1.7.17.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,1835 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Comprehensive dependency checker for AIECS tools.
4
+
5
+ This script checks all system dependencies, Python packages, and model files
6
+ required by various AIECS tools and provides detailed status reports and
7
+ installation instructions.
8
+ """
9
+
10
+ import os
11
+ import sys
12
+ import subprocess
13
+ import platform
14
+ import shutil
15
+ import logging
16
+ from pathlib import Path
17
+ from typing import Dict, List, Optional
18
+ from dataclasses import dataclass
19
+ from enum import Enum
20
+
21
+
22
+ class DependencyStatus(Enum):
23
+ """Status of a dependency check."""
24
+
25
+ AVAILABLE = "available"
26
+ MISSING = "missing"
27
+ PARTIAL = "partial"
28
+ ERROR = "error"
29
+
30
+
31
+ @dataclass
32
+ class DependencyInfo:
33
+ """Information about a dependency."""
34
+
35
+ name: str
36
+ status: DependencyStatus
37
+ description: str
38
+ install_command: Optional[str] = None
39
+ install_url: Optional[str] = None
40
+ impact: str = ""
41
+ is_critical: bool = True
42
+
43
+
44
+ @dataclass
45
+ class ToolDependencies:
46
+ """Dependencies for a specific tool."""
47
+
48
+ tool_name: str
49
+ system_deps: List[DependencyInfo]
50
+ python_deps: List[DependencyInfo]
51
+ model_deps: List[DependencyInfo]
52
+ optional_deps: List[DependencyInfo]
53
+
54
+
55
+ class DependencyChecker:
56
+ """Main dependency checker class."""
57
+
58
+ def __init__(self):
59
+ self.logger = self._setup_logging()
60
+ self.system = platform.system().lower()
61
+ self.architecture = platform.machine().lower()
62
+ self.python_version = f"{sys.version_info.major}.{sys.version_info.minor}"
63
+
64
+ def _setup_logging(self) -> logging.Logger:
65
+ """Setup logging configuration."""
66
+ logging.basicConfig(
67
+ level=logging.INFO,
68
+ format="%(asctime)s - %(levelname)s - %(message)s",
69
+ handlers=[
70
+ logging.StreamHandler(sys.stdout),
71
+ logging.FileHandler("dependency_check.log"),
72
+ ],
73
+ )
74
+ return logging.getLogger(__name__)
75
+
76
+ def check_system_command(self, command: str, version_flag: str = "--version") -> DependencyStatus:
77
+ """Check if a system command is available."""
78
+ try:
79
+ result = subprocess.run(
80
+ [command, version_flag],
81
+ capture_output=True,
82
+ text=True,
83
+ timeout=10,
84
+ )
85
+ if result.returncode == 0:
86
+ return DependencyStatus.AVAILABLE
87
+ else:
88
+ return DependencyStatus.MISSING
89
+ except (
90
+ subprocess.TimeoutExpired,
91
+ FileNotFoundError,
92
+ subprocess.CalledProcessError,
93
+ ):
94
+ return DependencyStatus.MISSING
95
+
96
+ def check_python_package(self, package_name: str) -> DependencyStatus:
97
+ """Check if a Python package is installed."""
98
+ try:
99
+ __import__(package_name)
100
+ return DependencyStatus.AVAILABLE
101
+ except ImportError:
102
+ return DependencyStatus.MISSING
103
+
104
+ def check_file_exists(self, file_path: str) -> DependencyStatus:
105
+ """Check if a file exists."""
106
+ if os.path.exists(file_path):
107
+ return DependencyStatus.AVAILABLE
108
+ else:
109
+ return DependencyStatus.MISSING
110
+
111
+ def check_directory_exists(self, dir_path: str) -> DependencyStatus:
112
+ """Check if a directory exists."""
113
+ if os.path.isdir(dir_path):
114
+ return DependencyStatus.AVAILABLE
115
+ else:
116
+ return DependencyStatus.MISSING
117
+
118
+ def get_system_package_manager(self) -> str:
119
+ """Get the appropriate package manager for the system."""
120
+ if self.system == "linux":
121
+ if shutil.which("apt-get"):
122
+ return "apt-get"
123
+ elif shutil.which("yum"):
124
+ return "yum"
125
+ elif shutil.which("dnf"):
126
+ return "dnf"
127
+ elif shutil.which("pacman"):
128
+ return "pacman"
129
+ elif self.system == "darwin":
130
+ if shutil.which("brew"):
131
+ return "brew"
132
+ elif self.system == "windows":
133
+ return "chocolatey"
134
+ return "unknown"
135
+
136
+ def check_image_tool_dependencies(self) -> ToolDependencies:
137
+ """Check dependencies for Image Tool."""
138
+ system_deps: List[DependencyInfo] = []
139
+ python_deps: List[DependencyInfo] = []
140
+ model_deps: List[DependencyInfo] = []
141
+ optional_deps: List[DependencyInfo] = []
142
+
143
+ # Tesseract OCR
144
+ tesseract_status = self.check_system_command("tesseract")
145
+ system_deps.append(
146
+ DependencyInfo(
147
+ name="Tesseract OCR",
148
+ status=tesseract_status,
149
+ description="OCR engine for text extraction from images",
150
+ install_command=self._get_tesseract_install_command(),
151
+ impact="OCR functionality will be unavailable",
152
+ is_critical=True,
153
+ )
154
+ )
155
+
156
+ # Pillow system dependencies
157
+ pillow_status = self._check_pillow_system_deps()
158
+ system_deps.append(
159
+ DependencyInfo(
160
+ name="Pillow System Libraries",
161
+ status=pillow_status,
162
+ description="Image processing system libraries (libjpeg, libpng, etc.)",
163
+ install_command=self._get_pillow_system_deps_command(),
164
+ impact="Image processing may fail or be limited",
165
+ is_critical=True,
166
+ )
167
+ )
168
+
169
+ # Python packages
170
+ python_packages = ["PIL", "pytesseract"]
171
+ for pkg in python_packages:
172
+ status = self.check_python_package(pkg)
173
+ python_deps.append(
174
+ DependencyInfo(
175
+ name=pkg,
176
+ status=status,
177
+ description=f"Python package: {pkg}",
178
+ install_command=f"pip install {pkg}",
179
+ impact=f"{pkg} functionality will be unavailable",
180
+ is_critical=True,
181
+ )
182
+ )
183
+
184
+ # Tesseract language packs
185
+ lang_packs = [
186
+ "eng",
187
+ "chi_sim",
188
+ "chi_tra",
189
+ "fra",
190
+ "deu",
191
+ "jpn",
192
+ "kor",
193
+ "rus",
194
+ "spa",
195
+ ]
196
+ for lang in lang_packs:
197
+ status = self._check_tesseract_lang_pack(lang)
198
+ model_deps.append(
199
+ DependencyInfo(
200
+ name=f"Tesseract {lang}",
201
+ status=status,
202
+ description=f"Tesseract language pack for {lang}",
203
+ install_command=self._get_tesseract_lang_install_command(lang),
204
+ impact=f"OCR in {lang} language will be unavailable",
205
+ is_critical=False,
206
+ )
207
+ )
208
+
209
+ return ToolDependencies(
210
+ tool_name="Image Tool",
211
+ system_deps=system_deps,
212
+ python_deps=python_deps,
213
+ model_deps=model_deps,
214
+ optional_deps=optional_deps,
215
+ )
216
+
217
+ def check_classfire_tool_dependencies(self) -> ToolDependencies:
218
+ """Check dependencies for ClassFire Tool."""
219
+ system_deps: List[DependencyInfo] = []
220
+ python_deps: List[DependencyInfo] = []
221
+ model_deps: List[DependencyInfo] = []
222
+ optional_deps: List[DependencyInfo] = []
223
+
224
+ # Core Python packages (required)
225
+ core_packages = ["spacy", "nltk", "rake_nltk"]
226
+ for pkg in core_packages:
227
+ status = self.check_python_package(pkg)
228
+ python_deps.append(
229
+ DependencyInfo(
230
+ name=pkg,
231
+ status=status,
232
+ description=f"Python package: {pkg}",
233
+ install_command=f"pip install {pkg}",
234
+ impact=f"{pkg} functionality will be unavailable",
235
+ is_critical=True,
236
+ )
237
+ )
238
+
239
+ # Optional Python packages
240
+ optional_packages = {
241
+ "transformers": "Text summarization (BART/T5 models)",
242
+ "torch": "Backend for transformers (PyTorch)",
243
+ "spacy_pkuseg": "Advanced Chinese text segmentation",
244
+ }
245
+ for pkg, description in optional_packages.items():
246
+ status = self.check_python_package(pkg)
247
+ optional_deps.append(
248
+ DependencyInfo(
249
+ name=pkg,
250
+ status=status,
251
+ description=description,
252
+ install_command=f"pip install {pkg}" if pkg != "torch" else "pip install torch (or pip install aiecs[summarization])",
253
+ impact=f"{description} will be unavailable",
254
+ is_critical=False,
255
+ )
256
+ )
257
+
258
+ # spaCy models
259
+ spacy_models = ["en_core_web_sm", "zh_core_web_sm"]
260
+ for model in spacy_models:
261
+ status = self._check_spacy_model(model)
262
+ is_critical = model == "en_core_web_sm" # Only English model is critical
263
+ model_deps.append(
264
+ DependencyInfo(
265
+ name=f"spaCy {model}",
266
+ status=status,
267
+ description=f"spaCy model: {model}",
268
+ install_command=f"python -m spacy download {model}",
269
+ impact=f"Text processing in {model.split('_')[0]} language will be unavailable",
270
+ is_critical=is_critical,
271
+ )
272
+ )
273
+
274
+ # spaCy PKUSeg model (optional Chinese segmentation)
275
+ pkuseg_status = self._check_spacy_pkuseg_model()
276
+ model_deps.append(
277
+ DependencyInfo(
278
+ name="spaCy PKUSeg",
279
+ status=pkuseg_status,
280
+ description="Chinese text segmentation model for spaCy",
281
+ install_command="pip install spacy_pkuseg",
282
+ impact="Advanced Chinese text segmentation will be unavailable",
283
+ is_critical=False,
284
+ )
285
+ )
286
+
287
+ # Transformers models (optional - only if transformers is installed)
288
+ if self.check_python_package("transformers") == DependencyStatus.AVAILABLE:
289
+ transformers_models = ["facebook/bart-large-cnn", "t5-base"]
290
+ for model in transformers_models:
291
+ status = self._check_transformers_model(model)
292
+ optional_deps.append(
293
+ DependencyInfo(
294
+ name=f"Transformers {model}",
295
+ status=status,
296
+ description=f"Transformers model for summarization: {model}",
297
+ install_command="Models download automatically on first use (requires transformers + torch)",
298
+ impact=f"Text summarization with {model} will be unavailable",
299
+ is_critical=False,
300
+ )
301
+ )
302
+
303
+ # NLTK data
304
+ nltk_data = [
305
+ "stopwords",
306
+ "punkt",
307
+ "wordnet",
308
+ "averaged_perceptron_tagger",
309
+ ]
310
+ for data in nltk_data:
311
+ status = self._check_nltk_data(data)
312
+ # Recommend using the proper download script that handles environment-specific paths
313
+ install_cmd = "aiecs-download-nlp-data --download # Downloads to Poetry/virtual environment"
314
+
315
+ model_deps.append(
316
+ DependencyInfo(
317
+ name=f"NLTK {data}",
318
+ status=status,
319
+ description=f"NLTK data: {data}",
320
+ install_command=install_cmd,
321
+ impact=f"NLTK {data} functionality will be unavailable",
322
+ is_critical=True,
323
+ )
324
+ )
325
+
326
+ return ToolDependencies(
327
+ tool_name="ClassFire Tool",
328
+ system_deps=system_deps,
329
+ python_deps=python_deps,
330
+ model_deps=model_deps,
331
+ optional_deps=optional_deps,
332
+ )
333
+
334
+ def check_office_tool_dependencies(self) -> ToolDependencies:
335
+ """Check dependencies for Office Tool."""
336
+ system_deps: List[DependencyInfo] = []
337
+ python_deps: List[DependencyInfo] = []
338
+ model_deps: List[DependencyInfo] = []
339
+ optional_deps: List[DependencyInfo] = []
340
+
341
+ # Java Runtime Environment
342
+ java_status = self.check_system_command("java", "-version")
343
+ system_deps.append(
344
+ DependencyInfo(
345
+ name="Java Runtime Environment",
346
+ status=java_status,
347
+ description="Java runtime for Apache Tika document parsing",
348
+ install_command=self._get_java_install_command(),
349
+ impact="Document parsing with Tika will be unavailable",
350
+ is_critical=True,
351
+ )
352
+ )
353
+
354
+ # Tesseract OCR
355
+ tesseract_status = self.check_system_command("tesseract")
356
+ system_deps.append(
357
+ DependencyInfo(
358
+ name="Tesseract OCR",
359
+ status=tesseract_status,
360
+ description="OCR engine for image text extraction",
361
+ install_command=self._get_tesseract_install_command(),
362
+ impact="OCR functionality will be unavailable",
363
+ is_critical=False,
364
+ )
365
+ )
366
+
367
+ # Python packages (package_name: import_name)
368
+ python_packages = {
369
+ "tika": "tika",
370
+ "python-docx": "docx", # Package name vs import name
371
+ "python-pptx": "pptx", # Package name vs import name
372
+ "openpyxl": "openpyxl",
373
+ "pdfplumber": "pdfplumber",
374
+ "pytesseract": "pytesseract",
375
+ "PIL": "PIL",
376
+ }
377
+ for pkg_name, import_name in python_packages.items():
378
+ status = self.check_python_package(import_name)
379
+ python_deps.append(
380
+ DependencyInfo(
381
+ name=pkg_name,
382
+ status=status,
383
+ description=f"Python package: {pkg_name}",
384
+ install_command=f"pip install {pkg_name}",
385
+ impact=f"{pkg_name} functionality will be unavailable",
386
+ is_critical=True,
387
+ )
388
+ )
389
+
390
+ return ToolDependencies(
391
+ tool_name="Office Tool",
392
+ system_deps=system_deps,
393
+ python_deps=python_deps,
394
+ model_deps=model_deps,
395
+ optional_deps=optional_deps,
396
+ )
397
+
398
+ def check_stats_tool_dependencies(self) -> ToolDependencies:
399
+ """Check dependencies for Stats Tool."""
400
+ system_deps: List[DependencyInfo] = []
401
+ python_deps: List[DependencyInfo] = []
402
+ model_deps: List[DependencyInfo] = []
403
+ optional_deps: List[DependencyInfo] = []
404
+
405
+ # pyreadstat system dependencies
406
+ pyreadstat_status = self._check_pyreadstat_system_deps()
407
+ system_deps.append(
408
+ DependencyInfo(
409
+ name="libreadstat",
410
+ status=pyreadstat_status,
411
+ description="System library for reading SAS, SPSS, Stata files",
412
+ install_command=self._get_pyreadstat_install_command(),
413
+ impact="SAS, SPSS, Stata file reading will be unavailable",
414
+ is_critical=False,
415
+ )
416
+ )
417
+
418
+ # Excel system dependencies
419
+ excel_status = self._check_excel_system_deps()
420
+ system_deps.append(
421
+ DependencyInfo(
422
+ name="Excel System Libraries",
423
+ status=excel_status,
424
+ description="System libraries for Excel file processing",
425
+ install_command=self._get_excel_system_deps_command(),
426
+ impact="Excel file processing may be limited",
427
+ is_critical=False,
428
+ )
429
+ )
430
+
431
+ # Python packages (package_name: import_name)
432
+ python_packages = {
433
+ "pandas": "pandas",
434
+ "numpy": "numpy",
435
+ "scipy": "scipy",
436
+ "scikit-learn": "sklearn", # Package name vs import name
437
+ "statsmodels": "statsmodels",
438
+ "pyreadstat": "pyreadstat",
439
+ "openpyxl": "openpyxl",
440
+ }
441
+ for pkg_name, import_name in python_packages.items():
442
+ status = self.check_python_package(import_name)
443
+ python_deps.append(
444
+ DependencyInfo(
445
+ name=pkg_name,
446
+ status=status,
447
+ description=f"Python package: {pkg_name}",
448
+ install_command=f"pip install {pkg_name}",
449
+ impact=f"{pkg_name} functionality will be unavailable",
450
+ is_critical=True,
451
+ )
452
+ )
453
+
454
+ return ToolDependencies(
455
+ tool_name="Stats Tool",
456
+ system_deps=system_deps,
457
+ python_deps=python_deps,
458
+ model_deps=model_deps,
459
+ optional_deps=optional_deps,
460
+ )
461
+
462
+ def check_report_tool_dependencies(self) -> ToolDependencies:
463
+ """Check dependencies for Report Tool."""
464
+ system_deps: List[DependencyInfo] = []
465
+ python_deps: List[DependencyInfo] = []
466
+ model_deps: List[DependencyInfo] = []
467
+ optional_deps: List[DependencyInfo] = []
468
+
469
+ # Matplotlib system dependencies (core - for chart generation)
470
+ matplotlib_status = self._check_matplotlib_system_deps()
471
+ system_deps.append(
472
+ DependencyInfo(
473
+ name="Matplotlib System Libraries",
474
+ status=matplotlib_status,
475
+ description="System libraries for chart generation",
476
+ install_command=self._get_matplotlib_system_deps_command(),
477
+ impact="Chart generation may be limited",
478
+ is_critical=True,
479
+ )
480
+ )
481
+
482
+ # Core Python packages (package_name: import_name)
483
+ core_python_packages = {
484
+ "jinja2": "jinja2",
485
+ "matplotlib": "matplotlib",
486
+ "bleach": "bleach",
487
+ "markdown": "markdown",
488
+ "pandas": "pandas",
489
+ "openpyxl": "openpyxl",
490
+ "python-docx": "docx", # Package name vs import name
491
+ "python-pptx": "pptx", # Package name vs import name
492
+ }
493
+ for pkg_name, import_name in core_python_packages.items():
494
+ status = self.check_python_package(import_name)
495
+ python_deps.append(
496
+ DependencyInfo(
497
+ name=pkg_name,
498
+ status=status,
499
+ description=f"Python package: {pkg_name}",
500
+ install_command=f"pip install {pkg_name}",
501
+ impact=f"{pkg_name} functionality will be unavailable",
502
+ is_critical=True,
503
+ )
504
+ )
505
+
506
+ # Optional: WeasyPrint system dependencies (for PDF generation)
507
+ weasyprint_status = self._check_weasyprint_system_deps()
508
+ optional_deps.append(
509
+ DependencyInfo(
510
+ name="WeasyPrint System Libraries",
511
+ status=weasyprint_status,
512
+ description="System libraries for PDF generation (cairo, pango, etc.) - currently disabled",
513
+ install_command=self._get_weasyprint_install_command(),
514
+ impact="PDF generation functionality is currently disabled (will be re-enabled in future release)",
515
+ is_critical=False,
516
+ )
517
+ )
518
+
519
+ # Optional: WeasyPrint Python package (for PDF generation)
520
+ weasyprint_pkg_status = self.check_python_package("weasyprint")
521
+ optional_deps.append(
522
+ DependencyInfo(
523
+ name="weasyprint",
524
+ status=weasyprint_pkg_status,
525
+ description="Python package: weasyprint (HTML to PDF conversion) - currently disabled",
526
+ install_command="pip install weasyprint",
527
+ impact="PDF generation functionality is currently disabled (will be re-enabled in future release)",
528
+ is_critical=False,
529
+ )
530
+ )
531
+
532
+ return ToolDependencies(
533
+ tool_name="Report Tool",
534
+ system_deps=system_deps,
535
+ python_deps=python_deps,
536
+ model_deps=model_deps,
537
+ optional_deps=optional_deps,
538
+ )
539
+
540
+ def check_scraper_tool_dependencies(self) -> ToolDependencies:
541
+ """Check dependencies for Scraper Tool."""
542
+ system_deps: List[DependencyInfo] = []
543
+ python_deps: List[DependencyInfo] = []
544
+ model_deps: List[DependencyInfo] = []
545
+ optional_deps: List[DependencyInfo] = []
546
+
547
+ # Playwright browsers
548
+ playwright_status = self._check_playwright_browsers()
549
+ system_deps.append(
550
+ DependencyInfo(
551
+ name="Playwright Browsers",
552
+ status=playwright_status,
553
+ description="Browser binaries for JavaScript rendering",
554
+ install_command="playwright install",
555
+ impact="JavaScript rendering will be unavailable",
556
+ is_critical=False,
557
+ )
558
+ )
559
+
560
+ # Playwright system dependencies
561
+ playwright_deps_status = self._check_playwright_system_deps()
562
+ system_deps.append(
563
+ DependencyInfo(
564
+ name="Playwright System Dependencies",
565
+ status=playwright_deps_status,
566
+ description="System libraries for browser automation",
567
+ install_command="playwright install-deps",
568
+ impact="Browser automation may fail",
569
+ is_critical=False,
570
+ )
571
+ )
572
+
573
+ # Python packages (package_name: import_name)
574
+ python_packages = {
575
+ "playwright": "playwright",
576
+ "scrapy": "scrapy",
577
+ "httpx": "httpx",
578
+ "beautifulsoup4": "bs4", # Package name vs import name
579
+ "lxml": "lxml",
580
+ }
581
+ for pkg_name, import_name in python_packages.items():
582
+ status = self.check_python_package(import_name)
583
+ python_deps.append(
584
+ DependencyInfo(
585
+ name=pkg_name,
586
+ status=status,
587
+ description=f"Python package: {pkg_name}",
588
+ install_command=f"pip install {pkg_name}",
589
+ impact=f"{pkg_name} functionality will be unavailable",
590
+ is_critical=True,
591
+ )
592
+ )
593
+
594
+ return ToolDependencies(
595
+ tool_name="Scraper Tool",
596
+ system_deps=system_deps,
597
+ python_deps=python_deps,
598
+ model_deps=model_deps,
599
+ optional_deps=optional_deps,
600
+ )
601
+
602
+ def _check_pillow_system_deps(self) -> DependencyStatus:
603
+ """Check Pillow system dependencies."""
604
+ try:
605
+ from PIL import Image
606
+
607
+ # Try to create a simple image to test system libraries
608
+ img = Image.new("RGB", (10, 10), color="red")
609
+ img.save("/tmp/test_pillow.png")
610
+ os.remove("/tmp/test_pillow.png")
611
+ return DependencyStatus.AVAILABLE
612
+ except Exception:
613
+ return DependencyStatus.MISSING
614
+
615
+ def _check_tesseract_lang_pack(self, lang: str) -> DependencyStatus:
616
+ """Check if a Tesseract language pack is installed."""
617
+ try:
618
+ result = subprocess.run(
619
+ ["tesseract", "--list-langs"],
620
+ capture_output=True,
621
+ text=True,
622
+ timeout=10,
623
+ )
624
+ if result.returncode == 0 and lang in result.stdout:
625
+ return DependencyStatus.AVAILABLE
626
+ else:
627
+ return DependencyStatus.MISSING
628
+ except Exception:
629
+ return DependencyStatus.MISSING
630
+
631
+ def _check_spacy_model(self, model: str) -> DependencyStatus:
632
+ """Check if a spaCy model is installed."""
633
+ try:
634
+ import spacy
635
+
636
+ spacy.load(model)
637
+ return DependencyStatus.AVAILABLE
638
+ except OSError:
639
+ return DependencyStatus.MISSING
640
+ except Exception:
641
+ return DependencyStatus.ERROR
642
+
643
+ def _check_transformers_model(self, model: str) -> DependencyStatus:
644
+ """Check if a Transformers model is available."""
645
+ try:
646
+ from transformers import pipeline # type: ignore[import-not-found]
647
+
648
+ # Try to load the model (this will download if not present)
649
+ pipeline("summarization", model=model) # Just checking if it loads
650
+ return DependencyStatus.AVAILABLE
651
+ except Exception:
652
+ return DependencyStatus.MISSING
653
+
654
+ def _check_nltk_data(self, data: str) -> DependencyStatus:
655
+ """Check if NLTK data is available."""
656
+ try:
657
+ import nltk # type: ignore[import-untyped]
658
+
659
+ nltk.data.find(f"corpora/{data}")
660
+ return DependencyStatus.AVAILABLE
661
+ except LookupError:
662
+ return DependencyStatus.MISSING
663
+ except Exception:
664
+ return DependencyStatus.ERROR
665
+
666
+ def _check_spacy_pkuseg_model(self) -> DependencyStatus:
667
+ """Check if spaCy PKUSeg model is available."""
668
+ try:
669
+ import spacy_pkuseg # type: ignore[import-untyped]
670
+
671
+ # Test basic functionality
672
+ seg = spacy_pkuseg.pkuseg()
673
+ list(seg.cut("测试"))
674
+ return DependencyStatus.AVAILABLE
675
+ except ImportError:
676
+ return DependencyStatus.MISSING
677
+ except Exception:
678
+ return DependencyStatus.ERROR
679
+
680
+ def _check_pyreadstat_system_deps(self) -> DependencyStatus:
681
+ """Check pyreadstat system dependencies."""
682
+ try:
683
+ return DependencyStatus.AVAILABLE
684
+ except ImportError:
685
+ return DependencyStatus.MISSING
686
+ except Exception:
687
+ return DependencyStatus.ERROR
688
+
689
+ def _check_excel_system_deps(self) -> DependencyStatus:
690
+ """Check Excel system dependencies."""
691
+ try:
692
+ return DependencyStatus.AVAILABLE
693
+ except ImportError:
694
+ return DependencyStatus.MISSING
695
+ except Exception:
696
+ return DependencyStatus.ERROR
697
+
698
+ def _check_weasyprint_system_deps(self) -> DependencyStatus:
699
+ """Check WeasyPrint system dependencies."""
700
+ try:
701
+ return DependencyStatus.AVAILABLE
702
+ except ImportError:
703
+ return DependencyStatus.MISSING
704
+ except Exception:
705
+ return DependencyStatus.ERROR
706
+
707
+ def _check_matplotlib_system_deps(self) -> DependencyStatus:
708
+ """Check Matplotlib system dependencies."""
709
+ try:
710
+ import matplotlib.pyplot as plt
711
+
712
+ plt.figure()
713
+ return DependencyStatus.AVAILABLE
714
+ except Exception:
715
+ return DependencyStatus.MISSING
716
+
717
+ def _check_playwright_browsers(self) -> DependencyStatus:
718
+ """Check if Playwright browsers are installed."""
719
+ browsers_dir = Path.home() / ".cache" / "ms-playwright"
720
+ if browsers_dir.exists() and any(browsers_dir.iterdir()):
721
+ return DependencyStatus.AVAILABLE
722
+ else:
723
+ return DependencyStatus.MISSING
724
+
725
+ def _check_playwright_system_deps(self) -> DependencyStatus:
726
+ """Check Playwright system dependencies."""
727
+ try:
728
+ from playwright.sync_api import sync_playwright
729
+
730
+ with sync_playwright() as p:
731
+ browser = p.chromium.launch(headless=True)
732
+ browser.close()
733
+ return DependencyStatus.AVAILABLE
734
+ except Exception:
735
+ return DependencyStatus.MISSING
736
+
737
+ def _get_tesseract_install_command(self) -> str:
738
+ """Get Tesseract installation command for current system."""
739
+ if self.system == "linux":
740
+ return "sudo apt-get install tesseract-ocr tesseract-ocr-eng"
741
+ elif self.system == "darwin":
742
+ return "brew install tesseract"
743
+ elif self.system == "windows":
744
+ return "choco install tesseract"
745
+ return "Please install Tesseract OCR manually"
746
+
747
+ def _get_pillow_system_deps_command(self) -> str:
748
+ """Get Pillow system dependencies installation command."""
749
+ if self.system == "linux":
750
+ return "sudo apt-get install libjpeg-dev zlib1g-dev libpng-dev libtiff-dev libwebp-dev libopenjp2-7-dev"
751
+ elif self.system == "darwin":
752
+ return "brew install libjpeg zlib libpng libtiff webp openjpeg"
753
+ return "Please install image processing libraries manually"
754
+
755
+ def _get_tesseract_lang_install_command(self, lang: str) -> str:
756
+ """Get Tesseract language pack installation command."""
757
+ if self.system == "linux":
758
+ return f"sudo apt-get install tesseract-ocr-{lang}"
759
+ elif self.system == "darwin":
760
+ return f"brew install tesseract-lang-{lang}"
761
+ return f"Please install Tesseract {lang} language pack manually"
762
+
763
+ def _get_java_install_command(self) -> str:
764
+ """Get Java installation command."""
765
+ if self.system == "linux":
766
+ return "sudo apt-get install openjdk-11-jdk"
767
+ elif self.system == "darwin":
768
+ return "brew install openjdk@11"
769
+ elif self.system == "windows":
770
+ return "choco install openjdk11"
771
+ return "Please install Java 11 or later manually"
772
+
773
+ def _get_pyreadstat_install_command(self) -> str:
774
+ """Get pyreadstat installation command."""
775
+ if self.system == "linux":
776
+ return "sudo apt-get install libreadstat-dev && pip install pyreadstat"
777
+ elif self.system == "darwin":
778
+ return "brew install readstat && pip install pyreadstat"
779
+ return "Please install libreadstat and pyreadstat manually"
780
+
781
+ def _get_excel_system_deps_command(self) -> str:
782
+ """Get Excel system dependencies installation command."""
783
+ if self.system == "linux":
784
+ return "sudo apt-get install libxml2-dev libxslt1-dev"
785
+ elif self.system == "darwin":
786
+ return "brew install libxml2 libxslt"
787
+ return "Please install XML processing libraries manually"
788
+
789
+ def _get_weasyprint_install_command(self) -> str:
790
+ """Get WeasyPrint installation command."""
791
+ if self.system == "linux":
792
+ return "sudo apt-get install libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libffi-dev shared-mime-info"
793
+ elif self.system == "darwin":
794
+ return "brew install cairo pango gdk-pixbuf libffi"
795
+ return "Please install WeasyPrint dependencies manually"
796
+
797
+ def _get_matplotlib_system_deps_command(self) -> str:
798
+ """Get Matplotlib system dependencies installation command."""
799
+ if self.system == "linux":
800
+ return "sudo apt-get install libfreetype6-dev libpng-dev libjpeg-dev libtiff-dev libwebp-dev"
801
+ elif self.system == "darwin":
802
+ return "brew install freetype libpng libjpeg libtiff webp"
803
+ return "Please install image processing libraries manually"
804
+
805
+ def check_chart_tool_dependencies(self) -> ToolDependencies:
806
+ """Check dependencies for Chart Tool."""
807
+ system_deps: List[DependencyInfo] = []
808
+ python_deps: List[DependencyInfo] = []
809
+ model_deps: List[DependencyInfo] = []
810
+ optional_deps: List[DependencyInfo] = []
811
+
812
+ # Matplotlib system dependencies
813
+ matplotlib_status = self._check_matplotlib_system_deps()
814
+ system_deps.append(
815
+ DependencyInfo(
816
+ name="Matplotlib System Libraries",
817
+ status=matplotlib_status,
818
+ description="System libraries for chart generation",
819
+ install_command=self._get_matplotlib_system_deps_command(),
820
+ impact="Chart generation may be limited",
821
+ is_critical=False,
822
+ )
823
+ )
824
+
825
+ # Python packages
826
+ python_packages = {
827
+ "pandas": "pandas",
828
+ "matplotlib": "matplotlib",
829
+ "seaborn": "seaborn",
830
+ "plotly": "plotly",
831
+ }
832
+ for pkg_name, import_name in python_packages.items():
833
+ status = self.check_python_package(import_name)
834
+ is_critical = pkg_name in ["pandas", "matplotlib"]
835
+ python_deps.append(
836
+ DependencyInfo(
837
+ name=pkg_name,
838
+ status=status,
839
+ description=f"Python package: {pkg_name}",
840
+ install_command=f"pip install {pkg_name}",
841
+ impact=f"{pkg_name} functionality will be unavailable",
842
+ is_critical=is_critical,
843
+ )
844
+ )
845
+
846
+ return ToolDependencies(
847
+ tool_name="Chart Tool",
848
+ system_deps=system_deps,
849
+ python_deps=python_deps,
850
+ model_deps=model_deps,
851
+ optional_deps=optional_deps,
852
+ )
853
+
854
+ def check_pandas_tool_dependencies(self) -> ToolDependencies:
855
+ """Check dependencies for Pandas Tool."""
856
+ system_deps: List[DependencyInfo] = []
857
+ python_deps: List[DependencyInfo] = []
858
+ model_deps: List[DependencyInfo] = []
859
+ optional_deps: List[DependencyInfo] = []
860
+
861
+ # Python packages
862
+ python_packages = ["pandas", "numpy"]
863
+ for pkg in python_packages:
864
+ status = self.check_python_package(pkg)
865
+ python_deps.append(
866
+ DependencyInfo(
867
+ name=pkg,
868
+ status=status,
869
+ description=f"Python package: {pkg}",
870
+ install_command=f"pip install {pkg}",
871
+ impact=f"{pkg} functionality will be unavailable",
872
+ is_critical=True,
873
+ )
874
+ )
875
+
876
+ return ToolDependencies(
877
+ tool_name="Pandas Tool",
878
+ system_deps=system_deps,
879
+ python_deps=python_deps,
880
+ model_deps=model_deps,
881
+ optional_deps=optional_deps,
882
+ )
883
+
884
+ def check_document_parser_tool_dependencies(self) -> ToolDependencies:
885
+ """Check dependencies for Document Parser Tool."""
886
+ system_deps: List[DependencyInfo] = []
887
+ python_deps: List[DependencyInfo] = []
888
+ model_deps: List[DependencyInfo] = []
889
+ optional_deps: List[DependencyInfo] = []
890
+
891
+ # Note: Document Parser Tool depends on Office Tool, Image Tool, and Scraper Tool
892
+ # We'll check their dependencies
893
+
894
+ # Java Runtime Environment (from Office Tool)
895
+ java_status = self.check_system_command("java", "-version")
896
+ system_deps.append(
897
+ DependencyInfo(
898
+ name="Java Runtime Environment",
899
+ status=java_status,
900
+ description="Java runtime for Apache Tika document parsing",
901
+ install_command=self._get_java_install_command(),
902
+ impact="Document parsing with Tika will be unavailable",
903
+ is_critical=True,
904
+ )
905
+ )
906
+
907
+ # Tesseract OCR (from Image Tool)
908
+ tesseract_status = self.check_system_command("tesseract")
909
+ system_deps.append(
910
+ DependencyInfo(
911
+ name="Tesseract OCR",
912
+ status=tesseract_status,
913
+ description="OCR engine for image text extraction",
914
+ install_command=self._get_tesseract_install_command(),
915
+ impact="OCR functionality will be unavailable",
916
+ is_critical=False,
917
+ )
918
+ )
919
+
920
+ # Python packages
921
+ python_packages = {
922
+ "pdfplumber": "pdfplumber",
923
+ "python-docx": "docx",
924
+ "python-pptx": "pptx",
925
+ "openpyxl": "openpyxl",
926
+ "pytesseract": "pytesseract",
927
+ "PIL": "PIL",
928
+ "beautifulsoup4": "bs4",
929
+ "lxml": "lxml",
930
+ }
931
+ for pkg_name, import_name in python_packages.items():
932
+ status = self.check_python_package(import_name)
933
+ python_deps.append(
934
+ DependencyInfo(
935
+ name=pkg_name,
936
+ status=status,
937
+ description=f"Python package: {pkg_name}",
938
+ install_command=f"pip install {pkg_name}",
939
+ impact=f"{pkg_name} functionality will be unavailable",
940
+ is_critical=True,
941
+ )
942
+ )
943
+
944
+ return ToolDependencies(
945
+ tool_name="Document Parser Tool",
946
+ system_deps=system_deps,
947
+ python_deps=python_deps,
948
+ model_deps=model_deps,
949
+ optional_deps=optional_deps,
950
+ )
951
+
952
+ def check_data_loader_tool_dependencies(self) -> ToolDependencies:
953
+ """Check dependencies for Data Loader Tool."""
954
+ system_deps: List[DependencyInfo] = []
955
+ python_deps: List[DependencyInfo] = []
956
+ model_deps: List[DependencyInfo] = []
957
+ optional_deps: List[DependencyInfo] = []
958
+
959
+ # pyreadstat system dependencies
960
+ pyreadstat_status = self._check_pyreadstat_system_deps()
961
+ system_deps.append(
962
+ DependencyInfo(
963
+ name="libreadstat",
964
+ status=pyreadstat_status,
965
+ description="System library for reading SAS, SPSS, Stata files",
966
+ install_command=self._get_pyreadstat_install_command(),
967
+ impact="SAS, SPSS, Stata file reading will be unavailable",
968
+ is_critical=False,
969
+ )
970
+ )
971
+
972
+ # Python packages
973
+ python_packages = {
974
+ "pandas": "pandas",
975
+ "numpy": "numpy",
976
+ "pyreadstat": "pyreadstat",
977
+ "openpyxl": "openpyxl",
978
+ "pyarrow": "pyarrow",
979
+ }
980
+ for pkg_name, import_name in python_packages.items():
981
+ status = self.check_python_package(import_name)
982
+ is_critical = pkg_name in ["pandas", "numpy"]
983
+ python_deps.append(
984
+ DependencyInfo(
985
+ name=pkg_name,
986
+ status=status,
987
+ description=f"Python package: {pkg_name}",
988
+ install_command=f"pip install {pkg_name}",
989
+ impact=f"{pkg_name} functionality will be unavailable",
990
+ is_critical=is_critical,
991
+ )
992
+ )
993
+
994
+ return ToolDependencies(
995
+ tool_name="Data Loader Tool",
996
+ system_deps=system_deps,
997
+ python_deps=python_deps,
998
+ model_deps=model_deps,
999
+ optional_deps=optional_deps,
1000
+ )
1001
+
1002
+ def check_data_visualizer_tool_dependencies(self) -> ToolDependencies:
1003
+ """Check dependencies for Data Visualizer Tool."""
1004
+ system_deps: List[DependencyInfo] = []
1005
+ python_deps: List[DependencyInfo] = []
1006
+ model_deps: List[DependencyInfo] = []
1007
+ optional_deps: List[DependencyInfo] = []
1008
+
1009
+ # Matplotlib system dependencies
1010
+ matplotlib_status = self._check_matplotlib_system_deps()
1011
+ system_deps.append(
1012
+ DependencyInfo(
1013
+ name="Matplotlib System Libraries",
1014
+ status=matplotlib_status,
1015
+ description="System libraries for visualization",
1016
+ install_command=self._get_matplotlib_system_deps_command(),
1017
+ impact="Visualization may be limited",
1018
+ is_critical=False,
1019
+ )
1020
+ )
1021
+
1022
+ # Python packages
1023
+ python_packages = {
1024
+ "pandas": "pandas",
1025
+ "numpy": "numpy",
1026
+ "matplotlib": "matplotlib",
1027
+ "seaborn": "seaborn",
1028
+ "plotly": "plotly",
1029
+ }
1030
+ for pkg_name, import_name in python_packages.items():
1031
+ status = self.check_python_package(import_name)
1032
+ is_critical = pkg_name in ["pandas", "matplotlib"]
1033
+ python_deps.append(
1034
+ DependencyInfo(
1035
+ name=pkg_name,
1036
+ status=status,
1037
+ description=f"Python package: {pkg_name}",
1038
+ install_command=f"pip install {pkg_name}",
1039
+ impact=f"{pkg_name} functionality will be unavailable",
1040
+ is_critical=is_critical,
1041
+ )
1042
+ )
1043
+
1044
+ return ToolDependencies(
1045
+ tool_name="Data Visualizer Tool",
1046
+ system_deps=system_deps,
1047
+ python_deps=python_deps,
1048
+ model_deps=model_deps,
1049
+ optional_deps=optional_deps,
1050
+ )
1051
+
1052
+ def check_model_trainer_tool_dependencies(self) -> ToolDependencies:
1053
+ """Check dependencies for Model Trainer Tool."""
1054
+ system_deps: List[DependencyInfo] = []
1055
+ python_deps: List[DependencyInfo] = []
1056
+ model_deps: List[DependencyInfo] = []
1057
+ optional_deps: List[DependencyInfo] = []
1058
+
1059
+ # Python packages
1060
+ python_packages = {
1061
+ "pandas": "pandas",
1062
+ "numpy": "numpy",
1063
+ "scikit-learn": "sklearn",
1064
+ "xgboost": "xgboost",
1065
+ "lightgbm": "lightgbm",
1066
+ }
1067
+ for pkg_name, import_name in python_packages.items():
1068
+ status = self.check_python_package(import_name)
1069
+ is_critical = pkg_name in ["pandas", "numpy", "scikit-learn"]
1070
+ python_deps.append(
1071
+ DependencyInfo(
1072
+ name=pkg_name,
1073
+ status=status,
1074
+ description=f"Python package: {pkg_name}",
1075
+ install_command=f"pip install {pkg_name}",
1076
+ impact=f"{pkg_name} functionality will be unavailable",
1077
+ is_critical=is_critical,
1078
+ )
1079
+ )
1080
+
1081
+ return ToolDependencies(
1082
+ tool_name="Model Trainer Tool",
1083
+ system_deps=system_deps,
1084
+ python_deps=python_deps,
1085
+ model_deps=model_deps,
1086
+ optional_deps=optional_deps,
1087
+ )
1088
+
1089
+ def check_apisource_tool_dependencies(self) -> ToolDependencies:
1090
+ """Check dependencies for APISource Tool."""
1091
+ system_deps: List[DependencyInfo] = []
1092
+ python_deps: List[DependencyInfo] = []
1093
+ model_deps: List[DependencyInfo] = []
1094
+ optional_deps: List[DependencyInfo] = []
1095
+
1096
+ # Core Python packages
1097
+ python_packages = ["pydantic", "httpx", "requests"]
1098
+ for pkg in python_packages:
1099
+ status = self.check_python_package(pkg)
1100
+ python_deps.append(
1101
+ DependencyInfo(
1102
+ name=pkg,
1103
+ status=status,
1104
+ description=f"Python package: {pkg}",
1105
+ install_command=f"pip install {pkg}",
1106
+ impact=f"{pkg} functionality will be unavailable",
1107
+ is_critical=True,
1108
+ )
1109
+ )
1110
+
1111
+ # Optional: Redis for caching
1112
+ redis_status = self.check_python_package("redis")
1113
+ optional_deps.append(
1114
+ DependencyInfo(
1115
+ name="redis",
1116
+ status=redis_status,
1117
+ description="Python package: redis (Advanced caching support)",
1118
+ install_command="pip install redis",
1119
+ impact="Advanced caching features will be unavailable",
1120
+ is_critical=False,
1121
+ )
1122
+ )
1123
+
1124
+ return ToolDependencies(
1125
+ tool_name="APISource Tool",
1126
+ system_deps=system_deps,
1127
+ python_deps=python_deps,
1128
+ model_deps=model_deps,
1129
+ optional_deps=optional_deps,
1130
+ )
1131
+
1132
+ def check_search_tool_dependencies(self) -> ToolDependencies:
1133
+ """Check dependencies for Search Tool."""
1134
+ system_deps: List[DependencyInfo] = []
1135
+ python_deps: List[DependencyInfo] = []
1136
+ model_deps: List[DependencyInfo] = []
1137
+ optional_deps: List[DependencyInfo] = []
1138
+
1139
+ # Core Python packages
1140
+ python_packages = ["pydantic", "httpx", "requests"]
1141
+ for pkg in python_packages:
1142
+ status = self.check_python_package(pkg)
1143
+ python_deps.append(
1144
+ DependencyInfo(
1145
+ name=pkg,
1146
+ status=status,
1147
+ description=f"Python package: {pkg}",
1148
+ install_command=f"pip install {pkg}",
1149
+ impact=f"{pkg} functionality will be unavailable",
1150
+ is_critical=True,
1151
+ )
1152
+ )
1153
+
1154
+ # Optional: Redis for intelligent caching
1155
+ redis_status = self.check_python_package("redis")
1156
+ optional_deps.append(
1157
+ DependencyInfo(
1158
+ name="redis",
1159
+ status=redis_status,
1160
+ description="Python package: redis (Intelligent caching support)",
1161
+ install_command="pip install redis",
1162
+ impact="Intelligent caching features will be unavailable",
1163
+ is_critical=False,
1164
+ )
1165
+ )
1166
+
1167
+ # Optional: BeautifulSoup for HTML parsing
1168
+ bs4_status = self.check_python_package("bs4")
1169
+ optional_deps.append(
1170
+ DependencyInfo(
1171
+ name="beautifulsoup4",
1172
+ status=bs4_status,
1173
+ description="Python package: beautifulsoup4 (HTML parsing)",
1174
+ install_command="pip install beautifulsoup4",
1175
+ impact="HTML parsing features will be unavailable",
1176
+ is_critical=False,
1177
+ )
1178
+ )
1179
+
1180
+ return ToolDependencies(
1181
+ tool_name="Search Tool",
1182
+ system_deps=system_deps,
1183
+ python_deps=python_deps,
1184
+ model_deps=model_deps,
1185
+ optional_deps=optional_deps,
1186
+ )
1187
+
1188
+ def check_research_tool_dependencies(self) -> ToolDependencies:
1189
+ """Check dependencies for Research Tool."""
1190
+ system_deps: List[DependencyInfo] = []
1191
+ python_deps: List[DependencyInfo] = []
1192
+ model_deps: List[DependencyInfo] = []
1193
+ optional_deps: List[DependencyInfo] = []
1194
+
1195
+ # Core Python packages
1196
+ python_packages = ["spacy", "scipy", "nltk"]
1197
+ for pkg in python_packages:
1198
+ status = self.check_python_package(pkg)
1199
+ python_deps.append(
1200
+ DependencyInfo(
1201
+ name=pkg,
1202
+ status=status,
1203
+ description=f"Python package: {pkg}",
1204
+ install_command=f"pip install {pkg}",
1205
+ impact=f"{pkg} functionality will be unavailable",
1206
+ is_critical=True,
1207
+ )
1208
+ )
1209
+
1210
+ # spaCy models
1211
+ spacy_models = ["en_core_web_sm"]
1212
+ for model in spacy_models:
1213
+ status = self._check_spacy_model(model)
1214
+ model_deps.append(
1215
+ DependencyInfo(
1216
+ name=f"spaCy {model}",
1217
+ status=status,
1218
+ description=f"spaCy model: {model}",
1219
+ install_command=f"python -m spacy download {model}",
1220
+ impact=f"Text analysis in English will be unavailable",
1221
+ is_critical=True,
1222
+ )
1223
+ )
1224
+
1225
+ # NLTK data
1226
+ nltk_data = ["stopwords", "punkt", "wordnet", "averaged_perceptron_tagger"]
1227
+ for data in nltk_data:
1228
+ status = self._check_nltk_data(data)
1229
+ install_cmd = "aiecs-download-nlp-data --download"
1230
+ model_deps.append(
1231
+ DependencyInfo(
1232
+ name=f"NLTK {data}",
1233
+ status=status,
1234
+ description=f"NLTK data: {data}",
1235
+ install_command=install_cmd,
1236
+ impact=f"NLTK {data} functionality will be unavailable",
1237
+ is_critical=True,
1238
+ )
1239
+ )
1240
+
1241
+ return ToolDependencies(
1242
+ tool_name="Research Tool",
1243
+ system_deps=system_deps,
1244
+ python_deps=python_deps,
1245
+ model_deps=model_deps,
1246
+ optional_deps=optional_deps,
1247
+ )
1248
+
1249
+ def check_document_writer_tool_dependencies(self) -> ToolDependencies:
1250
+ """Check dependencies for Document Writer Tool."""
1251
+ system_deps: List[DependencyInfo] = []
1252
+ python_deps: List[DependencyInfo] = []
1253
+ model_deps: List[DependencyInfo] = []
1254
+ optional_deps: List[DependencyInfo] = []
1255
+
1256
+ # Core Python packages
1257
+ core_packages = {
1258
+ "python-docx": "docx",
1259
+ "openpyxl": "openpyxl",
1260
+ "python-pptx": "pptx",
1261
+ "pillow": "PIL",
1262
+ }
1263
+ for pkg_name, import_name in core_packages.items():
1264
+ status = self.check_python_package(import_name)
1265
+ python_deps.append(
1266
+ DependencyInfo(
1267
+ name=pkg_name,
1268
+ status=status,
1269
+ description=f"Python package: {pkg_name}",
1270
+ install_command=f"pip install {pkg_name}",
1271
+ impact=f"{pkg_name} document writing functionality will be unavailable",
1272
+ is_critical=True,
1273
+ )
1274
+ )
1275
+
1276
+ # Pillow system dependencies
1277
+ pillow_status = self._check_pillow_system_deps()
1278
+ system_deps.append(
1279
+ DependencyInfo(
1280
+ name="Pillow System Libraries",
1281
+ status=pillow_status,
1282
+ description="System libraries for image processing (libjpeg, libpng, etc.)",
1283
+ install_command=self._get_pillow_system_deps_command(),
1284
+ impact="Image processing in documents may be limited",
1285
+ is_critical=False,
1286
+ )
1287
+ )
1288
+
1289
+ # Optional: XlsxWriter for advanced Excel features
1290
+ xlsxwriter_status = self.check_python_package("xlsxwriter")
1291
+ optional_deps.append(
1292
+ DependencyInfo(
1293
+ name="xlsxwriter",
1294
+ status=xlsxwriter_status,
1295
+ description="Python package: xlsxwriter (Advanced Excel writing)",
1296
+ install_command="pip install xlsxwriter",
1297
+ impact="Advanced Excel features will be unavailable",
1298
+ is_critical=False,
1299
+ )
1300
+ )
1301
+
1302
+ return ToolDependencies(
1303
+ tool_name="Document Writer Tool",
1304
+ system_deps=system_deps,
1305
+ python_deps=python_deps,
1306
+ model_deps=model_deps,
1307
+ optional_deps=optional_deps,
1308
+ )
1309
+
1310
+ def check_statistical_analyzer_tool_dependencies(self) -> ToolDependencies:
1311
+ """Check dependencies for Statistical Analyzer Tool."""
1312
+ system_deps: List[DependencyInfo] = []
1313
+ python_deps: List[DependencyInfo] = []
1314
+ model_deps: List[DependencyInfo] = []
1315
+ optional_deps: List[DependencyInfo] = []
1316
+
1317
+ # Core Python packages
1318
+ core_packages = {
1319
+ "pandas": "pandas",
1320
+ "numpy": "numpy",
1321
+ "scipy": "scipy",
1322
+ "statsmodels": "statsmodels",
1323
+ "scikit-learn": "sklearn",
1324
+ }
1325
+ for pkg_name, import_name in core_packages.items():
1326
+ status = self.check_python_package(import_name)
1327
+ python_deps.append(
1328
+ DependencyInfo(
1329
+ name=pkg_name,
1330
+ status=status,
1331
+ description=f"Python package: {pkg_name}",
1332
+ install_command=f"pip install {pkg_name}",
1333
+ impact=f"{pkg_name} statistical methods will be unavailable",
1334
+ is_critical=True,
1335
+ )
1336
+ )
1337
+
1338
+ # Optional: matplotlib for visualization
1339
+ matplotlib_status = self.check_python_package("matplotlib")
1340
+ optional_deps.append(
1341
+ DependencyInfo(
1342
+ name="matplotlib",
1343
+ status=matplotlib_status,
1344
+ description="Python package: matplotlib (Statistical visualization)",
1345
+ install_command="pip install matplotlib",
1346
+ impact="Statistical visualization features will be unavailable",
1347
+ is_critical=False,
1348
+ )
1349
+ )
1350
+
1351
+ # Optional: seaborn for advanced visualization
1352
+ seaborn_status = self.check_python_package("seaborn")
1353
+ optional_deps.append(
1354
+ DependencyInfo(
1355
+ name="seaborn",
1356
+ status=seaborn_status,
1357
+ description="Python package: seaborn (Advanced statistical visualization)",
1358
+ install_command="pip install seaborn",
1359
+ impact="Advanced visualization features will be unavailable",
1360
+ is_critical=False,
1361
+ )
1362
+ )
1363
+
1364
+ return ToolDependencies(
1365
+ tool_name="Statistical Analyzer Tool",
1366
+ system_deps=system_deps,
1367
+ python_deps=python_deps,
1368
+ model_deps=model_deps,
1369
+ optional_deps=optional_deps,
1370
+ )
1371
+
1372
+ def check_data_profiler_tool_dependencies(self) -> ToolDependencies:
1373
+ """Check dependencies for Data Profiler Tool."""
1374
+ system_deps: List[DependencyInfo] = []
1375
+ python_deps: List[DependencyInfo] = []
1376
+ model_deps: List[DependencyInfo] = []
1377
+ optional_deps: List[DependencyInfo] = []
1378
+
1379
+ # Core Python packages
1380
+ core_packages = ["pandas", "numpy", "scipy"]
1381
+ for pkg in core_packages:
1382
+ status = self.check_python_package(pkg)
1383
+ python_deps.append(
1384
+ DependencyInfo(
1385
+ name=pkg,
1386
+ status=status,
1387
+ description=f"Python package: {pkg}",
1388
+ install_command=f"pip install {pkg}",
1389
+ impact=f"{pkg} data profiling functionality will be unavailable",
1390
+ is_critical=True,
1391
+ )
1392
+ )
1393
+
1394
+ # Optional: ydata-profiling for comprehensive profiling
1395
+ ydata_status = self.check_python_package("ydata_profiling")
1396
+ optional_deps.append(
1397
+ DependencyInfo(
1398
+ name="ydata-profiling",
1399
+ status=ydata_status,
1400
+ description="Python package: ydata-profiling (Comprehensive data profiling)",
1401
+ install_command="pip install ydata-profiling",
1402
+ impact="Comprehensive profiling reports will be unavailable",
1403
+ is_critical=False,
1404
+ )
1405
+ )
1406
+
1407
+ # Optional: matplotlib for visualization
1408
+ matplotlib_status = self.check_python_package("matplotlib")
1409
+ optional_deps.append(
1410
+ DependencyInfo(
1411
+ name="matplotlib",
1412
+ status=matplotlib_status,
1413
+ description="Python package: matplotlib (Profile visualization)",
1414
+ install_command="pip install matplotlib",
1415
+ impact="Visual profiling features will be unavailable",
1416
+ is_critical=False,
1417
+ )
1418
+ )
1419
+
1420
+ return ToolDependencies(
1421
+ tool_name="Data Profiler Tool",
1422
+ system_deps=system_deps,
1423
+ python_deps=python_deps,
1424
+ model_deps=model_deps,
1425
+ optional_deps=optional_deps,
1426
+ )
1427
+
1428
+ def check_data_transformer_tool_dependencies(self) -> ToolDependencies:
1429
+ """Check dependencies for Data Transformer Tool."""
1430
+ system_deps: List[DependencyInfo] = []
1431
+ python_deps: List[DependencyInfo] = []
1432
+ model_deps: List[DependencyInfo] = []
1433
+ optional_deps: List[DependencyInfo] = []
1434
+
1435
+ # Core Python packages
1436
+ core_packages = {
1437
+ "pandas": "pandas",
1438
+ "numpy": "numpy",
1439
+ "scikit-learn": "sklearn",
1440
+ }
1441
+ for pkg_name, import_name in core_packages.items():
1442
+ status = self.check_python_package(import_name)
1443
+ python_deps.append(
1444
+ DependencyInfo(
1445
+ name=pkg_name,
1446
+ status=status,
1447
+ description=f"Python package: {pkg_name}",
1448
+ install_command=f"pip install {pkg_name}",
1449
+ impact=f"{pkg_name} data transformation functionality will be unavailable",
1450
+ is_critical=True,
1451
+ )
1452
+ )
1453
+
1454
+ # Optional: scipy for advanced transformations
1455
+ scipy_status = self.check_python_package("scipy")
1456
+ optional_deps.append(
1457
+ DependencyInfo(
1458
+ name="scipy",
1459
+ status=scipy_status,
1460
+ description="Python package: scipy (Advanced transformations)",
1461
+ install_command="pip install scipy",
1462
+ impact="Advanced transformation methods will be unavailable",
1463
+ is_critical=False,
1464
+ )
1465
+ )
1466
+
1467
+ # Optional: category_encoders for categorical encoding
1468
+ catencoder_status = self.check_python_package("category_encoders")
1469
+ optional_deps.append(
1470
+ DependencyInfo(
1471
+ name="category_encoders",
1472
+ status=catencoder_status,
1473
+ description="Python package: category_encoders (Advanced categorical encoding)",
1474
+ install_command="pip install category_encoders",
1475
+ impact="Advanced encoding methods will be unavailable",
1476
+ is_critical=False,
1477
+ )
1478
+ )
1479
+
1480
+ return ToolDependencies(
1481
+ tool_name="Data Transformer Tool",
1482
+ system_deps=system_deps,
1483
+ python_deps=python_deps,
1484
+ model_deps=model_deps,
1485
+ optional_deps=optional_deps,
1486
+ )
1487
+
1488
+ def check_generic_tool_dependencies(self, tool_name: str, display_name: str) -> ToolDependencies:
1489
+ """
1490
+ Generic dependency check for simple tools (mainly orchestrators).
1491
+ These tools typically only require basic Python dependencies.
1492
+ """
1493
+ system_deps: List[DependencyInfo] = []
1494
+ python_deps: List[DependencyInfo] = []
1495
+ model_deps: List[DependencyInfo] = []
1496
+ optional_deps: List[DependencyInfo] = []
1497
+
1498
+ # Basic Python packages common to all tools
1499
+ python_packages = ["pydantic"]
1500
+ for pkg in python_packages:
1501
+ status = self.check_python_package(pkg)
1502
+ python_deps.append(
1503
+ DependencyInfo(
1504
+ name=pkg,
1505
+ status=status,
1506
+ description=f"Python package: {pkg}",
1507
+ install_command=f"pip install {pkg}",
1508
+ impact=f"{pkg} functionality will be unavailable",
1509
+ is_critical=True,
1510
+ )
1511
+ )
1512
+
1513
+ return ToolDependencies(
1514
+ tool_name=display_name,
1515
+ system_deps=system_deps,
1516
+ python_deps=python_deps,
1517
+ model_deps=model_deps,
1518
+ optional_deps=optional_deps,
1519
+ )
1520
+
1521
+ def check_kg_builder_tool_dependencies(self) -> ToolDependencies:
1522
+ """Check dependencies for Knowledge Graph Builder Tool."""
1523
+ system_deps: List[DependencyInfo] = []
1524
+ python_deps: List[DependencyInfo] = []
1525
+ model_deps: List[DependencyInfo] = []
1526
+ optional_deps: List[DependencyInfo] = []
1527
+
1528
+ # Core Python packages
1529
+ core_packages = ["pydantic", "networkx"]
1530
+ for pkg in core_packages:
1531
+ status = self.check_python_package(pkg)
1532
+ python_deps.append(
1533
+ DependencyInfo(
1534
+ name=pkg,
1535
+ status=status,
1536
+ description=f"Python package: {pkg}",
1537
+ install_command=f"pip install {pkg}",
1538
+ impact=f"{pkg} graph building functionality will be unavailable",
1539
+ is_critical=True,
1540
+ )
1541
+ )
1542
+
1543
+ # Optional: Neo4j for graph database
1544
+ neo4j_status = self.check_python_package("neo4j")
1545
+ optional_deps.append(
1546
+ DependencyInfo(
1547
+ name="neo4j",
1548
+ status=neo4j_status,
1549
+ description="Python package: neo4j (Graph database support)",
1550
+ install_command="pip install neo4j",
1551
+ impact="Neo4j graph database features will be unavailable",
1552
+ is_critical=False,
1553
+ )
1554
+ )
1555
+
1556
+ return ToolDependencies(
1557
+ tool_name="Knowledge Graph Builder Tool",
1558
+ system_deps=system_deps,
1559
+ python_deps=python_deps,
1560
+ model_deps=model_deps,
1561
+ optional_deps=optional_deps,
1562
+ )
1563
+
1564
+ def check_graph_search_tool_dependencies(self) -> ToolDependencies:
1565
+ """Check dependencies for Graph Search Tool."""
1566
+ system_deps: List[DependencyInfo] = []
1567
+ python_deps: List[DependencyInfo] = []
1568
+ model_deps: List[DependencyInfo] = []
1569
+ optional_deps: List[DependencyInfo] = []
1570
+
1571
+ # Core Python packages
1572
+ core_packages = ["pydantic", "networkx"]
1573
+ for pkg in core_packages:
1574
+ status = self.check_python_package(pkg)
1575
+ python_deps.append(
1576
+ DependencyInfo(
1577
+ name=pkg,
1578
+ status=status,
1579
+ description=f"Python package: {pkg}",
1580
+ install_command=f"pip install {pkg}",
1581
+ impact=f"{pkg} graph search functionality will be unavailable",
1582
+ is_critical=True,
1583
+ )
1584
+ )
1585
+
1586
+ return ToolDependencies(
1587
+ tool_name="Graph Search Tool",
1588
+ system_deps=system_deps,
1589
+ python_deps=python_deps,
1590
+ model_deps=model_deps,
1591
+ optional_deps=optional_deps,
1592
+ )
1593
+
1594
+ def check_graph_reasoning_tool_dependencies(self) -> ToolDependencies:
1595
+ """Check dependencies for Graph Reasoning Tool."""
1596
+ system_deps: List[DependencyInfo] = []
1597
+ python_deps: List[DependencyInfo] = []
1598
+ model_deps: List[DependencyInfo] = []
1599
+ optional_deps: List[DependencyInfo] = []
1600
+
1601
+ # Core Python packages
1602
+ core_packages = ["pydantic", "networkx"]
1603
+ for pkg in core_packages:
1604
+ status = self.check_python_package(pkg)
1605
+ python_deps.append(
1606
+ DependencyInfo(
1607
+ name=pkg,
1608
+ status=status,
1609
+ description=f"Python package: {pkg}",
1610
+ install_command=f"pip install {pkg}",
1611
+ impact=f"{pkg} graph reasoning functionality will be unavailable",
1612
+ is_critical=True,
1613
+ )
1614
+ )
1615
+
1616
+ return ToolDependencies(
1617
+ tool_name="Graph Reasoning Tool",
1618
+ system_deps=system_deps,
1619
+ python_deps=python_deps,
1620
+ model_deps=model_deps,
1621
+ optional_deps=optional_deps,
1622
+ )
1623
+
1624
+ def check_document_layout_tool_dependencies(self) -> ToolDependencies:
1625
+ """Check dependencies for Document Layout Tool."""
1626
+ return self.check_generic_tool_dependencies("document_layout", "Document Layout Tool")
1627
+
1628
+ def check_content_insertion_tool_dependencies(self) -> ToolDependencies:
1629
+ """Check dependencies for Content Insertion Tool."""
1630
+ return self.check_generic_tool_dependencies("content_insertion", "Content Insertion Tool")
1631
+
1632
+ def check_document_creator_tool_dependencies(self) -> ToolDependencies:
1633
+ """Check dependencies for Document Creator Tool."""
1634
+ return self.check_generic_tool_dependencies("document_creator", "Document Creator Tool")
1635
+
1636
+ def check_ai_document_writer_orchestrator_dependencies(self) -> ToolDependencies:
1637
+ """Check dependencies for AI Document Writer Orchestrator."""
1638
+ return self.check_generic_tool_dependencies("ai_document_writer_orchestrator", "AI Document Writer Orchestrator")
1639
+
1640
+ def check_ai_document_orchestrator_dependencies(self) -> ToolDependencies:
1641
+ """Check dependencies for AI Document Orchestrator."""
1642
+ return self.check_generic_tool_dependencies("ai_document_orchestrator", "AI Document Orchestrator")
1643
+
1644
+ def check_ai_insight_generator_tool_dependencies(self) -> ToolDependencies:
1645
+ """Check dependencies for AI Insight Generator Tool."""
1646
+ return self.check_generic_tool_dependencies("ai_insight_generator", "AI Insight Generator Tool")
1647
+
1648
+ def check_ai_data_analysis_orchestrator_dependencies(self) -> ToolDependencies:
1649
+ """Check dependencies for AI Data Analysis Orchestrator."""
1650
+ return self.check_generic_tool_dependencies("ai_data_analysis_orchestrator", "AI Data Analysis Orchestrator")
1651
+
1652
+ def check_ai_report_orchestrator_tool_dependencies(self) -> ToolDependencies:
1653
+ """Check dependencies for AI Report Orchestrator Tool."""
1654
+ return self.check_generic_tool_dependencies("ai_report_orchestrator", "AI Report Orchestrator Tool")
1655
+
1656
+ def check_all_dependencies(self) -> Dict[str, ToolDependencies]:
1657
+ """Check all tool dependencies."""
1658
+ self.logger.info("Starting comprehensive dependency check...")
1659
+
1660
+ tools = {
1661
+ # Task tools (11 total)
1662
+ "image": self.check_image_tool_dependencies(),
1663
+ "classifier": self.check_classfire_tool_dependencies(), # Note: registered as "classifier"
1664
+ "office": self.check_office_tool_dependencies(),
1665
+ "stats": self.check_stats_tool_dependencies(),
1666
+ "report": self.check_report_tool_dependencies(),
1667
+ "scraper": self.check_scraper_tool_dependencies(),
1668
+ "chart": self.check_chart_tool_dependencies(),
1669
+ "pandas": self.check_pandas_tool_dependencies(),
1670
+ "apisource": self.check_apisource_tool_dependencies(),
1671
+ "search": self.check_search_tool_dependencies(),
1672
+ "research": self.check_research_tool_dependencies(),
1673
+
1674
+ # Document tools (7 total)
1675
+ "document_parser": self.check_document_parser_tool_dependencies(),
1676
+ "document_writer": self.check_document_writer_tool_dependencies(),
1677
+ "document_layout": self.check_document_layout_tool_dependencies(),
1678
+ "content_insertion": self.check_content_insertion_tool_dependencies(),
1679
+ "document_creator": self.check_document_creator_tool_dependencies(),
1680
+ "ai_document_writer_orchestrator": self.check_ai_document_writer_orchestrator_dependencies(),
1681
+ "ai_document_orchestrator": self.check_ai_document_orchestrator_dependencies(),
1682
+
1683
+ # Statistics tools (9 total)
1684
+ "data_loader": self.check_data_loader_tool_dependencies(),
1685
+ "data_visualizer": self.check_data_visualizer_tool_dependencies(),
1686
+ "model_trainer": self.check_model_trainer_tool_dependencies(),
1687
+ "statistical_analyzer": self.check_statistical_analyzer_tool_dependencies(),
1688
+ "data_profiler": self.check_data_profiler_tool_dependencies(),
1689
+ "data_transformer": self.check_data_transformer_tool_dependencies(),
1690
+ "ai_insight_generator": self.check_ai_insight_generator_tool_dependencies(),
1691
+ "ai_data_analysis_orchestrator": self.check_ai_data_analysis_orchestrator_dependencies(),
1692
+ "ai_report_orchestrator": self.check_ai_report_orchestrator_tool_dependencies(),
1693
+
1694
+ # Knowledge graph tools (3 total)
1695
+ "kg_builder": self.check_kg_builder_tool_dependencies(),
1696
+ "graph_search": self.check_graph_search_tool_dependencies(),
1697
+ "graph_reasoning": self.check_graph_reasoning_tool_dependencies(),
1698
+ }
1699
+
1700
+ return tools
1701
+
1702
+ def generate_report(self, tools: Dict[str, ToolDependencies]) -> str:
1703
+ """Generate a comprehensive dependency report."""
1704
+ report = []
1705
+ report.append("=" * 80)
1706
+ report.append("AIECS DEPENDENCY CHECK REPORT")
1707
+ report.append("=" * 80)
1708
+ report.append(f"System: {self.system.title()} {self.architecture}")
1709
+ report.append(f"Python: {self.python_version}")
1710
+ report.append(f"Package Manager: {self.get_system_package_manager()}")
1711
+ report.append("")
1712
+
1713
+ total_issues = 0
1714
+ critical_issues = 0
1715
+
1716
+ for tool_name, tool_deps in tools.items():
1717
+ report.append(f"šŸ”§ {tool_deps.tool_name.upper()}")
1718
+ report.append("-" * 40)
1719
+
1720
+ # System dependencies
1721
+ if tool_deps.system_deps:
1722
+ report.append("šŸ“¦ System Dependencies:")
1723
+ for dep in tool_deps.system_deps:
1724
+ status_icon = "āœ…" if dep.status == DependencyStatus.AVAILABLE else "āŒ" if dep.is_critical else "āš ļø"
1725
+ report.append(f" {status_icon} {dep.name}: {dep.status.value}")
1726
+ if dep.status != DependencyStatus.AVAILABLE:
1727
+ total_issues += 1
1728
+ if dep.is_critical:
1729
+ critical_issues += 1
1730
+ if dep.install_command:
1731
+ report.append(f" Install: {dep.install_command}")
1732
+ if dep.impact:
1733
+ report.append(f" Impact: {dep.impact}")
1734
+ report.append("")
1735
+
1736
+ # Python dependencies
1737
+ if tool_deps.python_deps:
1738
+ report.append("šŸ Python Dependencies:")
1739
+ for dep in tool_deps.python_deps:
1740
+ status_icon = "āœ…" if dep.status == DependencyStatus.AVAILABLE else "āŒ"
1741
+ report.append(f" {status_icon} {dep.name}: {dep.status.value}")
1742
+ if dep.status != DependencyStatus.AVAILABLE:
1743
+ total_issues += 1
1744
+ critical_issues += 1
1745
+ if dep.install_command:
1746
+ report.append(f" Install: {dep.install_command}")
1747
+ if dep.impact:
1748
+ report.append(f" Impact: {dep.impact}")
1749
+ report.append("")
1750
+
1751
+ # Model dependencies
1752
+ if tool_deps.model_deps:
1753
+ report.append("šŸ¤– Model Dependencies:")
1754
+ for dep in tool_deps.model_deps:
1755
+ status_icon = "āœ…" if dep.status == DependencyStatus.AVAILABLE else "āŒ" if dep.is_critical else "āš ļø"
1756
+ report.append(f" {status_icon} {dep.name}: {dep.status.value}")
1757
+ if dep.status != DependencyStatus.AVAILABLE:
1758
+ total_issues += 1
1759
+ if dep.is_critical:
1760
+ critical_issues += 1
1761
+ if dep.install_command:
1762
+ report.append(f" Install: {dep.install_command}")
1763
+ if dep.impact:
1764
+ report.append(f" Impact: {dep.impact}")
1765
+ report.append("")
1766
+
1767
+ # Optional dependencies
1768
+ if tool_deps.optional_deps:
1769
+ report.append("šŸ”§ Optional Dependencies:")
1770
+ for dep in tool_deps.optional_deps:
1771
+ status_icon = "āœ…" if dep.status == DependencyStatus.AVAILABLE else "āš ļø"
1772
+ report.append(f" {status_icon} {dep.name}: {dep.status.value}")
1773
+ if dep.status != DependencyStatus.AVAILABLE and dep.install_command:
1774
+ report.append(f" Install: {dep.install_command}")
1775
+ report.append("")
1776
+
1777
+ # Summary
1778
+ report.append("=" * 80)
1779
+ report.append("SUMMARY")
1780
+ report.append("=" * 80)
1781
+ report.append(f"Total Issues: {total_issues}")
1782
+ report.append(f"Critical Issues: {critical_issues}")
1783
+ report.append(f"Optional Issues: {total_issues - critical_issues}")
1784
+
1785
+ if critical_issues == 0:
1786
+ report.append("")
1787
+ report.append("šŸŽ‰ All critical dependencies are available!")
1788
+ report.append("AIECS is ready to use with full functionality.")
1789
+ else:
1790
+ report.append("")
1791
+ report.append("āš ļø Some critical dependencies are missing.")
1792
+ report.append("Please install the missing dependencies to enable full functionality.")
1793
+
1794
+ return "\n".join(report)
1795
+
1796
+ def save_report(self, report: str, filename: str = "dependency_report.txt"):
1797
+ """Save the report to a file."""
1798
+ with open(filename, "w", encoding="utf-8") as f:
1799
+ f.write(report)
1800
+ self.logger.info(f"Report saved to {filename}")
1801
+
1802
+
1803
+ def main():
1804
+ """Main function."""
1805
+ checker = DependencyChecker()
1806
+
1807
+ print("šŸ” Checking AIECS dependencies...")
1808
+ print("This may take a few minutes for model checks...")
1809
+ print()
1810
+
1811
+ # Check all dependencies
1812
+ tools = checker.check_all_dependencies()
1813
+
1814
+ # Generate and display report
1815
+ report = checker.generate_report(tools)
1816
+ print(report)
1817
+
1818
+ # Save report
1819
+ checker.save_report(report)
1820
+
1821
+ # Return exit code based on critical issues
1822
+ critical_issues = sum(
1823
+ 1 for tool_deps in tools.values() for dep in tool_deps.system_deps + tool_deps.python_deps + tool_deps.model_deps if dep.status != DependencyStatus.AVAILABLE and dep.is_critical
1824
+ )
1825
+
1826
+ if critical_issues == 0:
1827
+ print("\nāœ… All critical dependencies are available!")
1828
+ return 0
1829
+ else:
1830
+ print(f"\nāŒ {critical_issues} critical dependencies are missing.")
1831
+ return 1
1832
+
1833
+
1834
+ if __name__ == "__main__":
1835
+ sys.exit(main())