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.
- aiecs/__init__.py +13 -16
- aiecs/__main__.py +7 -7
- aiecs/aiecs_client.py +269 -75
- aiecs/application/executors/operation_executor.py +79 -54
- aiecs/application/knowledge_graph/__init__.py +7 -0
- aiecs/application/knowledge_graph/builder/__init__.py +37 -0
- aiecs/application/knowledge_graph/builder/data_quality.py +302 -0
- aiecs/application/knowledge_graph/builder/data_reshaping.py +293 -0
- aiecs/application/knowledge_graph/builder/document_builder.py +369 -0
- aiecs/application/knowledge_graph/builder/graph_builder.py +490 -0
- aiecs/application/knowledge_graph/builder/import_optimizer.py +396 -0
- aiecs/application/knowledge_graph/builder/schema_inference.py +462 -0
- aiecs/application/knowledge_graph/builder/schema_mapping.py +563 -0
- aiecs/application/knowledge_graph/builder/structured_pipeline.py +1384 -0
- aiecs/application/knowledge_graph/builder/text_chunker.py +317 -0
- aiecs/application/knowledge_graph/extractors/__init__.py +27 -0
- aiecs/application/knowledge_graph/extractors/base.py +98 -0
- aiecs/application/knowledge_graph/extractors/llm_entity_extractor.py +422 -0
- aiecs/application/knowledge_graph/extractors/llm_relation_extractor.py +347 -0
- aiecs/application/knowledge_graph/extractors/ner_entity_extractor.py +241 -0
- aiecs/application/knowledge_graph/fusion/__init__.py +78 -0
- aiecs/application/knowledge_graph/fusion/ab_testing.py +395 -0
- aiecs/application/knowledge_graph/fusion/abbreviation_expander.py +327 -0
- aiecs/application/knowledge_graph/fusion/alias_index.py +597 -0
- aiecs/application/knowledge_graph/fusion/alias_matcher.py +384 -0
- aiecs/application/knowledge_graph/fusion/cache_coordinator.py +343 -0
- aiecs/application/knowledge_graph/fusion/entity_deduplicator.py +433 -0
- aiecs/application/knowledge_graph/fusion/entity_linker.py +511 -0
- aiecs/application/knowledge_graph/fusion/evaluation_dataset.py +240 -0
- aiecs/application/knowledge_graph/fusion/knowledge_fusion.py +632 -0
- aiecs/application/knowledge_graph/fusion/matching_config.py +489 -0
- aiecs/application/knowledge_graph/fusion/name_normalizer.py +352 -0
- aiecs/application/knowledge_graph/fusion/relation_deduplicator.py +183 -0
- aiecs/application/knowledge_graph/fusion/semantic_name_matcher.py +464 -0
- aiecs/application/knowledge_graph/fusion/similarity_pipeline.py +534 -0
- aiecs/application/knowledge_graph/pattern_matching/__init__.py +21 -0
- aiecs/application/knowledge_graph/pattern_matching/pattern_matcher.py +342 -0
- aiecs/application/knowledge_graph/pattern_matching/query_executor.py +366 -0
- aiecs/application/knowledge_graph/profiling/__init__.py +12 -0
- aiecs/application/knowledge_graph/profiling/query_plan_visualizer.py +195 -0
- aiecs/application/knowledge_graph/profiling/query_profiler.py +223 -0
- aiecs/application/knowledge_graph/reasoning/__init__.py +27 -0
- aiecs/application/knowledge_graph/reasoning/evidence_synthesis.py +341 -0
- aiecs/application/knowledge_graph/reasoning/inference_engine.py +500 -0
- aiecs/application/knowledge_graph/reasoning/logic_form_parser.py +163 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/__init__.py +79 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/ast_builder.py +513 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/ast_nodes.py +913 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/ast_validator.py +866 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/error_handler.py +475 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/parser.py +396 -0
- aiecs/application/knowledge_graph/reasoning/logic_parser/query_context.py +208 -0
- aiecs/application/knowledge_graph/reasoning/logic_query_integration.py +170 -0
- aiecs/application/knowledge_graph/reasoning/query_planner.py +855 -0
- aiecs/application/knowledge_graph/reasoning/reasoning_engine.py +518 -0
- aiecs/application/knowledge_graph/retrieval/__init__.py +27 -0
- aiecs/application/knowledge_graph/retrieval/query_intent_classifier.py +211 -0
- aiecs/application/knowledge_graph/retrieval/retrieval_strategies.py +592 -0
- aiecs/application/knowledge_graph/retrieval/strategy_types.py +23 -0
- aiecs/application/knowledge_graph/search/__init__.py +59 -0
- aiecs/application/knowledge_graph/search/hybrid_search.py +457 -0
- aiecs/application/knowledge_graph/search/reranker.py +293 -0
- aiecs/application/knowledge_graph/search/reranker_strategies.py +535 -0
- aiecs/application/knowledge_graph/search/text_similarity.py +392 -0
- aiecs/application/knowledge_graph/traversal/__init__.py +15 -0
- aiecs/application/knowledge_graph/traversal/enhanced_traversal.py +305 -0
- aiecs/application/knowledge_graph/traversal/path_scorer.py +271 -0
- aiecs/application/knowledge_graph/validators/__init__.py +13 -0
- aiecs/application/knowledge_graph/validators/relation_validator.py +239 -0
- aiecs/application/knowledge_graph/visualization/__init__.py +11 -0
- aiecs/application/knowledge_graph/visualization/graph_visualizer.py +313 -0
- aiecs/common/__init__.py +9 -0
- aiecs/common/knowledge_graph/__init__.py +17 -0
- aiecs/common/knowledge_graph/runnable.py +471 -0
- aiecs/config/__init__.py +20 -5
- aiecs/config/config.py +762 -31
- aiecs/config/graph_config.py +131 -0
- aiecs/config/tool_config.py +435 -0
- aiecs/core/__init__.py +29 -13
- aiecs/core/interface/__init__.py +2 -2
- aiecs/core/interface/execution_interface.py +22 -22
- aiecs/core/interface/storage_interface.py +37 -88
- aiecs/core/registry/__init__.py +31 -0
- aiecs/core/registry/service_registry.py +92 -0
- aiecs/domain/__init__.py +270 -1
- aiecs/domain/agent/__init__.py +191 -0
- aiecs/domain/agent/base_agent.py +3949 -0
- aiecs/domain/agent/exceptions.py +99 -0
- aiecs/domain/agent/graph_aware_mixin.py +569 -0
- aiecs/domain/agent/hybrid_agent.py +1731 -0
- aiecs/domain/agent/integration/__init__.py +29 -0
- aiecs/domain/agent/integration/context_compressor.py +216 -0
- aiecs/domain/agent/integration/context_engine_adapter.py +587 -0
- aiecs/domain/agent/integration/protocols.py +281 -0
- aiecs/domain/agent/integration/retry_policy.py +218 -0
- aiecs/domain/agent/integration/role_config.py +213 -0
- aiecs/domain/agent/knowledge_aware_agent.py +1892 -0
- aiecs/domain/agent/lifecycle.py +291 -0
- aiecs/domain/agent/llm_agent.py +692 -0
- aiecs/domain/agent/memory/__init__.py +12 -0
- aiecs/domain/agent/memory/conversation.py +1124 -0
- aiecs/domain/agent/migration/__init__.py +14 -0
- aiecs/domain/agent/migration/conversion.py +163 -0
- aiecs/domain/agent/migration/legacy_wrapper.py +86 -0
- aiecs/domain/agent/models.py +894 -0
- aiecs/domain/agent/observability.py +479 -0
- aiecs/domain/agent/persistence.py +449 -0
- aiecs/domain/agent/prompts/__init__.py +29 -0
- aiecs/domain/agent/prompts/builder.py +159 -0
- aiecs/domain/agent/prompts/formatters.py +187 -0
- aiecs/domain/agent/prompts/template.py +255 -0
- aiecs/domain/agent/registry.py +253 -0
- aiecs/domain/agent/tool_agent.py +444 -0
- aiecs/domain/agent/tools/__init__.py +15 -0
- aiecs/domain/agent/tools/schema_generator.py +377 -0
- aiecs/domain/community/__init__.py +155 -0
- aiecs/domain/community/agent_adapter.py +469 -0
- aiecs/domain/community/analytics.py +432 -0
- aiecs/domain/community/collaborative_workflow.py +648 -0
- aiecs/domain/community/communication_hub.py +634 -0
- aiecs/domain/community/community_builder.py +320 -0
- aiecs/domain/community/community_integration.py +796 -0
- aiecs/domain/community/community_manager.py +803 -0
- aiecs/domain/community/decision_engine.py +849 -0
- aiecs/domain/community/exceptions.py +231 -0
- aiecs/domain/community/models/__init__.py +33 -0
- aiecs/domain/community/models/community_models.py +234 -0
- aiecs/domain/community/resource_manager.py +461 -0
- aiecs/domain/community/shared_context_manager.py +589 -0
- aiecs/domain/context/__init__.py +40 -10
- aiecs/domain/context/context_engine.py +1910 -0
- aiecs/domain/context/conversation_models.py +87 -53
- aiecs/domain/context/graph_memory.py +582 -0
- aiecs/domain/execution/model.py +12 -4
- aiecs/domain/knowledge_graph/__init__.py +19 -0
- aiecs/domain/knowledge_graph/models/__init__.py +52 -0
- aiecs/domain/knowledge_graph/models/entity.py +148 -0
- aiecs/domain/knowledge_graph/models/evidence.py +178 -0
- aiecs/domain/knowledge_graph/models/inference_rule.py +184 -0
- aiecs/domain/knowledge_graph/models/path.py +171 -0
- aiecs/domain/knowledge_graph/models/path_pattern.py +171 -0
- aiecs/domain/knowledge_graph/models/query.py +261 -0
- aiecs/domain/knowledge_graph/models/query_plan.py +181 -0
- aiecs/domain/knowledge_graph/models/relation.py +202 -0
- aiecs/domain/knowledge_graph/schema/__init__.py +23 -0
- aiecs/domain/knowledge_graph/schema/entity_type.py +131 -0
- aiecs/domain/knowledge_graph/schema/graph_schema.py +253 -0
- aiecs/domain/knowledge_graph/schema/property_schema.py +143 -0
- aiecs/domain/knowledge_graph/schema/relation_type.py +163 -0
- aiecs/domain/knowledge_graph/schema/schema_manager.py +691 -0
- aiecs/domain/knowledge_graph/schema/type_enums.py +209 -0
- aiecs/domain/task/dsl_processor.py +172 -56
- aiecs/domain/task/model.py +20 -8
- aiecs/domain/task/task_context.py +27 -24
- aiecs/infrastructure/__init__.py +0 -2
- aiecs/infrastructure/graph_storage/__init__.py +11 -0
- aiecs/infrastructure/graph_storage/base.py +837 -0
- aiecs/infrastructure/graph_storage/batch_operations.py +458 -0
- aiecs/infrastructure/graph_storage/cache.py +424 -0
- aiecs/infrastructure/graph_storage/distributed.py +223 -0
- aiecs/infrastructure/graph_storage/error_handling.py +380 -0
- aiecs/infrastructure/graph_storage/graceful_degradation.py +294 -0
- aiecs/infrastructure/graph_storage/health_checks.py +378 -0
- aiecs/infrastructure/graph_storage/in_memory.py +1197 -0
- aiecs/infrastructure/graph_storage/index_optimization.py +446 -0
- aiecs/infrastructure/graph_storage/lazy_loading.py +431 -0
- aiecs/infrastructure/graph_storage/metrics.py +344 -0
- aiecs/infrastructure/graph_storage/migration.py +400 -0
- aiecs/infrastructure/graph_storage/pagination.py +483 -0
- aiecs/infrastructure/graph_storage/performance_monitoring.py +456 -0
- aiecs/infrastructure/graph_storage/postgres.py +1563 -0
- aiecs/infrastructure/graph_storage/property_storage.py +353 -0
- aiecs/infrastructure/graph_storage/protocols.py +76 -0
- aiecs/infrastructure/graph_storage/query_optimizer.py +642 -0
- aiecs/infrastructure/graph_storage/schema_cache.py +290 -0
- aiecs/infrastructure/graph_storage/sqlite.py +1373 -0
- aiecs/infrastructure/graph_storage/streaming.py +487 -0
- aiecs/infrastructure/graph_storage/tenant.py +412 -0
- aiecs/infrastructure/messaging/celery_task_manager.py +92 -54
- aiecs/infrastructure/messaging/websocket_manager.py +51 -35
- aiecs/infrastructure/monitoring/__init__.py +22 -0
- aiecs/infrastructure/monitoring/executor_metrics.py +45 -11
- aiecs/infrastructure/monitoring/global_metrics_manager.py +212 -0
- aiecs/infrastructure/monitoring/structured_logger.py +3 -7
- aiecs/infrastructure/monitoring/tracing_manager.py +63 -35
- aiecs/infrastructure/persistence/__init__.py +14 -1
- aiecs/infrastructure/persistence/context_engine_client.py +184 -0
- aiecs/infrastructure/persistence/database_manager.py +67 -43
- aiecs/infrastructure/persistence/file_storage.py +180 -103
- aiecs/infrastructure/persistence/redis_client.py +74 -21
- aiecs/llm/__init__.py +73 -25
- aiecs/llm/callbacks/__init__.py +11 -0
- aiecs/llm/{custom_callbacks.py → callbacks/custom_callbacks.py} +26 -19
- aiecs/llm/client_factory.py +230 -37
- aiecs/llm/client_resolver.py +155 -0
- aiecs/llm/clients/__init__.py +38 -0
- aiecs/llm/clients/base_client.py +328 -0
- aiecs/llm/clients/google_function_calling_mixin.py +415 -0
- aiecs/llm/clients/googleai_client.py +314 -0
- aiecs/llm/clients/openai_client.py +158 -0
- aiecs/llm/clients/openai_compatible_mixin.py +367 -0
- aiecs/llm/clients/vertex_client.py +1186 -0
- aiecs/llm/clients/xai_client.py +201 -0
- aiecs/llm/config/__init__.py +51 -0
- aiecs/llm/config/config_loader.py +272 -0
- aiecs/llm/config/config_validator.py +206 -0
- aiecs/llm/config/model_config.py +143 -0
- aiecs/llm/protocols.py +149 -0
- aiecs/llm/utils/__init__.py +10 -0
- aiecs/llm/utils/validate_config.py +89 -0
- aiecs/main.py +140 -121
- aiecs/scripts/aid/VERSION_MANAGEMENT.md +138 -0
- aiecs/scripts/aid/__init__.py +19 -0
- aiecs/scripts/aid/module_checker.py +499 -0
- aiecs/scripts/aid/version_manager.py +235 -0
- aiecs/scripts/{DEPENDENCY_SYSTEM_SUMMARY.md → dependance_check/DEPENDENCY_SYSTEM_SUMMARY.md} +1 -0
- aiecs/scripts/{README_DEPENDENCY_CHECKER.md → dependance_check/README_DEPENDENCY_CHECKER.md} +1 -0
- aiecs/scripts/dependance_check/__init__.py +15 -0
- aiecs/scripts/dependance_check/dependency_checker.py +1835 -0
- aiecs/scripts/{dependency_fixer.py → dependance_check/dependency_fixer.py} +192 -90
- aiecs/scripts/{download_nlp_data.py → dependance_check/download_nlp_data.py} +203 -71
- aiecs/scripts/dependance_patch/__init__.py +7 -0
- aiecs/scripts/dependance_patch/fix_weasel/__init__.py +11 -0
- aiecs/scripts/{fix_weasel_validator.py → dependance_patch/fix_weasel/fix_weasel_validator.py} +21 -14
- aiecs/scripts/{patch_weasel_library.sh → dependance_patch/fix_weasel/patch_weasel_library.sh} +1 -1
- aiecs/scripts/knowledge_graph/__init__.py +3 -0
- aiecs/scripts/knowledge_graph/run_threshold_experiments.py +212 -0
- aiecs/scripts/migrations/multi_tenancy/README.md +142 -0
- aiecs/scripts/tools_develop/README.md +671 -0
- aiecs/scripts/tools_develop/README_CONFIG_CHECKER.md +273 -0
- aiecs/scripts/tools_develop/TOOLS_CONFIG_GUIDE.md +1287 -0
- aiecs/scripts/tools_develop/TOOL_AUTO_DISCOVERY.md +234 -0
- aiecs/scripts/tools_develop/__init__.py +21 -0
- aiecs/scripts/tools_develop/check_all_tools_config.py +548 -0
- aiecs/scripts/tools_develop/check_type_annotations.py +257 -0
- aiecs/scripts/tools_develop/pre-commit-schema-coverage.sh +66 -0
- aiecs/scripts/tools_develop/schema_coverage.py +511 -0
- aiecs/scripts/tools_develop/validate_tool_schemas.py +475 -0
- aiecs/scripts/tools_develop/verify_executor_config_fix.py +98 -0
- aiecs/scripts/tools_develop/verify_tools.py +352 -0
- aiecs/tasks/__init__.py +0 -1
- aiecs/tasks/worker.py +115 -47
- aiecs/tools/__init__.py +194 -72
- aiecs/tools/apisource/__init__.py +99 -0
- aiecs/tools/apisource/intelligence/__init__.py +19 -0
- aiecs/tools/apisource/intelligence/data_fusion.py +632 -0
- aiecs/tools/apisource/intelligence/query_analyzer.py +417 -0
- aiecs/tools/apisource/intelligence/search_enhancer.py +385 -0
- aiecs/tools/apisource/monitoring/__init__.py +9 -0
- aiecs/tools/apisource/monitoring/metrics.py +330 -0
- aiecs/tools/apisource/providers/__init__.py +112 -0
- aiecs/tools/apisource/providers/base.py +671 -0
- aiecs/tools/apisource/providers/census.py +397 -0
- aiecs/tools/apisource/providers/fred.py +535 -0
- aiecs/tools/apisource/providers/newsapi.py +409 -0
- aiecs/tools/apisource/providers/worldbank.py +352 -0
- aiecs/tools/apisource/reliability/__init__.py +12 -0
- aiecs/tools/apisource/reliability/error_handler.py +363 -0
- aiecs/tools/apisource/reliability/fallback_strategy.py +376 -0
- aiecs/tools/apisource/tool.py +832 -0
- aiecs/tools/apisource/utils/__init__.py +9 -0
- aiecs/tools/apisource/utils/validators.py +334 -0
- aiecs/tools/base_tool.py +415 -21
- aiecs/tools/docs/__init__.py +121 -0
- aiecs/tools/docs/ai_document_orchestrator.py +607 -0
- aiecs/tools/docs/ai_document_writer_orchestrator.py +2350 -0
- aiecs/tools/docs/content_insertion_tool.py +1320 -0
- aiecs/tools/docs/document_creator_tool.py +1464 -0
- aiecs/tools/docs/document_layout_tool.py +1160 -0
- aiecs/tools/docs/document_parser_tool.py +1016 -0
- aiecs/tools/docs/document_writer_tool.py +2008 -0
- aiecs/tools/knowledge_graph/__init__.py +17 -0
- aiecs/tools/knowledge_graph/graph_reasoning_tool.py +807 -0
- aiecs/tools/knowledge_graph/graph_search_tool.py +944 -0
- aiecs/tools/knowledge_graph/kg_builder_tool.py +524 -0
- aiecs/tools/langchain_adapter.py +300 -138
- aiecs/tools/schema_generator.py +455 -0
- aiecs/tools/search_tool/__init__.py +100 -0
- aiecs/tools/search_tool/analyzers.py +581 -0
- aiecs/tools/search_tool/cache.py +264 -0
- aiecs/tools/search_tool/constants.py +128 -0
- aiecs/tools/search_tool/context.py +224 -0
- aiecs/tools/search_tool/core.py +778 -0
- aiecs/tools/search_tool/deduplicator.py +119 -0
- aiecs/tools/search_tool/error_handler.py +242 -0
- aiecs/tools/search_tool/metrics.py +343 -0
- aiecs/tools/search_tool/rate_limiter.py +172 -0
- aiecs/tools/search_tool/schemas.py +275 -0
- aiecs/tools/statistics/__init__.py +80 -0
- aiecs/tools/statistics/ai_data_analysis_orchestrator.py +646 -0
- aiecs/tools/statistics/ai_insight_generator_tool.py +508 -0
- aiecs/tools/statistics/ai_report_orchestrator_tool.py +684 -0
- aiecs/tools/statistics/data_loader_tool.py +555 -0
- aiecs/tools/statistics/data_profiler_tool.py +638 -0
- aiecs/tools/statistics/data_transformer_tool.py +580 -0
- aiecs/tools/statistics/data_visualizer_tool.py +498 -0
- aiecs/tools/statistics/model_trainer_tool.py +507 -0
- aiecs/tools/statistics/statistical_analyzer_tool.py +472 -0
- aiecs/tools/task_tools/__init__.py +49 -36
- aiecs/tools/task_tools/chart_tool.py +200 -184
- aiecs/tools/task_tools/classfire_tool.py +268 -267
- aiecs/tools/task_tools/image_tool.py +220 -141
- aiecs/tools/task_tools/office_tool.py +226 -146
- aiecs/tools/task_tools/pandas_tool.py +477 -121
- aiecs/tools/task_tools/report_tool.py +390 -142
- aiecs/tools/task_tools/research_tool.py +149 -79
- aiecs/tools/task_tools/scraper_tool.py +339 -145
- aiecs/tools/task_tools/stats_tool.py +448 -209
- aiecs/tools/temp_file_manager.py +26 -24
- aiecs/tools/tool_executor/__init__.py +18 -16
- aiecs/tools/tool_executor/tool_executor.py +364 -52
- aiecs/utils/LLM_output_structor.py +74 -48
- aiecs/utils/__init__.py +14 -3
- aiecs/utils/base_callback.py +0 -3
- aiecs/utils/cache_provider.py +696 -0
- aiecs/utils/execution_utils.py +50 -31
- aiecs/utils/prompt_loader.py +1 -0
- aiecs/utils/token_usage_repository.py +37 -11
- aiecs/ws/socket_server.py +14 -4
- {aiecs-1.0.1.dist-info → aiecs-1.7.17.dist-info}/METADATA +52 -15
- aiecs-1.7.17.dist-info/RECORD +337 -0
- aiecs-1.7.17.dist-info/entry_points.txt +13 -0
- aiecs/config/registry.py +0 -19
- aiecs/domain/context/content_engine.py +0 -982
- aiecs/llm/base_client.py +0 -99
- aiecs/llm/openai_client.py +0 -125
- aiecs/llm/vertex_client.py +0 -186
- aiecs/llm/xai_client.py +0 -184
- aiecs/scripts/dependency_checker.py +0 -857
- aiecs/scripts/quick_dependency_check.py +0 -269
- aiecs/tools/task_tools/search_api.py +0 -7
- aiecs-1.0.1.dist-info/RECORD +0 -90
- aiecs-1.0.1.dist-info/entry_points.txt +0 -7
- /aiecs/scripts/{setup_nlp_data.sh → dependance_check/setup_nlp_data.sh} +0 -0
- /aiecs/scripts/{README_WEASEL_PATCH.md → dependance_patch/fix_weasel/README_WEASEL_PATCH.md} +0 -0
- /aiecs/scripts/{fix_weasel_validator.sh → dependance_patch/fix_weasel/fix_weasel_validator.sh} +0 -0
- /aiecs/scripts/{run_weasel_patch.sh → dependance_patch/fix_weasel/run_weasel_patch.sh} +0 -0
- {aiecs-1.0.1.dist-info → aiecs-1.7.17.dist-info}/WHEEL +0 -0
- {aiecs-1.0.1.dist-info → aiecs-1.7.17.dist-info}/licenses/LICENSE +0 -0
- {aiecs-1.0.1.dist-info → aiecs-1.7.17.dist-info}/top_level.txt +0 -0
|
@@ -9,12 +9,10 @@ class IToolProvider(ABC):
|
|
|
9
9
|
@abstractmethod
|
|
10
10
|
def get_tool(self, tool_name: str) -> Any:
|
|
11
11
|
"""Get tool instance"""
|
|
12
|
-
pass
|
|
13
12
|
|
|
14
13
|
@abstractmethod
|
|
15
14
|
def has_tool(self, tool_name: str) -> bool:
|
|
16
15
|
"""Check if tool exists"""
|
|
17
|
-
pass
|
|
18
16
|
|
|
19
17
|
|
|
20
18
|
class IToolExecutor(ABC):
|
|
@@ -23,32 +21,33 @@ class IToolExecutor(ABC):
|
|
|
23
21
|
@abstractmethod
|
|
24
22
|
def execute(self, tool: Any, operation_name: str, **params) -> Any:
|
|
25
23
|
"""Execute tool operation synchronously"""
|
|
26
|
-
pass
|
|
27
24
|
|
|
28
25
|
@abstractmethod
|
|
29
26
|
async def execute_async(self, tool: Any, operation_name: str, **params) -> Any:
|
|
30
27
|
"""Execute tool operation asynchronously"""
|
|
31
|
-
pass
|
|
32
28
|
|
|
33
29
|
|
|
34
30
|
class ICacheProvider(ABC):
|
|
35
31
|
"""Cache provider interface - Domain layer abstraction"""
|
|
36
32
|
|
|
37
33
|
@abstractmethod
|
|
38
|
-
def generate_cache_key(
|
|
39
|
-
|
|
34
|
+
def generate_cache_key(
|
|
35
|
+
self,
|
|
36
|
+
operation_type: str,
|
|
37
|
+
user_id: str,
|
|
38
|
+
task_id: str,
|
|
39
|
+
args: tuple,
|
|
40
|
+
kwargs: Dict[str, Any],
|
|
41
|
+
) -> str:
|
|
40
42
|
"""Generate cache key"""
|
|
41
|
-
pass
|
|
42
43
|
|
|
43
44
|
@abstractmethod
|
|
44
45
|
def get_from_cache(self, cache_key: str) -> Optional[Any]:
|
|
45
46
|
"""Get data from cache"""
|
|
46
|
-
pass
|
|
47
47
|
|
|
48
48
|
@abstractmethod
|
|
49
49
|
def add_to_cache(self, cache_key: str, value: Any) -> None:
|
|
50
50
|
"""Add data to cache"""
|
|
51
|
-
pass
|
|
52
51
|
|
|
53
52
|
|
|
54
53
|
class IOperationExecutor(ABC):
|
|
@@ -57,25 +56,25 @@ class IOperationExecutor(ABC):
|
|
|
57
56
|
@abstractmethod
|
|
58
57
|
async def execute_operation(self, operation_spec: str, params: Dict[str, Any]) -> Any:
|
|
59
58
|
"""Execute single operation"""
|
|
60
|
-
pass
|
|
61
59
|
|
|
62
60
|
@abstractmethod
|
|
63
61
|
async def batch_execute_operations(self, operations: List[Dict[str, Any]]) -> List[Any]:
|
|
64
62
|
"""Batch execute operations"""
|
|
65
|
-
pass
|
|
66
63
|
|
|
67
64
|
@abstractmethod
|
|
68
|
-
async def execute_operations_sequence(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
65
|
+
async def execute_operations_sequence(
|
|
66
|
+
self,
|
|
67
|
+
operations: List[Dict[str, Any]],
|
|
68
|
+
user_id: str,
|
|
69
|
+
task_id: str,
|
|
70
|
+
stop_on_failure: bool = False,
|
|
71
|
+
save_callback: Optional[Callable] = None,
|
|
72
|
+
) -> List[TaskStepResult]:
|
|
72
73
|
"""Execute operations sequence sequentially"""
|
|
73
|
-
pass
|
|
74
74
|
|
|
75
75
|
@abstractmethod
|
|
76
76
|
async def execute_parallel_operations(self, operations: List[Dict[str, Any]]) -> List[TaskStepResult]:
|
|
77
77
|
"""Execute operations in parallel"""
|
|
78
|
-
pass
|
|
79
78
|
|
|
80
79
|
|
|
81
80
|
class ExecutionInterface(ABC):
|
|
@@ -96,10 +95,14 @@ class ExecutionInterface(ABC):
|
|
|
96
95
|
Returns:
|
|
97
96
|
Any: Operation result
|
|
98
97
|
"""
|
|
99
|
-
pass
|
|
100
98
|
|
|
101
99
|
@abstractmethod
|
|
102
|
-
async def execute_task(
|
|
100
|
+
async def execute_task(
|
|
101
|
+
self,
|
|
102
|
+
task_name: str,
|
|
103
|
+
input_data: Dict[str, Any],
|
|
104
|
+
context: Dict[str, Any],
|
|
105
|
+
) -> Any:
|
|
103
106
|
"""
|
|
104
107
|
Execute a single task (e.g., service task).
|
|
105
108
|
|
|
@@ -111,7 +114,6 @@ class ExecutionInterface(ABC):
|
|
|
111
114
|
Returns:
|
|
112
115
|
Any: Task result
|
|
113
116
|
"""
|
|
114
|
-
pass
|
|
115
117
|
|
|
116
118
|
@abstractmethod
|
|
117
119
|
async def batch_execute_operations(self, operations: List[Dict[str, Any]]) -> List[Any]:
|
|
@@ -124,7 +126,6 @@ class ExecutionInterface(ABC):
|
|
|
124
126
|
Returns:
|
|
125
127
|
List[Any]: List of operation results
|
|
126
128
|
"""
|
|
127
|
-
pass
|
|
128
129
|
|
|
129
130
|
@abstractmethod
|
|
130
131
|
async def batch_execute_tasks(self, tasks: List[Dict[str, Any]]) -> List[Any]:
|
|
@@ -137,7 +138,6 @@ class ExecutionInterface(ABC):
|
|
|
137
138
|
Returns:
|
|
138
139
|
List[Any]: List of task results
|
|
139
140
|
"""
|
|
140
|
-
pass
|
|
141
141
|
|
|
142
142
|
def register_executor(self, executor_type: str, executor_instance: Any) -> None:
|
|
143
143
|
"""
|
|
@@ -7,208 +7,157 @@ as other core interfaces, enabling dependency inversion and clean architecture.
|
|
|
7
7
|
|
|
8
8
|
from abc import ABC, abstractmethod
|
|
9
9
|
from typing import Dict, Any, Optional, List
|
|
10
|
-
from datetime import datetime
|
|
11
10
|
|
|
12
11
|
|
|
13
12
|
class ISessionStorage(ABC):
|
|
14
13
|
"""Session storage interface - Domain layer abstraction"""
|
|
15
|
-
|
|
14
|
+
|
|
16
15
|
@abstractmethod
|
|
17
|
-
async def create_session(
|
|
18
|
-
self,
|
|
19
|
-
session_id: str,
|
|
20
|
-
user_id: str,
|
|
21
|
-
metadata: Dict[str, Any] = None
|
|
22
|
-
) -> Dict[str, Any]:
|
|
16
|
+
async def create_session(self, session_id: str, user_id: str, metadata: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
|
23
17
|
"""Create a new session."""
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
|
|
26
19
|
@abstractmethod
|
|
27
20
|
async def get_session(self, session_id: str) -> Optional[Dict[str, Any]]:
|
|
28
21
|
"""Get session by ID."""
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
|
|
31
23
|
@abstractmethod
|
|
32
24
|
async def update_session(
|
|
33
25
|
self,
|
|
34
26
|
session_id: str,
|
|
35
|
-
updates: Dict[str, Any] = None,
|
|
27
|
+
updates: Optional[Dict[str, Any]] = None,
|
|
36
28
|
increment_requests: bool = False,
|
|
37
29
|
add_processing_time: float = 0.0,
|
|
38
|
-
mark_error: bool = False
|
|
30
|
+
mark_error: bool = False,
|
|
39
31
|
) -> bool:
|
|
40
32
|
"""Update session with activity and metrics."""
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
|
|
43
34
|
@abstractmethod
|
|
44
35
|
async def end_session(self, session_id: str, status: str = "completed") -> bool:
|
|
45
36
|
"""End a session and update metrics."""
|
|
46
|
-
pass
|
|
47
37
|
|
|
48
38
|
|
|
49
39
|
class IConversationStorage(ABC):
|
|
50
40
|
"""Conversation storage interface - Domain layer abstraction"""
|
|
51
|
-
|
|
41
|
+
|
|
52
42
|
@abstractmethod
|
|
53
43
|
async def add_conversation_message(
|
|
54
44
|
self,
|
|
55
45
|
session_id: str,
|
|
56
46
|
role: str,
|
|
57
47
|
content: str,
|
|
58
|
-
metadata: Dict[str, Any] = None
|
|
48
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
59
49
|
) -> bool:
|
|
60
50
|
"""Add message to conversation history."""
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
|
|
63
52
|
@abstractmethod
|
|
64
|
-
async def get_conversation_history(
|
|
65
|
-
self,
|
|
66
|
-
session_id: str,
|
|
67
|
-
limit: int = 50
|
|
68
|
-
) -> List[Dict[str, Any]]:
|
|
53
|
+
async def get_conversation_history(self, session_id: str, limit: int = 50) -> List[Dict[str, Any]]:
|
|
69
54
|
"""Get conversation history for a session."""
|
|
70
|
-
pass
|
|
71
55
|
|
|
72
56
|
|
|
73
57
|
class ICheckpointStorage(ABC):
|
|
74
58
|
"""Checkpoint storage interface - Domain layer abstraction"""
|
|
75
|
-
|
|
59
|
+
|
|
76
60
|
@abstractmethod
|
|
77
61
|
async def store_checkpoint(
|
|
78
62
|
self,
|
|
79
63
|
thread_id: str,
|
|
80
64
|
checkpoint_id: str,
|
|
81
65
|
checkpoint_data: Dict[str, Any],
|
|
82
|
-
metadata: Dict[str, Any] = None
|
|
66
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
83
67
|
) -> bool:
|
|
84
68
|
"""Store checkpoint data."""
|
|
85
|
-
|
|
86
|
-
|
|
69
|
+
|
|
87
70
|
@abstractmethod
|
|
88
|
-
async def get_checkpoint(
|
|
89
|
-
self,
|
|
90
|
-
thread_id: str,
|
|
91
|
-
checkpoint_id: str = None
|
|
92
|
-
) -> Optional[Dict[str, Any]]:
|
|
71
|
+
async def get_checkpoint(self, thread_id: str, checkpoint_id: Optional[str] = None) -> Optional[Dict[str, Any]]:
|
|
93
72
|
"""Get checkpoint data. If checkpoint_id is None, get the latest."""
|
|
94
|
-
|
|
95
|
-
|
|
73
|
+
|
|
96
74
|
@abstractmethod
|
|
97
|
-
async def list_checkpoints(
|
|
98
|
-
self,
|
|
99
|
-
thread_id: str,
|
|
100
|
-
limit: int = 10
|
|
101
|
-
) -> List[Dict[str, Any]]:
|
|
75
|
+
async def list_checkpoints(self, thread_id: str, limit: int = 10) -> List[Dict[str, Any]]:
|
|
102
76
|
"""List checkpoints for a thread, ordered by creation time."""
|
|
103
|
-
pass
|
|
104
77
|
|
|
105
78
|
|
|
106
79
|
class ITaskContextStorage(ABC):
|
|
107
80
|
"""Task context storage interface - Domain layer abstraction"""
|
|
108
|
-
|
|
81
|
+
|
|
109
82
|
@abstractmethod
|
|
110
83
|
async def get_task_context(self, session_id: str) -> Optional[Any]:
|
|
111
84
|
"""Get TaskContext for a session."""
|
|
112
|
-
|
|
113
|
-
|
|
85
|
+
|
|
114
86
|
@abstractmethod
|
|
115
87
|
async def store_task_context(self, session_id: str, context: Any) -> bool:
|
|
116
88
|
"""Store TaskContext for a session."""
|
|
117
|
-
pass
|
|
118
89
|
|
|
119
90
|
|
|
120
91
|
class IStorageBackend(
|
|
121
92
|
ISessionStorage,
|
|
122
93
|
IConversationStorage,
|
|
123
94
|
ICheckpointStorage,
|
|
124
|
-
ITaskContextStorage
|
|
95
|
+
ITaskContextStorage,
|
|
125
96
|
):
|
|
126
97
|
"""
|
|
127
98
|
Unified storage backend interface - Domain layer abstraction
|
|
128
|
-
|
|
99
|
+
|
|
129
100
|
This interface combines all storage capabilities and follows the same
|
|
130
101
|
pattern as other core interfaces in the middleware architecture.
|
|
131
102
|
"""
|
|
132
|
-
|
|
103
|
+
|
|
133
104
|
@abstractmethod
|
|
134
105
|
async def initialize(self) -> bool:
|
|
135
106
|
"""Initialize the storage backend."""
|
|
136
|
-
|
|
137
|
-
|
|
107
|
+
|
|
138
108
|
@abstractmethod
|
|
139
109
|
async def close(self):
|
|
140
110
|
"""Close the storage backend."""
|
|
141
|
-
|
|
142
|
-
|
|
111
|
+
|
|
143
112
|
@abstractmethod
|
|
144
113
|
async def health_check(self) -> Dict[str, Any]:
|
|
145
114
|
"""Perform health check."""
|
|
146
|
-
|
|
147
|
-
|
|
115
|
+
|
|
148
116
|
@abstractmethod
|
|
149
117
|
async def get_metrics(self) -> Dict[str, Any]:
|
|
150
118
|
"""Get comprehensive metrics."""
|
|
151
|
-
|
|
152
|
-
|
|
119
|
+
|
|
153
120
|
@abstractmethod
|
|
154
121
|
async def cleanup_expired_sessions(self, max_idle_hours: int = 24) -> int:
|
|
155
122
|
"""Clean up expired sessions and associated data."""
|
|
156
|
-
pass
|
|
157
123
|
|
|
158
124
|
|
|
159
125
|
class ICheckpointerBackend(ABC):
|
|
160
126
|
"""
|
|
161
127
|
Checkpointer backend interface for LangGraph integration.
|
|
162
|
-
|
|
128
|
+
|
|
163
129
|
This interface defines the minimal contract needed by BaseServiceCheckpointer
|
|
164
130
|
to work with any storage backend, following dependency inversion principle.
|
|
165
131
|
"""
|
|
166
|
-
|
|
132
|
+
|
|
167
133
|
@abstractmethod
|
|
168
134
|
async def put_checkpoint(
|
|
169
135
|
self,
|
|
170
136
|
thread_id: str,
|
|
171
137
|
checkpoint_id: str,
|
|
172
138
|
checkpoint_data: Dict[str, Any],
|
|
173
|
-
metadata: Dict[str, Any] = None
|
|
139
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
174
140
|
) -> bool:
|
|
175
141
|
"""Store a checkpoint for LangGraph workflows."""
|
|
176
|
-
|
|
177
|
-
|
|
142
|
+
|
|
178
143
|
@abstractmethod
|
|
179
|
-
async def get_checkpoint(
|
|
180
|
-
self,
|
|
181
|
-
thread_id: str,
|
|
182
|
-
checkpoint_id: str = None
|
|
183
|
-
) -> Optional[Dict[str, Any]]:
|
|
144
|
+
async def get_checkpoint(self, thread_id: str, checkpoint_id: Optional[str] = None) -> Optional[Dict[str, Any]]:
|
|
184
145
|
"""Retrieve a checkpoint for LangGraph workflows."""
|
|
185
|
-
|
|
186
|
-
|
|
146
|
+
|
|
187
147
|
@abstractmethod
|
|
188
|
-
async def list_checkpoints(
|
|
189
|
-
self,
|
|
190
|
-
thread_id: str,
|
|
191
|
-
limit: int = 10
|
|
192
|
-
) -> List[Dict[str, Any]]:
|
|
148
|
+
async def list_checkpoints(self, thread_id: str, limit: int = 10) -> List[Dict[str, Any]]:
|
|
193
149
|
"""List checkpoints for LangGraph workflows."""
|
|
194
|
-
|
|
195
|
-
|
|
150
|
+
|
|
196
151
|
@abstractmethod
|
|
197
152
|
async def put_writes(
|
|
198
153
|
self,
|
|
199
154
|
thread_id: str,
|
|
200
155
|
checkpoint_id: str,
|
|
201
156
|
task_id: str,
|
|
202
|
-
writes_data: List[tuple]
|
|
157
|
+
writes_data: List[tuple],
|
|
203
158
|
) -> bool:
|
|
204
159
|
"""Store intermediate writes for a checkpoint."""
|
|
205
|
-
|
|
206
|
-
|
|
160
|
+
|
|
207
161
|
@abstractmethod
|
|
208
|
-
async def get_writes(
|
|
209
|
-
self,
|
|
210
|
-
thread_id: str,
|
|
211
|
-
checkpoint_id: str
|
|
212
|
-
) -> List[tuple]:
|
|
162
|
+
async def get_writes(self, thread_id: str, checkpoint_id: str) -> List[tuple]:
|
|
213
163
|
"""Get intermediate writes for a checkpoint."""
|
|
214
|
-
pass
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Service Registry Module
|
|
3
|
+
|
|
4
|
+
Provides service registration and discovery for AIECS.
|
|
5
|
+
This is a core infrastructure module with no dependencies on other AIECS modules.
|
|
6
|
+
|
|
7
|
+
Usage:
|
|
8
|
+
from aiecs.core.registry import register_ai_service, get_ai_service
|
|
9
|
+
|
|
10
|
+
@register_ai_service("execute", "openai")
|
|
11
|
+
class OpenAIExecuteService:
|
|
12
|
+
pass
|
|
13
|
+
|
|
14
|
+
service_cls = get_ai_service("execute", "openai")
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from .service_registry import (
|
|
18
|
+
AI_SERVICE_REGISTRY,
|
|
19
|
+
register_ai_service,
|
|
20
|
+
get_ai_service,
|
|
21
|
+
list_registered_services,
|
|
22
|
+
clear_registry,
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
__all__ = [
|
|
26
|
+
"AI_SERVICE_REGISTRY",
|
|
27
|
+
"register_ai_service",
|
|
28
|
+
"get_ai_service",
|
|
29
|
+
"list_registered_services",
|
|
30
|
+
"clear_registry",
|
|
31
|
+
]
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Service Registry - Core Infrastructure
|
|
3
|
+
|
|
4
|
+
This module provides service registration and discovery functionality.
|
|
5
|
+
It has ZERO dependencies on other AIECS modules to prevent circular imports.
|
|
6
|
+
|
|
7
|
+
This is part of the core infrastructure layer and should never import from
|
|
8
|
+
upper layers (domain, application, etc.).
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from typing import Dict, Tuple, Type, Any
|
|
12
|
+
|
|
13
|
+
# Global registry: maps (mode, service) -> service class
|
|
14
|
+
AI_SERVICE_REGISTRY: Dict[Tuple[str, str], Type[Any]] = {}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def register_ai_service(mode: str, service: str):
|
|
18
|
+
"""
|
|
19
|
+
Decorator for registering a service class to the registry.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
mode: Service mode (e.g., "execute", "analyze")
|
|
23
|
+
service: Service name (e.g., "openai", "custom")
|
|
24
|
+
|
|
25
|
+
Returns:
|
|
26
|
+
Decorator function that registers the class
|
|
27
|
+
|
|
28
|
+
Example:
|
|
29
|
+
@register_ai_service("execute", "openai")
|
|
30
|
+
class OpenAIExecuteService:
|
|
31
|
+
pass
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
def decorator(cls: Type[Any]) -> Type[Any]:
|
|
35
|
+
key = (mode, service)
|
|
36
|
+
AI_SERVICE_REGISTRY[key] = cls
|
|
37
|
+
return cls
|
|
38
|
+
|
|
39
|
+
return decorator
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def get_ai_service(mode: str, service: str) -> Type[Any]:
|
|
43
|
+
"""
|
|
44
|
+
Retrieve a registered service class.
|
|
45
|
+
|
|
46
|
+
Args:
|
|
47
|
+
mode: Service mode
|
|
48
|
+
service: Service name
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
The registered service class
|
|
52
|
+
|
|
53
|
+
Raises:
|
|
54
|
+
ValueError: If no service is registered for the given mode and service
|
|
55
|
+
|
|
56
|
+
Example:
|
|
57
|
+
service_cls = get_ai_service("execute", "openai")
|
|
58
|
+
service_instance = service_cls()
|
|
59
|
+
"""
|
|
60
|
+
key = (mode, service)
|
|
61
|
+
if key not in AI_SERVICE_REGISTRY:
|
|
62
|
+
raise ValueError(f"No registered service for mode '{mode}', service '{service}'. " f"Available services: {list(AI_SERVICE_REGISTRY.keys())}")
|
|
63
|
+
return AI_SERVICE_REGISTRY[key]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def list_registered_services() -> Dict[Tuple[str, str], Type[Any]]:
|
|
67
|
+
"""
|
|
68
|
+
List all registered services.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
Dictionary mapping (mode, service) tuples to service classes
|
|
72
|
+
|
|
73
|
+
Example:
|
|
74
|
+
services = list_registered_services()
|
|
75
|
+
for (mode, name), cls in services.items():
|
|
76
|
+
print(f"{mode}/{name}: {cls.__name__}")
|
|
77
|
+
"""
|
|
78
|
+
return AI_SERVICE_REGISTRY.copy()
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def clear_registry() -> None:
|
|
82
|
+
"""
|
|
83
|
+
Clear all registered services.
|
|
84
|
+
|
|
85
|
+
Primarily used for testing purposes to reset the registry state
|
|
86
|
+
between tests.
|
|
87
|
+
|
|
88
|
+
Example:
|
|
89
|
+
# In test setup or teardown
|
|
90
|
+
clear_registry()
|
|
91
|
+
"""
|
|
92
|
+
AI_SERVICE_REGISTRY.clear()
|