aiecs-kg 0.9.0__tar.gz
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.
- aiecs_kg-0.9.0/LICENSE +201 -0
- aiecs_kg-0.9.0/LICENSE_HEADER.txt +4 -0
- aiecs_kg-0.9.0/PKG-INFO +340 -0
- aiecs_kg-0.9.0/README.md +238 -0
- aiecs_kg-0.9.0/pyproject.toml +249 -0
- aiecs_kg-0.9.0/setup.cfg +4 -0
- aiecs_kg-0.9.0/src/aiecs_kg/__init__.py +104 -0
- aiecs_kg-0.9.0/src/aiecs_kg/_version.py +7 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/__init__.py +11 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/__init__.py +41 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/data_quality.py +308 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/data_reshaping.py +298 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/document_builder.py +384 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/graph_builder.py +566 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/import_optimizer.py +409 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/schema_inference.py +466 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/schema_mapping.py +643 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/spg_schema_hooks.py +25 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/structured_pipeline.py +1391 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/builder/text_chunker.py +321 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/extractors/__init__.py +31 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/extractors/base.py +102 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/extractors/llm_entity_extractor.py +266 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/extractors/llm_relation_extractor.py +262 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/extractors/ner_entity_extractor.py +254 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/__init__.py +82 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/ab_testing.py +384 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/abbreviation_expander.py +328 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/alias_index.py +583 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/alias_matcher.py +386 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/cache_coordinator.py +344 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/entity_deduplicator.py +432 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/entity_linker.py +503 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/evaluation_dataset.py +237 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/knowledge_fusion.py +642 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/matching_config.py +462 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/name_normalizer.py +410 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/relation_deduplicator.py +187 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/semantic_name_matcher.py +461 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/fusion/similarity_pipeline.py +514 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/graph_algorithms/__init__.py +15 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/graph_algorithms/neo4j_gds.py +102 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/graph_algorithms/networkx_fallback.py +125 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/graph_algorithms/python_pagerank.py +83 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/graph_algorithms/routing.py +55 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/graph_algorithms/service.py +135 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/pattern_matching/__init__.py +25 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/pattern_matching/pattern_matcher.py +375 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/pattern_matching/query_executor.py +370 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/profiling/__init__.py +16 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/profiling/query_plan_visualizer.py +199 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/profiling/query_profiler.py +227 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/__init__.py +51 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/adapters/kgdsl_detector.py +37 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/adapters/reasoner_bridge.py +96 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/evidence_synthesis.py +388 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/evidence_utils.py +59 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/factory.py +106 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/inference_engine.py +758 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/logic_form_parser.py +280 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/logic_parser/__init__.py +83 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/logic_parser/ast_builder.py +516 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/logic_parser/ast_nodes.py +949 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/logic_parser/ast_validator.py +870 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/logic_parser/error_handler.py +482 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/logic_parser/grammar.lark +124 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/logic_parser/parser.py +415 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/logic_parser/query_context.py +219 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/logic_query_integration.py +173 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/path_depth.py +82 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/planning/__init__.py +18 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/planning/base.py +59 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/planning/heuristic.py +409 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/planning/llm.py +139 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/planning/logic_first.py +97 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/prompts/__init__.py +19 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/prompts/logic_dsl_prompt.py +46 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/query_cache.py +89 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/query_plan_executor.py +560 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/query_planner.py +329 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/reasoning_engine.py +501 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/reasoning/reasoning_orchestrator.py +572 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/retrieval/__init__.py +41 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/retrieval/query_intent_classifier.py +214 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/retrieval/retrieval_dispatcher.py +266 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/retrieval/retrieval_result.py +57 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/retrieval/retrieval_strategies.py +643 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/retrieval/strategy_types.py +26 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/search/__init__.py +65 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/search/hybrid_search.py +541 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/search/reranker.py +362 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/search/reranker_strategies.py +575 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/search/text_similarity.py +396 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/traversal/__init__.py +19 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/traversal/enhanced_traversal.py +349 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/traversal/path_scorer.py +275 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/validators/__init__.py +17 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/validators/relation_validator.py +257 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/visualization/__init__.py +15 -0
- aiecs_kg-0.9.0/src/aiecs_kg/application/visualization/graph_visualizer.py +317 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/__init__.py +5 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/__init__.py +27 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/adapters/__init__.py +5 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/adapters/chunk_mapper.py +89 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/adapters/entity_mapper.py +297 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/adapters/graph_store.py +398 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/adapters/pagerank_backend.py +158 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/adapters/schema_sync.py +89 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/adapters/search_mapper.py +49 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/async_utils.py +18 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/base/__init__.py +10 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/base/cache.py +48 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/base/client.py +55 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/builder/__init__.py +9 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/builder/client.py +67 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/builder/rest/__init__.py +37 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/builder/rest/builder_api.py +339 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/builder/rest/models/__init__.py +18 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/builder/rest/models/writer_graph_request.py +246 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/errors.py +9 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/__init__.py +60 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/client.py +162 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/__init__.py +60 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/graph_api.py +974 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/__init__.py +44 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/delete_edge_request.py +156 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/delete_vertex_request.py +156 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/edge_record.py +246 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/edge_record_instance.py +279 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/edge_type_name.py +195 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/expend_one_hop_request.py +221 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/expend_one_hop_response.py +192 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/get_page_rank_scores_request.py +195 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/get_page_rank_scores_request_start_nodes.py +221 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/lpg_property_record.py +155 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/page_rank_score_instance.py +181 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/query_vertex_request.py +191 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/query_vertex_response.py +130 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/upsert_edge_request.py +195 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/upsert_vertex_request.py +156 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/vertex_record.py +219 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/vertex_record_instance.py +223 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/graph/rest/models/writer_graph_request.py +246 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/project/__init__.py +9 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/project/client.py +124 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/project/rest/__init__.py +38 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/project/rest/models/__init__.py +19 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/project/rest/models/project.py +262 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/project/rest/models/project_create_request.py +384 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/project/rest/project_api.py +483 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/__init__.py +28 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/client.py +84 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/__init__.py +40 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/__init__.py +38 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/ca_pipeline.py +154 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/data_edge.py +296 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/data_node.py +207 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/edge.py +154 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/metrics.py +130 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/node.py +300 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/reason_markdown_request.py +145 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/reason_task.py +356 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/reason_task_response.py +155 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/ref_doc.py +252 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/ref_doc_set.py +180 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/report_pipeline_request.py +178 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/spg_type_instance.py +180 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/spg_type_query_request.py +181 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/stream_data.py +250 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/sub_graph.py +184 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/table_result.py +181 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/models/task_stream_request.py +190 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/reasoner/rest/reasoner_api.py +824 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/rest/__init__.py +25 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/rest/api_client.py +765 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/rest/configuration.py +406 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/rest/exceptions.py +131 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/rest/models/__init__.py +61 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/rest/models.py +14 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/rest/rest.py +434 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/__init__.py +26 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/client.py +199 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/model/__init__.py +14 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/model/base.py +912 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/model/property.py +63 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/model/relation.py +74 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/model/schema_helper.py +52 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/model/spg_type.py +321 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/__init__.py +123 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/concept_api.py +584 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/__init__.py +103 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/alter/__init__.py +14 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/alter/schema_alter_request.py +156 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/alter/schema_draft.py +130 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/base_ontology.py +226 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/basic_info.py +219 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/concept/__init__.py +14 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/concept/define_dynamic_taxonomy_request.py +188 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/concept/define_logical_causation_request.py +287 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/concept/remove_dynamic_taxonomy_request.py +162 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/concept/remove_logical_causation_request.py +260 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/constraint/__init__.py +14 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/constraint/base_constraint_item.py +160 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/constraint/constraint.py +154 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/constraint/enum_constraint.py +178 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/constraint/multi_val_constraint.py +146 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/constraint/not_null_constraint.py +146 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/constraint/regular_constraint.py +178 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/identifier/__init__.py +14 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/identifier/base_spg_identifier.py +159 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/identifier/concept_identifier.py +168 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/identifier/operator_identifier.py +168 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/identifier/predicate_identifier.py +168 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/identifier/spg_triple_identifier.py +233 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/identifier/spg_type_identifier.py +228 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/ontology_id.py +154 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/operator/__init__.py +14 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/operator/operator_create_request.py +193 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/operator/operator_create_response.py +156 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/operator/operator_overview.py +259 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/operator/operator_version.py +223 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/operator/operator_version_request.py +156 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/operator/operator_version_response.py +156 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/predicate/__init__.py +14 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/predicate/mounted_concept_config.py +154 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/predicate/property.py +361 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/predicate/property_advanced_config.py +334 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/predicate/property_ref.py +375 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/predicate/property_ref_basic_info.py +220 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/predicate/relation.py +388 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/predicate/sub_property.py +334 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/predicate/sub_property_basic_info.py +219 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/semantic/__init__.py +14 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/semantic/base_semantic.py +266 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/semantic/logical_rule.py +305 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/semantic/predicate_semantic.py +347 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/semantic/rule_code.py +130 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/__init__.py +14 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/base_advanced_type.py +418 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/base_spg_type.py +421 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/basic_type.py +438 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/concept_layer_config.py +166 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/concept_taxonomic_config.py +130 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/concept_type.py +484 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/entity_type.py +403 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/event_type.py +403 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/index_type.py +403 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/multi_version_config.py +178 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/operator_key.py +154 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/parent_type_info.py +219 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/project_schema.py +130 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/spg_type_advanced_config.py +219 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/spg_type_ref.py +168 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/spg_type_ref_basic_info.py +218 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/standard_type.py +457 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/type/standard_type_basic_info.py +219 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/models/user_info.py +154 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/schema/rest/schema_api.py +568 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/search/__init__.py +29 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/search/client.py +92 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/search/rest/__init__.py +41 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/search/rest/models/__init__.py +25 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/search/rest/models/custom_search_request.py +189 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/search/rest/models/idx_record.py +219 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/search/rest/models/text_search_request.py +248 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/search/rest/models/vector_search_request.py +304 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/search/rest/search_api.py +421 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/settings.py +64 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/thinker/__init__.py +27 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/thinker/client.py +59 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/thinker/rest/__init__.py +37 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/thinker/rest/models/__init__.py +32 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/thinker/rest/models/thinker_task_request.py +274 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/thinker/rest/models/thinker_task_response.py +181 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/thinker/rest/thinker_api.py +157 -0
- aiecs_kg-0.9.0/src/aiecs_kg/client/spg/write_token_rotation.py +77 -0
- aiecs_kg-0.9.0/src/aiecs_kg/common/__init__.py +21 -0
- aiecs_kg-0.9.0/src/aiecs_kg/common/runnable.py +478 -0
- aiecs_kg-0.9.0/src/aiecs_kg/config.py +908 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/__init__.py +23 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/exceptions.py +31 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/__init__.py +60 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/entity.py +152 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/evidence.py +191 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/inference_rule.py +188 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/path.py +179 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/path_pattern.py +175 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/query.py +278 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/query_plan.py +185 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/query_plan_result.py +27 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/relation.py +211 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/storage_sync.py +25 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/models/traversal_limits.py +83 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/schema/__init__.py +27 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/schema/entity_type.py +135 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/schema/graph_schema.py +265 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/schema/property_schema.py +147 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/schema/relation_type.py +173 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/schema/schema_manager.py +696 -0
- aiecs_kg-0.9.0/src/aiecs_kg/domain/schema/type_enums.py +210 -0
- aiecs_kg-0.9.0/src/aiecs_kg/factory.py +160 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/__init__.py +5 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/aiecs/__init__.py +12 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/aiecs/document.py +50 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/aiecs/llm.py +250 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/aiecs/usage.py +209 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/spg_bridge/__init__.py +41 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/spg_bridge/builder_config.py +133 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/spg_bridge/component_registry.py +363 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/spg_bridge/llm_adapter.py +353 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/spg_bridge/server_bridge.py +208 -0
- aiecs_kg-0.9.0/src/aiecs_kg/integrations/spg_bridge/solver_config.py +73 -0
- aiecs_kg-0.9.0/src/aiecs_kg/ports/__init__.py +20 -0
- aiecs_kg-0.9.0/src/aiecs_kg/ports/graph_algorithms.py +64 -0
- aiecs_kg-0.9.0/src/aiecs_kg/ports/graph_store.py +9 -0
- aiecs_kg-0.9.0/src/aiecs_kg/ports/llm_client.py +92 -0
- aiecs_kg-0.9.0/src/aiecs_kg/ports/token_usage.py +91 -0
- aiecs_kg-0.9.0/src/aiecs_kg/scripts/__init__.py +7 -0
- aiecs_kg-0.9.0/src/aiecs_kg/scripts/run_threshold_experiments.py +208 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/__init__.py +23 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/base.py +975 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/batch_operations.py +472 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/cache.py +428 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/composite/__init__.py +11 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/composite/composite_store.py +298 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/composite/projection_job.py +136 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/composite/sync_worker.py +101 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/distributed.py +227 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/error_handling.py +384 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/graceful_degradation.py +300 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/health_checks.py +382 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/in_memory.py +1367 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/index_optimization.py +465 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/lazy_loading.py +438 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/metrics.py +354 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/migration.py +415 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/neo4j/__init__.py +11 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/neo4j/_import.py +20 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/neo4j/cypher_builder.py +211 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/neo4j/driver_pool.py +74 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/neo4j/gds.py +219 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/neo4j/graph_store.py +440 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/neo4j/schema.cypher +9 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/pagination.py +484 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/performance_monitoring.py +460 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/postgres.py +1768 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/property_storage.py +356 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/protocols.py +74 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/query_optimizer.py +658 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/schema_cache.py +296 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/sqlite.py +1464 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/streaming.py +493 -0
- aiecs_kg-0.9.0/src/aiecs_kg/storage/tenant.py +418 -0
- aiecs_kg-0.9.0/src/aiecs_kg.egg-info/PKG-INFO +340 -0
- aiecs_kg-0.9.0/src/aiecs_kg.egg-info/SOURCES.txt +356 -0
- aiecs_kg-0.9.0/src/aiecs_kg.egg-info/dependency_links.txt +1 -0
- aiecs_kg-0.9.0/src/aiecs_kg.egg-info/requires.txt +90 -0
- aiecs_kg-0.9.0/src/aiecs_kg.egg-info/top_level.txt +1 -0
aiecs_kg-0.9.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright (c) IRETBL Corporation. All rights reserved.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) IRETBL Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the Apache-2.0. See LICENSE in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
aiecs_kg-0.9.0/PKG-INFO
ADDED
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: aiecs-kg
|
|
3
|
+
Version: 0.9.0
|
|
4
|
+
Summary: Enterprise knowledge graph (L2) — optional PyPI package split from AIECS
|
|
5
|
+
Author-email: AIECS Team <iretbl@gmail.com>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/Howmany-Zeta/AI-Execute-Services-KnowledgeGraph
|
|
8
|
+
Project-URL: Documentation, https://github.com/Howmany-Zeta/AI-Execute-Services-KnowledgeGraph#readme
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/Howmany-Zeta/AI-Execute-Services-KnowledgeGraph/issues
|
|
10
|
+
Keywords: knowledge-graph,graph-store,aiecs,rag,entity-linking
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
18
|
+
Requires-Python: <3.13,>=3.11
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
License-File: LICENSE_HEADER.txt
|
|
22
|
+
Requires-Dist: pydantic<3.0.0,>=2.11.5
|
|
23
|
+
Requires-Dist: pydantic-settings<3.0.0,>=2.9.1
|
|
24
|
+
Requires-Dist: python-dotenv<2.0.0,>=1.1.0
|
|
25
|
+
Requires-Dist: numpy<3.0.0,>=2.4.1
|
|
26
|
+
Requires-Dist: networkx<4.0.0,>=3.0
|
|
27
|
+
Requires-Dist: cachetools<6.0.0,>=5.0.0
|
|
28
|
+
Requires-Dist: typing-extensions<5.0.0,>=4.13.2
|
|
29
|
+
Requires-Dist: pyyaml<7.0.0,>=6.0.2
|
|
30
|
+
Requires-Dist: tqdm<5.0.0,>=4.66.0
|
|
31
|
+
Provides-Extra: postgres
|
|
32
|
+
Requires-Dist: asyncpg<1.0.0,>=0.30.0; extra == "postgres"
|
|
33
|
+
Provides-Extra: sqlite
|
|
34
|
+
Requires-Dist: aiosqlite<1.0.0,>=0.20.0; extra == "sqlite"
|
|
35
|
+
Provides-Extra: neo4j
|
|
36
|
+
Requires-Dist: neo4j<6.0.0,>=5.25.0; extra == "neo4j"
|
|
37
|
+
Provides-Extra: graph
|
|
38
|
+
Requires-Dist: asyncpg<1.0.0,>=0.30.0; extra == "graph"
|
|
39
|
+
Requires-Dist: neo4j<6.0.0,>=5.25.0; extra == "graph"
|
|
40
|
+
Provides-Extra: reasoning
|
|
41
|
+
Requires-Dist: lark-parser<0.13.0,>=0.12.0; extra == "reasoning"
|
|
42
|
+
Requires-Dist: colorama<1.0.0,>=0.4.6; extra == "reasoning"
|
|
43
|
+
Requires-Dist: python-Levenshtein<1.0.0,>=0.25.0; extra == "reasoning"
|
|
44
|
+
Provides-Extra: builder
|
|
45
|
+
Requires-Dist: pandas<3.0.0,>=2.2.0; extra == "builder"
|
|
46
|
+
Requires-Dist: openpyxl<4.0.0,>=3.1.0; extra == "builder"
|
|
47
|
+
Requires-Dist: pyreadstat<2.0.0,>=1.2.0; extra == "builder"
|
|
48
|
+
Requires-Dist: psutil<8.0.0,>=6.0.0; extra == "builder"
|
|
49
|
+
Provides-Extra: fusion
|
|
50
|
+
Requires-Dist: redis<7.0.0,>=6.2.0; extra == "fusion"
|
|
51
|
+
Provides-Extra: spg
|
|
52
|
+
Requires-Dist: urllib3<3.0.0,>=2.0.0; extra == "spg"
|
|
53
|
+
Requires-Dist: six>=1.16.0; extra == "spg"
|
|
54
|
+
Requires-Dist: python-dateutil>=2.8.0; extra == "spg"
|
|
55
|
+
Requires-Dist: certifi>=2024.0.0; extra == "spg"
|
|
56
|
+
Provides-Extra: dev
|
|
57
|
+
Requires-Dist: pytest<9.0.0,>=8.4.2; extra == "dev"
|
|
58
|
+
Requires-Dist: pytest-asyncio<2.0.0,>=1.2.0; extra == "dev"
|
|
59
|
+
Requires-Dist: pytest-cov<8.0.0,>=7.0.0; extra == "dev"
|
|
60
|
+
Requires-Dist: pytest-timeout<3.0.0,>=2.4.0; extra == "dev"
|
|
61
|
+
Requires-Dist: mypy<2.0.0,>=1.18.2; extra == "dev"
|
|
62
|
+
Requires-Dist: flake8<8.0.0,>=7.3.0; extra == "dev"
|
|
63
|
+
Requires-Dist: black<26.0.0,>=25.1.0; extra == "dev"
|
|
64
|
+
Requires-Dist: pre-commit<5.0.0,>=4.5.1; extra == "dev"
|
|
65
|
+
Requires-Dist: deptry<0.24.0,>=0.23.0; extra == "dev"
|
|
66
|
+
Requires-Dist: types-PyYAML>=6.0.0; extra == "dev"
|
|
67
|
+
Requires-Dist: types-cachetools>=5.0.0; extra == "dev"
|
|
68
|
+
Requires-Dist: types-six>=1.16.0; extra == "dev"
|
|
69
|
+
Requires-Dist: types-python-dateutil>=2.8.0; extra == "dev"
|
|
70
|
+
Requires-Dist: asyncpg<1.0.0,>=0.30.0; extra == "dev"
|
|
71
|
+
Requires-Dist: aiosqlite<1.0.0,>=0.20.0; extra == "dev"
|
|
72
|
+
Requires-Dist: lark-parser<0.13.0,>=0.12.0; extra == "dev"
|
|
73
|
+
Requires-Dist: colorama<1.0.0,>=0.4.6; extra == "dev"
|
|
74
|
+
Requires-Dist: python-Levenshtein<1.0.0,>=0.25.0; extra == "dev"
|
|
75
|
+
Requires-Dist: redis<7.0.0,>=6.2.0; extra == "dev"
|
|
76
|
+
Requires-Dist: neo4j<6.0.0,>=5.25.0; extra == "dev"
|
|
77
|
+
Requires-Dist: pandas<3.0.0,>=2.2.0; extra == "dev"
|
|
78
|
+
Requires-Dist: openpyxl<4.0.0,>=3.1.0; extra == "dev"
|
|
79
|
+
Requires-Dist: pyreadstat<2.0.0,>=1.2.0; extra == "dev"
|
|
80
|
+
Requires-Dist: psutil<8.0.0,>=6.0.0; extra == "dev"
|
|
81
|
+
Provides-Extra: all
|
|
82
|
+
Requires-Dist: asyncpg<1.0.0,>=0.30.0; extra == "all"
|
|
83
|
+
Requires-Dist: aiosqlite<1.0.0,>=0.20.0; extra == "all"
|
|
84
|
+
Requires-Dist: neo4j<6.0.0,>=5.25.0; extra == "all"
|
|
85
|
+
Requires-Dist: lark-parser<0.13.0,>=0.12.0; extra == "all"
|
|
86
|
+
Requires-Dist: colorama<1.0.0,>=0.4.6; extra == "all"
|
|
87
|
+
Requires-Dist: python-Levenshtein<1.0.0,>=0.25.0; extra == "all"
|
|
88
|
+
Requires-Dist: pandas<3.0.0,>=2.2.0; extra == "all"
|
|
89
|
+
Requires-Dist: openpyxl<4.0.0,>=3.1.0; extra == "all"
|
|
90
|
+
Requires-Dist: pyreadstat<2.0.0,>=1.2.0; extra == "all"
|
|
91
|
+
Requires-Dist: psutil<8.0.0,>=6.0.0; extra == "all"
|
|
92
|
+
Requires-Dist: redis<7.0.0,>=6.2.0; extra == "all"
|
|
93
|
+
Requires-Dist: urllib3<3.0.0,>=2.0.0; extra == "all"
|
|
94
|
+
Requires-Dist: six>=1.16.0; extra == "all"
|
|
95
|
+
Requires-Dist: python-dateutil>=2.8.0; extra == "all"
|
|
96
|
+
Requires-Dist: certifi>=2024.0.0; extra == "all"
|
|
97
|
+
Provides-Extra: release
|
|
98
|
+
Requires-Dist: build<2.0.0,>=1.2.0; extra == "release"
|
|
99
|
+
Requires-Dist: twine<7.0.0,>=5.1.0; extra == "release"
|
|
100
|
+
Requires-Dist: packaging<26.0.0,>=24.0; extra == "release"
|
|
101
|
+
Dynamic: license-file
|
|
102
|
+
|
|
103
|
+
# aiecs-kg
|
|
104
|
+
|
|
105
|
+
Enterprise knowledge graph (L2) for [AIECS](https://github.com/Howmany-Zeta/AI-Execute-Services), split from the monorepo as an optional PyPI package.
|
|
106
|
+
|
|
107
|
+
## Status
|
|
108
|
+
|
|
109
|
+
**0.9.0 (Beta)** — first non-prerelease PyPI cut (`Development Status :: 4 - Beta`; tag `v0.9.0`). Includes SPG OpenAPI/write-token work, live gates/F1a, and packaging integrity fixes. Core graph store, reasoning (heuristic + Logic DSL), builder paths, and OpenSPG (`[spg]`) integration are usable; PostgreSQL / Neo4j dual-store and LLM features require optional extras and caller configuration.
|
|
110
|
+
|
|
111
|
+
Not GA: treat as Beta until maintainers attest PostgreSQL, Neo4j/`pg_neo4j`, and SPG live paths outside default CI. Security reporting: [SECURITY.md](SECURITY.md).
|
|
112
|
+
|
|
113
|
+
See [docs/development_plan/archive/KNOWLEDGE_GRAPH_OPTIONAL_PACKAGING.md](docs/development_plan/archive/KNOWLEDGE_GRAPH_OPTIONAL_PACKAGING.md) for the full split checklist.
|
|
114
|
+
|
|
115
|
+
### CI verification scope
|
|
116
|
+
|
|
117
|
+
GitHub Actions (`pip install -e ".[dev]"`, no external services) validates:
|
|
118
|
+
|
|
119
|
+
| Area | CI | Requires local / maintainer setup |
|
|
120
|
+
|------|-----|-----------------------------------|
|
|
121
|
+
| In-memory graph store | Yes | — |
|
|
122
|
+
| SQLite backend | Yes | — |
|
|
123
|
+
| Reasoning (Logic DSL, orchestrator) | Yes | — |
|
|
124
|
+
| Structured builder import | Yes | — |
|
|
125
|
+
| LLM injection (mock clients) | Yes | Real LLM keys: manual / nightly |
|
|
126
|
+
| PostgreSQL (`[postgres]`) | No (skip) | `KG_POSTGRES_URL` + `.env.test` |
|
|
127
|
+
| Neo4j / `pg_neo4j` / GDS (`[graph]`) | No (skip) | `KG_NEO4J_URI` + system Neo4j 5.26+ |
|
|
128
|
+
| AIECS integrations | No (skip) | `pip install -r requirements/optional-aiecs.txt` (or `pip install aiecs`) |
|
|
129
|
+
| SPG / OpenSPG (`[spg]`) | Unit + mock only | `pip install aiecs-kg[spg]` + compose; see [docs/spg/README.md](docs/spg/README.md) |
|
|
130
|
+
|
|
131
|
+
Release gate (tag `v*`): unit tests + `deptry` + `build` + `twine check` + artifact `smoke` (LICENSE + package data) + `verify-install` (Logic DSL from wheel). Does **not** run Postgres/Neo4j/SPG live integration (see [scripts/README.md](scripts/README.md)).
|
|
132
|
+
|
|
133
|
+
## Install
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Core (in-memory graph store)
|
|
137
|
+
pip install -e .
|
|
138
|
+
|
|
139
|
+
# With backends
|
|
140
|
+
pip install -e ".[postgres,sqlite,reasoning]"
|
|
141
|
+
|
|
142
|
+
# Neo4j graph compute + PostgreSQL dual-store (Phase NG)
|
|
143
|
+
pip install -e ".[graph]" # neo4j + postgres extras
|
|
144
|
+
# or: pip install -e ".[neo4j,postgres]"
|
|
145
|
+
|
|
146
|
+
# Development
|
|
147
|
+
pip install -e ".[dev,sqlite]"
|
|
148
|
+
|
|
149
|
+
# OpenSPG / aiecs-spg HTTP client + Profile B bridge
|
|
150
|
+
pip install -e ".[dev,spg]"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Optional extras (`pyproject.toml`)
|
|
154
|
+
|
|
155
|
+
| Extra | Installs | LLM / AIECS |
|
|
156
|
+
|-------|----------|-------------|
|
|
157
|
+
| *(core)* | Graph store, reasoning heuristics | No LLM — pass `llm_client=` / `embedding_client=` yourself |
|
|
158
|
+
| `postgres` / `sqlite` / `neo4j` / `graph` | Storage backends (`graph` = neo4j + postgres) | No LLM |
|
|
159
|
+
| `reasoning` | Lark Logic DSL parser | No LLM |
|
|
160
|
+
| `builder` | Structured data import (pandas, etc.) | No LLM; `GraphBuilder` accepts injected `embedding_client=` |
|
|
161
|
+
| `fusion` | Redis-backed fusion helpers | No LLM |
|
|
162
|
+
| `spg` | urllib3/six/dateutil for OpenSPG HTTP SDK | `client/spg/*`, `KG_STORAGE_MODE=spg`; see [docs/spg/README.md](docs/spg/README.md) |
|
|
163
|
+
| `all` | Union of runtime extras above (not `dev` / `release`) | No LLM |
|
|
164
|
+
| `dev` / `release` | Test/lint tools; build/twine | Maintainers |
|
|
165
|
+
|
|
166
|
+
Heavy optional stacks stay out of PyPI extras (keeps lock/resolve light). Install from the repo:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
pip install -r requirements/optional-aiecs.txt # aiecs integrations helpers
|
|
170
|
+
pip install -r requirements/optional-nlp.txt # spaCy NER
|
|
171
|
+
pip install -r requirements/optional-rerank.txt # CrossEncoder rerank
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
For LLM usage patterns see [LLM integration](#llm-integration) and [LLM_CLIENT_INJECTION_PLAN.md §7](docs/development_plan/archive/LLM_CLIENT_INJECTION_PLAN.md).
|
|
175
|
+
|
|
176
|
+
Deprecated factory methods (`GraphBuilder.from_config`, `LLMEntityExtractor.from_config`) remain for compatibility but do not resolve AIECS clients in core — use explicit injection or `aiecs_kg.integrations.aiecs`.
|
|
177
|
+
|
|
178
|
+
### Storage modes (`KG_STORAGE_MODE`)
|
|
179
|
+
|
|
180
|
+
| Mode | PostgreSQL | Neo4j | Use case |
|
|
181
|
+
|------|------------|-------|----------|
|
|
182
|
+
| `pg_only` (default) | authority + vector | — | Zero Neo4j regression; Python graph fallback |
|
|
183
|
+
| `pg_neo4j` | authority + pgvector RAG | traverse + GDS projection | **Recommended production** embed path |
|
|
184
|
+
| `neo4j_only` | — | single store | POC / graph-only dev |
|
|
185
|
+
|
|
186
|
+
Design: [AIECS_KG_NEO4J_PG_DUAL_STORE_DESIGN.md](docs/development_plan/archive/AIECS_KG_NEO4J_PG_DUAL_STORE_DESIGN.md) · ADR: [ADR-004](docs/development_plan/adr/ADR-004-neo4j-pg-dual-store.md)
|
|
187
|
+
|
|
188
|
+
### pg_neo4j quick example
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
export KG_STORAGE_MODE=pg_neo4j
|
|
192
|
+
export KG_STORAGE_BACKEND=postgresql
|
|
193
|
+
export KG_POSTGRES_URL=postgresql://user:pass@localhost:5432/aiecs_knowledge_graph
|
|
194
|
+
export KG_NEO4J_URI=bolt://localhost:7687
|
|
195
|
+
export KG_NEO4J_USER=neo4j
|
|
196
|
+
export KG_NEO4J_PASSWORD=your-password
|
|
197
|
+
export KG_NEO4J_DATABASE=aiecs_graph
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
```python
|
|
201
|
+
from aiecs_kg import create_graph_store, create_graph_algorithm_service
|
|
202
|
+
|
|
203
|
+
store = create_graph_store() # CompositeGraphStore when pg_neo4j
|
|
204
|
+
await store.initialize()
|
|
205
|
+
algo = create_graph_algorithm_service(graph_store=store)
|
|
206
|
+
scores = await algo.pagerank(seed_entity_ids=["entity-a"], top_k=10)
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
See [.env.example](.env.example) for all `KG_*` variables.
|
|
210
|
+
|
|
211
|
+
## Quick start
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
from aiecs_kg import create_graph_store, Entity
|
|
215
|
+
|
|
216
|
+
store = create_graph_store() # KG_STORAGE_BACKEND=inmemory (default)
|
|
217
|
+
await store.initialize()
|
|
218
|
+
|
|
219
|
+
entity = Entity(id="e1", entity_type="Person", properties={"name": "Alice"})
|
|
220
|
+
await store.add_entity(entity)
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Reasoning (Phase R0–R2)
|
|
224
|
+
|
|
225
|
+
Prefer `ReasoningOrchestrator` over `ReasoningEngine` for NL, Logic DSL, and hybrid pipelines:
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
import asyncio
|
|
229
|
+
from aiecs_kg import create_reasoning_orchestrator, ReasoningOrchestrator
|
|
230
|
+
from aiecs_kg.application.reasoning import ReasoningPipelineConfig
|
|
231
|
+
|
|
232
|
+
async def main():
|
|
233
|
+
orchestrator = create_reasoning_orchestrator() # or ReasoningOrchestrator(store, ...)
|
|
234
|
+
result = await orchestrator.query(
|
|
235
|
+
"Find all people older than 30",
|
|
236
|
+
mode="hybrid", # nl | logic_dsl | hybrid
|
|
237
|
+
context={"start_entity_id": "alice"},
|
|
238
|
+
)
|
|
239
|
+
print(result.answer, result.evidence_count)
|
|
240
|
+
|
|
241
|
+
asyncio.run(main())
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
Install Logic DSL support: `pip install -e ".[reasoning]"`. Optional rerank: `pip install -r requirements/optional-rerank.txt`.
|
|
245
|
+
|
|
246
|
+
## LLM integration
|
|
247
|
+
|
|
248
|
+
`pip install aiecs-kg` does **not** install or import AIECS. LLM-powered features (entity/relation extraction, NL→DSL, QueryPlan, embeddings) require a caller-provided client via constructor or factory parameters (`llm_client=`, `embedding_client=`).
|
|
249
|
+
|
|
250
|
+
```python
|
|
251
|
+
from aiecs_kg import create_reasoning_orchestrator
|
|
252
|
+
from aiecs_kg.ports.llm_client import LLMMessage # use this, not aiecs.llm.LLMMessage
|
|
253
|
+
|
|
254
|
+
# Heuristic / retrieval-only — no LLM required
|
|
255
|
+
orchestrator = create_reasoning_orchestrator()
|
|
256
|
+
|
|
257
|
+
# With an injected client (AIECS resolve_llm_client, OpenAI SDK wrapper, etc.)
|
|
258
|
+
orchestrator = create_reasoning_orchestrator(llm_client=my_client)
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
All `generate_text` messages in core code use `aiecs_kg.ports.llm_client.LLMMessage`. Clients must implement at least `generate_text` and/or `get_embeddings` (see `LLMClientProtocol`). For a minimal OpenAI SDK example without AIECS, see [LLM_CLIENT_INJECTION_PLAN.md §7.4](docs/development_plan/archive/LLM_CLIENT_INJECTION_PLAN.md#74-自定义-client任意-sdk--无需-aiecs).
|
|
262
|
+
|
|
263
|
+
Optional AIECS convenience helpers (when both packages are installed) live under `aiecs_kg.integrations.aiecs` — not exported from core `__init__.py`.
|
|
264
|
+
|
|
265
|
+
## Configuration
|
|
266
|
+
|
|
267
|
+
All settings use `KG_*` environment variables. See [.env.example](.env.example).
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
export KG_STORAGE_BACKEND=inmemory # inmemory | sqlite | postgresql
|
|
271
|
+
export KG_ENABLED=true # consumed by AIECS core (not this package)
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### OpenSPG / SPG mode (`KG_STORAGE_MODE=spg`)
|
|
275
|
+
|
|
276
|
+
Install: `pip install aiecs-kg[spg]`. Set `KG_STORAGE_MODE=spg` plus:
|
|
277
|
+
|
|
278
|
+
| Variable | Required | Description |
|
|
279
|
+
|----------|----------|-------------|
|
|
280
|
+
| `KG_SPG_HOST` | Yes | Server URL (e.g. `http://127.0.0.1:8887`) |
|
|
281
|
+
| `KG_SPG_PROJECT_ID` | Yes | OpenSPG project id |
|
|
282
|
+
| `KG_SPG_WRITE_TOKEN` | Yes | Write-graph token (request body only — never log) |
|
|
283
|
+
| `KG_SPG_NAMESPACE` | Recommended | Schema/type namespace |
|
|
284
|
+
| `KG_SPG_WRITE_TOKEN_NEXT` | Optional | Dual-token rotation |
|
|
285
|
+
| `KG_REASONING_MODE` | Optional | Default orchestrator mode |
|
|
286
|
+
| `KG_SPG_WRITE_GRAPH_THRESHOLD` | Optional | Bulk vs `write_graph` threshold (default 500) |
|
|
287
|
+
| `KG_SPG_BRIDGE_ENABLED` | Optional | Profile B deployment flag |
|
|
288
|
+
|
|
289
|
+
**Profile A** — `GraphBuilder` / `ReasoningOrchestrator` → `client/spg` HTTP (no `kag` wheel).
|
|
290
|
+
|
|
291
|
+
**Profile B** — Pemja → `integrations/spg_bridge.SpgServerBridge` → same L3 paths. F1a (UI DAG → Neo4jSinkWriter) is documented only; F1b (bridge → HTTP) is the Repo B contract. See [docs/spg/README.md](docs/spg/README.md).
|
|
292
|
+
|
|
293
|
+
## Project layout
|
|
294
|
+
|
|
295
|
+
```
|
|
296
|
+
src/aiecs_kg/
|
|
297
|
+
├── domain/ # Entity, Relation, schema models
|
|
298
|
+
├── application/ # search, reasoning, builder, fusion, …
|
|
299
|
+
├── client/spg/ # OpenSPG HTTP SDK (L2, optional [spg])
|
|
300
|
+
├── integrations/ # spg_bridge (Profile B), aiecs helpers
|
|
301
|
+
├── storage/ # GraphStore backends (in-memory, SQLite, Postgres)
|
|
302
|
+
├── config.py # KGSettings / get_kg_settings()
|
|
303
|
+
└── factory.py # create_graph_store()
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Tests
|
|
307
|
+
|
|
308
|
+
```bash
|
|
309
|
+
# 1) 依赖(见 .env.test 注释)
|
|
310
|
+
pip install -e ".[dev]"
|
|
311
|
+
pip install -r requirements/optional-rerank.txt
|
|
312
|
+
pip install -r requirements/optional-nlp.txt
|
|
313
|
+
python -m spacy download en_core_web_sm
|
|
314
|
+
# aiecs:prefer requirements/optional-aiecs.txt; if resolve conflicts, editable install
|
|
315
|
+
pip install -r requirements/optional-aiecs.txt
|
|
316
|
+
# or: pip install -e /path/to/python-middleware-dev
|
|
317
|
+
|
|
318
|
+
# 2) 环境
|
|
319
|
+
set -a && source .env.test && set +a # KG_USE_AIECS_STUB=false + XAI_API_KEY 等
|
|
320
|
+
|
|
321
|
+
pytest tests/unit -q
|
|
322
|
+
pytest tests/integration/spg/ -q # SPG mock + skipped live without KG_SPG_HOST
|
|
323
|
+
pytest tests/integration/neo4j_graph/ -q # 需系统 Neo4j 5.26.x + GDS(ADR-004)
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
## Pre-commit
|
|
327
|
+
|
|
328
|
+
Same hook set as [AI-Execute-Services](https://github.com/Howmany-Zeta/AI-Execute-Services): license header, black, flake8, mypy, and **deptry** (no AIECS-specific schema hooks).
|
|
329
|
+
|
|
330
|
+
Runtime extras are declared in `pyproject.toml`; heavy optional stacks use `requirements/optional-*.txt`. CI installs `pip install -e ".[dev]"` (+ optional-dev-heavy as needed). See `.cursor/rules/dependency-maintenance.mdc`.
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
pip install -e ".[dev]"
|
|
334
|
+
pre-commit install
|
|
335
|
+
pre-commit run --all-files
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
## License
|
|
339
|
+
|
|
340
|
+
Apache-2.0 — see [LICENSE](LICENSE).
|