agentic-graphrag 0.0.3__tar.gz → 0.0.4__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.
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/PKG-INFO +2 -2
- agentic_graphrag-0.0.4/agrag/agents/__init__.py +19 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/settings.py +5 -2
- agentic_graphrag-0.0.4/agrag/common/data_models/__init__.py +43 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/entities.py +1 -2
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/schema.py +20 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/embedding/settings.py +4 -1
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/eval/settings.py +7 -2
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/graphdb/base.py +6 -1
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/graphdb/neo4j.py +28 -1
- agentic_graphrag-0.0.4/agrag/graphdb/serialize.py +227 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/graphdb/settings.py +1 -1
- agentic_graphrag-0.0.4/agrag/ingestion/__init__.py +34 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/_ingest_pipeline.py +5 -141
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/extract.py +4 -1
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/graph.py +11 -5
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/materialize.py +5 -11
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/resolve/candidate_source.py +3 -4
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/settings.py +4 -1
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/client_config.py +3 -1
- agentic_graphrag-0.0.4/agrag/loaders/__init__.py +52 -0
- agentic_graphrag-0.0.4/agrag/retrieval/__init__.py +52 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/identity.py +2 -2
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/retrievers/bfs.py +2 -2
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/retrievers/entity.py +3 -5
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/search_engine.py +6 -3
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/settings.py +4 -1
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/vectordb/settings.py +6 -3
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/pyproject.toml +2 -2
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/pyproject.toml.orig +2 -2
- agentic_graphrag-0.0.3/agrag/agents/__init__.py +0 -6
- agentic_graphrag-0.0.3/agrag/common/data_models/__init__.py +0 -6
- agentic_graphrag-0.0.3/agrag/graphdb/serialize.py +0 -85
- agentic_graphrag-0.0.3/agrag/ingestion/__init__.py +0 -6
- agentic_graphrag-0.0.3/agrag/retrieval/__init__.py +0 -1
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/LICENSE +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/README.md +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/build.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/errors.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/harness.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/ledger.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/middleware.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/model.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/prompts.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/result.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/subagents.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/tools/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/tools/aggregate.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/tools/search.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/tools/traversal.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/tracing.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/agents/verification.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/_docling_adapters.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/_text.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/base.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/docling.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/extras.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/heading.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/parent_child.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/recursive.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/rules.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/sentence.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/token.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/chunking/turns.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/chunk.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/community.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/cutover_job.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/data_point.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/document.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/entity.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/extraction.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/graph_record.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/graph_schema.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/normalization.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/provenance.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/query_value.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/relation.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/resolved_entity.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/search_result.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/stage_failure.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/data_models/vector_record.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/text.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/common/validation.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/_pending_filter.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/community_read.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/community_write.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/cutover_job_read.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/cutover_job_write.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/relations.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/resolution_read.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/resolution_write.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/cypher/safety.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/embedding/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/embedding/base.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/embedding/errors.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/embedding/fastembed_bm25.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/embedding/sentence_transformers.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/embedding/sparse_base.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/eval/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/eval/adapter.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/eval/answer.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/eval/extraction.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/eval/judge.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/eval/resolution.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/eval/trajectory.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/eval/verifier.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/graphdb/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/graphdb/errors.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/_clustering.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/_cutover.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/_document_lifecycle.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/_lexical_backbone.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/_resume.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/community.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/merge.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/reports/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/reports/add_result.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/reports/community_detection_report.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/reports/consolidation_report.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/reports/reevaluation_report.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/reports/update_result.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/resolve/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/resolve/batch_validation.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/resolve/comparators.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/resolve/exact_groups.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/resolve/resolver.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/resolve/zone_classifier.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/resolved_embeddings.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/stats/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/stats/chunking.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/stats/extraction.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/stats/ingest.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/stats/merge.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/stats/resolution.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/ingestion/stats/storage.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/async_client.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/config.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/globals.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/inlinedbaml.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/parser.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/runtime.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/stream_types.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/sync_client.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/tracing.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/type_builder.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/type_map.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/types.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_client/watchers.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_src/community.baml +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_src/extraction.baml +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_src/generators.baml +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_src/merge.baml +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_src/resolution.baml +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/baml_src/retrieval.baml +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/client_registry.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/retry.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/llm/tracing.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/_walk.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/base.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/decode.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/errors.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/readers/_common.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/readers/chat.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/readers/html.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/readers/prose.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/readers/records.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/registry.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/corpus/types.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/docling/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/loaders/docling/loader.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/observability.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/py.typed +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/community_context.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/errors.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/filters.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/fusion.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/methods/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/methods/traversal.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/methods/vector.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/recipes.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/rerank/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/rerank/cross_encoder.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/rerank/node_distance.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/resolved_entities.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/retrievers/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/retrievers/base.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/retrievers/chunk.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/retrievers/community.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/retrievers/text2cypher.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/retrieval/tracing.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/vectordb/__init__.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/vectordb/base.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/vectordb/errors.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/vectordb/milvus.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/vectordb/qdrant.py +0 -0
- {agentic_graphrag-0.0.3 → agentic_graphrag-0.0.4}/agrag/vectordb/weaviate.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agentic-graphrag
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.4
|
|
4
4
|
Summary: Agentic GraphRAG: graph-based retrieval-augmented generation with agentic reasoning.
|
|
5
5
|
Keywords: graphrag,rag,knowledge-graph,agents,retrieval
|
|
6
6
|
Author: Ashwin Mathur, Varun Mathur
|
|
@@ -41,7 +41,7 @@ Requires-Dist: transformers<4.56 ; extra == 'extract'
|
|
|
41
41
|
Requires-Dist: protobuf ; extra == 'extract'
|
|
42
42
|
Requires-Dist: baml-py>=0.226.1,<0.227 ; extra == 'llm'
|
|
43
43
|
Requires-Dist: pymilvus>=3.0.0,<4 ; extra == 'milvus'
|
|
44
|
-
Requires-Dist: neo4j>=5.
|
|
44
|
+
Requires-Dist: neo4j>=5.22 ; extra == 'neo4j'
|
|
45
45
|
Requires-Dist: opentelemetry-sdk>=1.20 ; extra == 'observability'
|
|
46
46
|
Requires-Dist: opentelemetry-exporter-otlp>=1.20 ; extra == 'observability'
|
|
47
47
|
Requires-Dist: opentelemetry-instrumentation-asyncio ; extra == 'observability'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Agentic layer: planner/researcher/verifier over SearchEngine.
|
|
2
|
+
|
|
3
|
+
``build_agent`` lives in ``agrag.agents.build`` and is not re-exported here: it needs
|
|
4
|
+
the ``agents`` extra to import, and this package must import on a base install.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from agrag.agents.errors import AgentMissingExtraError
|
|
8
|
+
from agrag.agents.ledger import Ledger
|
|
9
|
+
from agrag.agents.result import AgentRunResult
|
|
10
|
+
from agrag.agents.settings import AgentLLMSettings, AgentSettings
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"AgentLLMSettings",
|
|
15
|
+
"AgentMissingExtraError",
|
|
16
|
+
"AgentRunResult",
|
|
17
|
+
"AgentSettings",
|
|
18
|
+
"Ledger",
|
|
19
|
+
]
|
|
@@ -30,7 +30,10 @@ class AgentLLMSettings(BaseSettings):
|
|
|
30
30
|
"""
|
|
31
31
|
|
|
32
32
|
model_config = SettingsConfigDict(
|
|
33
|
-
env_prefix="AGENT_LLM_",
|
|
33
|
+
env_prefix="AGENT_LLM_",
|
|
34
|
+
env_file=".env",
|
|
35
|
+
extra="ignore",
|
|
36
|
+
hide_input_in_errors=True,
|
|
34
37
|
)
|
|
35
38
|
|
|
36
39
|
clients: list[LLMClientConfig]
|
|
@@ -99,7 +102,7 @@ class AgentSettings(BaseSettings):
|
|
|
99
102
|
"""
|
|
100
103
|
|
|
101
104
|
model_config = SettingsConfigDict(
|
|
102
|
-
env_prefix="AGENT_", env_file=".env", extra="ignore"
|
|
105
|
+
env_prefix="AGENT_", env_file=".env", extra="ignore", hide_input_in_errors=True
|
|
103
106
|
)
|
|
104
107
|
|
|
105
108
|
recursion_limit: int = 50
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Shared data models used by agrag components."""
|
|
2
|
+
|
|
3
|
+
from agrag.common.data_models.chunk import Chunk
|
|
4
|
+
from agrag.common.data_models.community import Community
|
|
5
|
+
from agrag.common.data_models.document import Document, DocumentFamily, SourceFormat
|
|
6
|
+
from agrag.common.data_models.entity import Entity
|
|
7
|
+
from agrag.common.data_models.graph_record import NodeRecord, RelationRecord
|
|
8
|
+
from agrag.common.data_models.graph_schema import (
|
|
9
|
+
GENERIC,
|
|
10
|
+
EntityType,
|
|
11
|
+
GraphSchema,
|
|
12
|
+
RelationType,
|
|
13
|
+
)
|
|
14
|
+
from agrag.common.data_models.normalization import Normalization
|
|
15
|
+
from agrag.common.data_models.provenance import PageProvenance, TextProvenance
|
|
16
|
+
from agrag.common.data_models.relation import Relation
|
|
17
|
+
from agrag.common.data_models.resolved_entity import ResolvedEntity
|
|
18
|
+
from agrag.common.data_models.search_result import SearchResult
|
|
19
|
+
from agrag.common.data_models.vector_record import Distance, VectorRecord
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
__all__ = [
|
|
23
|
+
"GENERIC",
|
|
24
|
+
"Chunk",
|
|
25
|
+
"Community",
|
|
26
|
+
"Distance",
|
|
27
|
+
"Document",
|
|
28
|
+
"DocumentFamily",
|
|
29
|
+
"Entity",
|
|
30
|
+
"EntityType",
|
|
31
|
+
"GraphSchema",
|
|
32
|
+
"NodeRecord",
|
|
33
|
+
"Normalization",
|
|
34
|
+
"PageProvenance",
|
|
35
|
+
"Relation",
|
|
36
|
+
"RelationRecord",
|
|
37
|
+
"RelationType",
|
|
38
|
+
"ResolvedEntity",
|
|
39
|
+
"SearchResult",
|
|
40
|
+
"SourceFormat",
|
|
41
|
+
"TextProvenance",
|
|
42
|
+
"VectorRecord",
|
|
43
|
+
]
|
|
@@ -378,8 +378,7 @@ def fetch_entity_neighbors_query() -> str:
|
|
|
378
378
|
"""
|
|
379
379
|
return (
|
|
380
380
|
"UNWIND $ids AS entity_id "
|
|
381
|
-
"CALL { "
|
|
382
|
-
"WITH entity_id "
|
|
381
|
+
"CALL (entity_id) { "
|
|
383
382
|
"MATCH (n:"
|
|
384
383
|
f"{NODE_IDENTITY_LABEL} {{id: entity_id}})-[r]-(m:{NODE_IDENTITY_LABEL}) "
|
|
385
384
|
"WHERE NOT type(r) IN $exclude_types "
|
|
@@ -249,6 +249,26 @@ def vector_index_query(
|
|
|
249
249
|
)
|
|
250
250
|
|
|
251
251
|
|
|
252
|
+
def vector_index_dimensions_query(
|
|
253
|
+
label: str, vector_property: str
|
|
254
|
+
) -> tuple[str, dict[str, Any]]:
|
|
255
|
+
"""Build a query that reads the dimension of an existing vector index.
|
|
256
|
+
|
|
257
|
+
Args:
|
|
258
|
+
label: The node label. Must already be validated.
|
|
259
|
+
vector_property: The vector property name. Must already be validated.
|
|
260
|
+
|
|
261
|
+
Returns:
|
|
262
|
+
The query and its parameters. The query returns one ``dimensions`` row
|
|
263
|
+
when the index exists and no rows when it does not.
|
|
264
|
+
"""
|
|
265
|
+
return (
|
|
266
|
+
"SHOW INDEXES YIELD name, options WHERE name = $name "
|
|
267
|
+
"RETURN options.indexConfig['vector.dimensions'] AS dimensions",
|
|
268
|
+
{"name": vector_index_name(label, vector_property)},
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
|
|
252
272
|
def vector_search_query(
|
|
253
273
|
index_name: str, filters: dict[str, Any] | None = None
|
|
254
274
|
) -> tuple[str, dict[str, Any]]:
|
|
@@ -22,7 +22,10 @@ class EmbeddingSettings(BaseSettings):
|
|
|
22
22
|
"""
|
|
23
23
|
|
|
24
24
|
model_config = SettingsConfigDict(
|
|
25
|
-
env_prefix="EMBEDDING_",
|
|
25
|
+
env_prefix="EMBEDDING_",
|
|
26
|
+
env_file=".env",
|
|
27
|
+
extra="ignore",
|
|
28
|
+
hide_input_in_errors=True,
|
|
26
29
|
)
|
|
27
30
|
|
|
28
31
|
model: str = "ibm-granite/granite-embedding-small-english-r2"
|
|
@@ -19,7 +19,9 @@ class _JudgeEnvVariables(BaseSettings):
|
|
|
19
19
|
below.
|
|
20
20
|
"""
|
|
21
21
|
|
|
22
|
-
model_config = SettingsConfigDict(
|
|
22
|
+
model_config = SettingsConfigDict(
|
|
23
|
+
env_file=".env", extra="ignore", hide_input_in_errors=True
|
|
24
|
+
)
|
|
23
25
|
|
|
24
26
|
eval_judge_base_url: str | None = Field(
|
|
25
27
|
default=None, validation_alias="EVAL_JUDGE_BASE_URL"
|
|
@@ -64,7 +66,10 @@ class EvalJudgeSettings(BaseSettings):
|
|
|
64
66
|
"""
|
|
65
67
|
|
|
66
68
|
model_config = SettingsConfigDict(
|
|
67
|
-
env_prefix="EVAL_JUDGE_",
|
|
69
|
+
env_prefix="EVAL_JUDGE_",
|
|
70
|
+
env_file=".env",
|
|
71
|
+
extra="ignore",
|
|
72
|
+
hide_input_in_errors=True,
|
|
68
73
|
)
|
|
69
74
|
|
|
70
75
|
client: LLMClientConfig
|
|
@@ -217,8 +217,13 @@ class GraphStore(ABC):
|
|
|
217
217
|
Args:
|
|
218
218
|
label: The node label to index.
|
|
219
219
|
vector_property: The embedding property name.
|
|
220
|
-
dimensions: The embedding dimension.
|
|
220
|
+
dimensions: The embedding dimension. If the index already exists
|
|
221
|
+
with a different dimension, this raises.
|
|
221
222
|
distance: The distance metric.
|
|
223
|
+
|
|
224
|
+
Raises:
|
|
225
|
+
EmbeddingDimensionMismatchError: The index already exists with a
|
|
226
|
+
different dimension than ``dimensions``.
|
|
222
227
|
"""
|
|
223
228
|
|
|
224
229
|
@abstractmethod
|
|
@@ -38,10 +38,12 @@ from agrag.cypher.schema import (
|
|
|
38
38
|
node_id_constraint_query,
|
|
39
39
|
relation_id_constraint_name,
|
|
40
40
|
relation_id_constraint_query,
|
|
41
|
+
vector_index_dimensions_query,
|
|
41
42
|
vector_index_name,
|
|
42
43
|
vector_index_query,
|
|
43
44
|
vector_search_query,
|
|
44
45
|
)
|
|
46
|
+
from agrag.embedding.errors import EmbeddingDimensionMismatchError
|
|
45
47
|
from agrag.graphdb.base import GraphStore, GraphStoreTransaction
|
|
46
48
|
from agrag.graphdb.errors import (
|
|
47
49
|
GraphStoreConstraintViolationError,
|
|
@@ -357,7 +359,10 @@ class Neo4jGraphStore(GraphStore):
|
|
|
357
359
|
# Lazy import: a clean install must raise
|
|
358
360
|
# GraphStoreMissingExtraError, not ImportError, when neo4j is
|
|
359
361
|
# absent.
|
|
360
|
-
from neo4j import
|
|
362
|
+
from neo4j import ( # noqa: PLC0415
|
|
363
|
+
AsyncGraphDatabase,
|
|
364
|
+
NotificationDisabledClassification,
|
|
365
|
+
)
|
|
361
366
|
except ImportError as exc:
|
|
362
367
|
raise GraphStoreMissingExtraError("neo4j") from exc
|
|
363
368
|
self._driver = AsyncGraphDatabase.driver(
|
|
@@ -367,6 +372,14 @@ class Neo4jGraphStore(GraphStore):
|
|
|
367
372
|
self._settings.password.get_secret_value(),
|
|
368
373
|
),
|
|
369
374
|
max_connection_lifetime=self._settings.max_connection_lifetime,
|
|
375
|
+
# The store probes labels and property keys that a new
|
|
376
|
+
# database does not have yet. The server reports each probe
|
|
377
|
+
# as UNRECOGNIZED, which is expected noise. Other
|
|
378
|
+
# classifications, such as PERFORMANCE and DEPRECATION,
|
|
379
|
+
# still reach the neo4j.notifications logger.
|
|
380
|
+
notifications_disabled_classifications=[
|
|
381
|
+
NotificationDisabledClassification.UNRECOGNIZED
|
|
382
|
+
],
|
|
370
383
|
)
|
|
371
384
|
return self._driver
|
|
372
385
|
|
|
@@ -861,6 +874,10 @@ class Neo4jGraphStore(GraphStore):
|
|
|
861
874
|
A concurrent creator can commit the same index after this operation
|
|
862
875
|
starts. Neo4j reports that race as an equivalent-schema error, which
|
|
863
876
|
means the requested index already exists.
|
|
877
|
+
|
|
878
|
+
Raises:
|
|
879
|
+
EmbeddingDimensionMismatchError: The index already exists with a
|
|
880
|
+
different dimension than ``dimensions``.
|
|
864
881
|
"""
|
|
865
882
|
from neo4j.exceptions import ClientError # noqa: PLC0415
|
|
866
883
|
|
|
@@ -874,6 +891,16 @@ class Neo4jGraphStore(GraphStore):
|
|
|
874
891
|
except ClientError as exc:
|
|
875
892
|
if exc.code != _EQUIVALENT_SCHEMA_RULE_ERROR:
|
|
876
893
|
raise
|
|
894
|
+
# CREATE ... IF NOT EXISTS keeps an existing index of the same name as
|
|
895
|
+
# it is, so a wrong-size embedder would otherwise write vectors the
|
|
896
|
+
# index never returns.
|
|
897
|
+
rows = await self.execute_read(
|
|
898
|
+
*vector_index_dimensions_query(label, vector_property)
|
|
899
|
+
)
|
|
900
|
+
if rows and rows[0]["dimensions"] != dimensions:
|
|
901
|
+
raise EmbeddingDimensionMismatchError(
|
|
902
|
+
expected=rows[0]["dimensions"], actual=dimensions
|
|
903
|
+
)
|
|
877
904
|
|
|
878
905
|
async def vector_search(
|
|
879
906
|
self,
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
"""Convert graph records to driver parameters and graph node rows to models."""
|
|
2
|
+
|
|
3
|
+
import contextlib
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
from typing import Any
|
|
7
|
+
from uuid import UUID
|
|
8
|
+
|
|
9
|
+
from agrag.common.data_models.chunk import CHUNK_LABEL
|
|
10
|
+
from agrag.common.data_models.entity import Entity
|
|
11
|
+
from agrag.common.data_models.graph_record import (
|
|
12
|
+
PENDING_JOB_ID_PROPERTY,
|
|
13
|
+
NodeRecord,
|
|
14
|
+
RelationRecord,
|
|
15
|
+
)
|
|
16
|
+
from agrag.cypher.entities import NODE_IDENTITY_LABEL
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _convert(value: Any) -> Any:
|
|
20
|
+
"""Recursively convert a value to a Neo4j-driver-friendly type.
|
|
21
|
+
|
|
22
|
+
Neo4j's driver rejects ``UUID`` objects and other non-primitive types, so any
|
|
23
|
+
``UUID`` becomes its string form and nested containers are walked the same
|
|
24
|
+
way.
|
|
25
|
+
|
|
26
|
+
Args:
|
|
27
|
+
value: The value to convert.
|
|
28
|
+
|
|
29
|
+
Returns:
|
|
30
|
+
The driver-safe equivalent of ``value``.
|
|
31
|
+
"""
|
|
32
|
+
if isinstance(value, UUID):
|
|
33
|
+
return str(value)
|
|
34
|
+
if isinstance(value, Mapping):
|
|
35
|
+
return {k: _convert(v) for k, v in value.items()}
|
|
36
|
+
if isinstance(value, (list, tuple, set)):
|
|
37
|
+
return [_convert(v) for v in value]
|
|
38
|
+
return value
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def node_params(record: NodeRecord) -> dict[str, Any]:
|
|
42
|
+
"""Build the ``$records`` entry for a node upsert.
|
|
43
|
+
|
|
44
|
+
The Cutover Job tag is split out of ``properties`` into its own key
|
|
45
|
+
because the upsert queries apply it with ``ON CREATE SET``: a job tags
|
|
46
|
+
the nodes it creates, never a node it writes over. Left inside the
|
|
47
|
+
applied property map it would be set on existing nodes too, which
|
|
48
|
+
would hide a committed node from retrieval for the job's duration and
|
|
49
|
+
put it in reach of the job's rollback — and rollback deletes tagged
|
|
50
|
+
rows.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
record: The node record to serialize.
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
A dict with ``id`` (string), ``properties`` (converted, without
|
|
57
|
+
the pending tag), and ``pending_job_id`` (the tag, or None).
|
|
58
|
+
"""
|
|
59
|
+
properties = dict(record.properties)
|
|
60
|
+
pending_job_id = properties.pop(PENDING_JOB_ID_PROPERTY, None)
|
|
61
|
+
return {
|
|
62
|
+
"id": str(record.id),
|
|
63
|
+
"properties": _convert(properties),
|
|
64
|
+
"pending_job_id": _convert(pending_job_id),
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def relation_params(record: RelationRecord) -> dict[str, Any]:
|
|
69
|
+
"""Build the ``$records`` entry for a relationship upsert.
|
|
70
|
+
|
|
71
|
+
The Cutover Job tag is split out of ``properties`` for the same reason
|
|
72
|
+
as in :func:`node_params`: only an edge the job creates carries it.
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
record: The relation record to serialize.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
A dict with ``id``, ``start_id``, ``end_id``, ``properties``
|
|
79
|
+
(converted, without the pending tag), and ``pending_job_id`` (the
|
|
80
|
+
tag, or None).
|
|
81
|
+
"""
|
|
82
|
+
properties = dict(record.properties)
|
|
83
|
+
pending_job_id = properties.pop(PENDING_JOB_ID_PROPERTY, None)
|
|
84
|
+
return {
|
|
85
|
+
"id": str(record.id),
|
|
86
|
+
"start_id": str(record.start_id),
|
|
87
|
+
"end_id": str(record.end_id),
|
|
88
|
+
"properties": _convert(properties),
|
|
89
|
+
"pending_job_id": _convert(pending_job_id),
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
def parse_entity_node(node: object) -> Entity | None: # noqa: PLR0912,PLR0915
|
|
94
|
+
"""Parse a GraphStore node row into an Entity.
|
|
95
|
+
|
|
96
|
+
Handles both neo4j Node objects and plain dict mocks used in unit tests.
|
|
97
|
+
"""
|
|
98
|
+
try:
|
|
99
|
+
props: dict = {}
|
|
100
|
+
labels: list[str] = []
|
|
101
|
+
node_id: object = None
|
|
102
|
+
|
|
103
|
+
if isinstance(node, dict) and "labels" in node and "properties" in node:
|
|
104
|
+
# Mock form: {"id": "...", "labels": [...], "properties": {...}}
|
|
105
|
+
labels = list(node.get("labels") or [])
|
|
106
|
+
props = dict(node.get("properties") or {})
|
|
107
|
+
node_id = node.get("id") or props.get("id")
|
|
108
|
+
elif isinstance(node, dict) and "id" in node:
|
|
109
|
+
# Flat mock where properties are top-level alongside id/labels
|
|
110
|
+
# e.g. {"n": {"id": "...", "name": "...", "merge_key": "..."}}
|
|
111
|
+
# But here node is that inner dict.
|
|
112
|
+
props = dict(node)
|
|
113
|
+
# id may be in props
|
|
114
|
+
node_id = props.get("id")
|
|
115
|
+
# labels might be in props or separate
|
|
116
|
+
maybe_labels = props.pop("labels", None)
|
|
117
|
+
if isinstance(maybe_labels, list):
|
|
118
|
+
labels = maybe_labels
|
|
119
|
+
# Try to get labels from node dict if present alongside
|
|
120
|
+
if not labels and "labels" in props:
|
|
121
|
+
labels = props.pop("labels") # type: ignore[assignment]
|
|
122
|
+
else:
|
|
123
|
+
# Attempt neo4j Node: dict(node) gives properties, node.labels gives labels
|
|
124
|
+
try:
|
|
125
|
+
props = dict(node) # ty: ignore[no-matching-overload] # type: ignore[arg-type]
|
|
126
|
+
except Exception:
|
|
127
|
+
props = {}
|
|
128
|
+
try:
|
|
129
|
+
maybe_labels = getattr(node, "labels", None)
|
|
130
|
+
if maybe_labels is not None:
|
|
131
|
+
labels = list(maybe_labels) # type: ignore[arg-type]
|
|
132
|
+
except Exception:
|
|
133
|
+
labels = []
|
|
134
|
+
# Try id from props or node["id"]
|
|
135
|
+
try:
|
|
136
|
+
node_id = props.get("id") # type: ignore[union-attr]
|
|
137
|
+
except Exception:
|
|
138
|
+
node_id = None
|
|
139
|
+
if node_id is None:
|
|
140
|
+
with contextlib.suppress(Exception):
|
|
141
|
+
node_id = node["id"] # type: ignore[index] # ty: ignore[not-subscriptable]
|
|
142
|
+
# Node may also be wrapped as {"n": Node}
|
|
143
|
+
if isinstance(node, dict) and "n" in node:
|
|
144
|
+
return parse_entity_node(node["n"])
|
|
145
|
+
|
|
146
|
+
if node_id is None:
|
|
147
|
+
# Fallback: id inside props
|
|
148
|
+
node_id = props.get("id")
|
|
149
|
+
|
|
150
|
+
# Determine label
|
|
151
|
+
label: str | None = None
|
|
152
|
+
if labels:
|
|
153
|
+
for lbl in labels:
|
|
154
|
+
if lbl not in (NODE_IDENTITY_LABEL, CHUNK_LABEL):
|
|
155
|
+
label = str(lbl)
|
|
156
|
+
break
|
|
157
|
+
if label is None:
|
|
158
|
+
# All labels were system labels, take first
|
|
159
|
+
label = str(labels[0]) if labels else None
|
|
160
|
+
if label is None:
|
|
161
|
+
# Fallback from merge_key
|
|
162
|
+
mk = props.get("merge_key") or ""
|
|
163
|
+
if isinstance(mk, str) and ":" in mk:
|
|
164
|
+
label = mk.split(":", 1)[0]
|
|
165
|
+
|
|
166
|
+
if label is None or node_id is None:
|
|
167
|
+
return None
|
|
168
|
+
|
|
169
|
+
# System keys not part of domain properties
|
|
170
|
+
system_keys = {
|
|
171
|
+
"name",
|
|
172
|
+
"merge_key",
|
|
173
|
+
"merged_from",
|
|
174
|
+
"merge_count",
|
|
175
|
+
"source_chunk_ids",
|
|
176
|
+
"created_at",
|
|
177
|
+
"embedding",
|
|
178
|
+
"id",
|
|
179
|
+
PENDING_JOB_ID_PROPERTY,
|
|
180
|
+
}
|
|
181
|
+
entity_props = {k: v for k, v in props.items() if k not in system_keys}
|
|
182
|
+
|
|
183
|
+
merged_from_raw = props.get("merged_from") or []
|
|
184
|
+
merged_from = [UUID(str(x)) for x in merged_from_raw if x]
|
|
185
|
+
|
|
186
|
+
try:
|
|
187
|
+
merge_count = int(props.get("merge_count", 1))
|
|
188
|
+
except Exception:
|
|
189
|
+
merge_count = 1
|
|
190
|
+
|
|
191
|
+
scids_raw = props.get("source_chunk_ids") or []
|
|
192
|
+
scids = [UUID(str(x)) for x in scids_raw if x]
|
|
193
|
+
|
|
194
|
+
embedding = props.get("embedding")
|
|
195
|
+
|
|
196
|
+
created_at_raw = props.get("created_at")
|
|
197
|
+
created_at = None
|
|
198
|
+
if isinstance(created_at_raw, str):
|
|
199
|
+
try:
|
|
200
|
+
created_at = datetime.fromisoformat(created_at_raw)
|
|
201
|
+
except Exception:
|
|
202
|
+
created_at = None
|
|
203
|
+
|
|
204
|
+
name_val = props.get("name")
|
|
205
|
+
if name_val is None:
|
|
206
|
+
mk = props.get("merge_key", "")
|
|
207
|
+
if isinstance(mk, str) and ":" in mk:
|
|
208
|
+
name_val = mk.split(":", 1)[1]
|
|
209
|
+
else:
|
|
210
|
+
name_val = mk or ""
|
|
211
|
+
|
|
212
|
+
kwargs: dict = {
|
|
213
|
+
"id": UUID(str(node_id)),
|
|
214
|
+
"label": label,
|
|
215
|
+
"name": str(name_val),
|
|
216
|
+
"properties": entity_props,
|
|
217
|
+
"merged_from": merged_from,
|
|
218
|
+
"merge_count": merge_count,
|
|
219
|
+
"source_chunk_ids": scids,
|
|
220
|
+
}
|
|
221
|
+
if embedding is not None:
|
|
222
|
+
kwargs["embedding"] = list(embedding) # type: ignore[arg-type]
|
|
223
|
+
if created_at is not None:
|
|
224
|
+
kwargs["created_at"] = created_at
|
|
225
|
+
return Entity(**kwargs)
|
|
226
|
+
except Exception:
|
|
227
|
+
return None
|
|
@@ -27,7 +27,7 @@ class Neo4jSettings(BaseSettings):
|
|
|
27
27
|
"""
|
|
28
28
|
|
|
29
29
|
model_config = SettingsConfigDict(
|
|
30
|
-
env_prefix="NEO4J_", env_file=".env", extra="ignore"
|
|
30
|
+
env_prefix="NEO4J_", env_file=".env", extra="ignore", hide_input_in_errors=True
|
|
31
31
|
)
|
|
32
32
|
|
|
33
33
|
uri: str = "bolt://localhost:7687"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""The ingestion package."""
|
|
2
|
+
|
|
3
|
+
from agrag.ingestion.extract import (
|
|
4
|
+
BAMLExtractor,
|
|
5
|
+
EscalatingExtractor,
|
|
6
|
+
ExtractionLLMSettings,
|
|
7
|
+
Extractor,
|
|
8
|
+
ExtractorMissingExtraError,
|
|
9
|
+
GlinerExtractor,
|
|
10
|
+
)
|
|
11
|
+
from agrag.ingestion.graph import Graph
|
|
12
|
+
from agrag.ingestion.reports import (
|
|
13
|
+
AddResult,
|
|
14
|
+
CommunityDetectionReport,
|
|
15
|
+
ConsolidationReport,
|
|
16
|
+
ReevaluationReport,
|
|
17
|
+
UpdateResult,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
__all__ = [
|
|
22
|
+
"AddResult",
|
|
23
|
+
"BAMLExtractor",
|
|
24
|
+
"CommunityDetectionReport",
|
|
25
|
+
"ConsolidationReport",
|
|
26
|
+
"EscalatingExtractor",
|
|
27
|
+
"ExtractionLLMSettings",
|
|
28
|
+
"Extractor",
|
|
29
|
+
"ExtractorMissingExtraError",
|
|
30
|
+
"GlinerExtractor",
|
|
31
|
+
"Graph",
|
|
32
|
+
"ReevaluationReport",
|
|
33
|
+
"UpdateResult",
|
|
34
|
+
]
|