graphiti-core 0.21.0rc13__tar.gz → 0.22.0rc1__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.
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/issue-triage.yml +1 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/PKG-INFO +1 -1
- graphiti_core-0.22.0rc1/graphiti_core/driver/driver.py +117 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/driver/neo4j_driver.py +0 -49
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/driver/neptune_driver.py +43 -26
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/client.py +7 -2
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/gemini_client.py +3 -1
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/openai_base_client.py +2 -1
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/openai_generic_client.py +2 -1
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/extract_nodes.py +39 -34
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/summarize_nodes.py +20 -17
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/maintenance/edge_operations.py +2 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/maintenance/node_operations.py +90 -51
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/pyproject.toml +1 -1
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/uv.lock +2 -2
- graphiti_core-0.21.0rc13/graphiti_core/driver/driver.py +0 -322
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.env.example +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/dependabot.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/pull_request_template.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/secret_scanning.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/ai-moderator.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/cla.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/claude-code-review.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/claude.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/codeql.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/daily_issue_maintenance.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/lint.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/mcp-server-docker.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/release-graphiti-core.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/typecheck.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.github/workflows/unit_tests.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/.gitignore +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/AGENTS.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/CLAUDE.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/CODE_OF_CONDUCT.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/CONTRIBUTING.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/Dockerfile +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/LICENSE +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/Makefile +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/README.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/SECURITY.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/Zep-CLA.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/conftest.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/depot.json +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/docker-compose.test.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/docker-compose.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/ellipsis.yaml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/data/manybirds_products.json +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/ecommerce/runner.ipynb +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/ecommerce/runner.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/langgraph-agent/agent.ipynb +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/langgraph-agent/tinybirds-jess.png +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/podcast/podcast_runner.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/podcast/podcast_transcript.txt +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/podcast/transcript_parser.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/quickstart/README.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/quickstart/quickstart_falkordb.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/quickstart/quickstart_neo4j.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/quickstart/quickstart_neptune.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/quickstart/requirements.txt +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/wizard_of_oz/parser.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/wizard_of_oz/runner.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/examples/wizard_of_oz/woo.txt +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/cross_encoder/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/cross_encoder/bge_reranker_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/cross_encoder/client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/cross_encoder/gemini_reranker_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/cross_encoder/openai_reranker_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/driver/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/driver/falkordb_driver.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/driver/kuzu_driver.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/edges.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/embedder/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/embedder/azure_openai.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/embedder/client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/embedder/gemini.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/embedder/openai.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/embedder/voyage.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/errors.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/graph_queries.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/graphiti.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/graphiti_types.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/helpers.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/anthropic_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/azure_openai_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/config.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/errors.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/groq_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/openai_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/utils.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/migrations/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/models/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/models/edges/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/models/edges/edge_db_queries.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/models/nodes/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/models/nodes/node_db_queries.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/nodes.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/dedupe_edges.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/dedupe_nodes.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/eval.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/extract_edge_dates.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/extract_edges.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/invalidate_edges.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/lib.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/models.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/prompts/prompt_helpers.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/py.typed +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/search/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/search/search.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/search/search_config.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/search/search_config_recipes.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/search/search_filters.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/search/search_helpers.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/search/search_utils.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/telemetry/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/telemetry/telemetry.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/bulk_utils.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/datetime_utils.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/maintenance/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/maintenance/community_operations.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/maintenance/dedup_helpers.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/maintenance/graph_data_operations.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/maintenance/temporal_operations.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/maintenance/utils.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/utils/ontology_utils/entity_types_utils.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/images/arxiv-screenshot.png +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/images/graphiti-graph-intro.gif +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/images/graphiti-intro-slides-stock-2.gif +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/images/simple_graph.svg +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/.env.example +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/.python-version +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/Dockerfile +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/README.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/cursor_rules.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/docker-compose.yml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/graphiti_mcp_server.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/mcp_config_sse_example.json +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/mcp_config_stdio_example.json +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/pyproject.toml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/mcp_server/uv.lock +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/py.typed +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/pytest.ini +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/.env.example +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/Makefile +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/README.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/config.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/dto/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/dto/common.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/dto/ingest.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/dto/retrieve.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/main.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/routers/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/routers/ingest.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/routers/retrieve.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/graph_service/zep_graphiti.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/pyproject.toml +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/server/uv.lock +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/signatures/version1/cla.json +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/cross_encoder/test_bge_reranker_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/cross_encoder/test_gemini_reranker_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/driver/__init__.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/driver/test_falkordb_driver.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/embedder/embedder_fixtures.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/embedder/test_gemini.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/embedder/test_openai.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/embedder/test_voyage.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/evals/data/longmemeval_data/README.md +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/evals/data/longmemeval_data/longmemeval_oracle.json +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/evals/eval_cli.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/evals/eval_e2e_graph_building.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/evals/pytest.ini +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/evals/utils.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/helpers_test.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/llm_client/test_anthropic_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/llm_client/test_anthropic_client_int.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/llm_client/test_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/llm_client/test_errors.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/llm_client/test_gemini_client.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/test_edge_int.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/test_entity_exclusion_int.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/test_graphiti_int.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/test_graphiti_mock.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/test_node_int.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/utils/maintenance/test_bulk_utils.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/utils/maintenance/test_edge_operations.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/utils/maintenance/test_node_operations.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/utils/maintenance/test_temporal_operations_int.py +0 -0
- {graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/tests/utils/search/search_utils_test.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: graphiti-core
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.22.0rc1
|
|
4
4
|
Summary: A temporal graph building library
|
|
5
5
|
Project-URL: Homepage, https://help.getzep.com/graphiti/graphiti/overview
|
|
6
6
|
Project-URL: Repository, https://github.com/getzep/graphiti
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Copyright 2024, Zep Software, Inc.
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
you may not use this file except in compliance with the License.
|
|
6
|
+
You may obtain a copy of the License at
|
|
7
|
+
|
|
8
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
|
|
10
|
+
Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
See the License for the specific language governing permissions and
|
|
14
|
+
limitations under the License.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
import copy
|
|
18
|
+
import logging
|
|
19
|
+
import os
|
|
20
|
+
from abc import ABC, abstractmethod
|
|
21
|
+
from collections.abc import Coroutine
|
|
22
|
+
from enum import Enum
|
|
23
|
+
from typing import Any
|
|
24
|
+
|
|
25
|
+
from dotenv import load_dotenv
|
|
26
|
+
|
|
27
|
+
logger = logging.getLogger(__name__)
|
|
28
|
+
|
|
29
|
+
DEFAULT_SIZE = 10
|
|
30
|
+
|
|
31
|
+
load_dotenv()
|
|
32
|
+
|
|
33
|
+
ENTITY_INDEX_NAME = os.environ.get('ENTITY_INDEX_NAME', 'entities')
|
|
34
|
+
EPISODE_INDEX_NAME = os.environ.get('EPISODE_INDEX_NAME', 'episodes')
|
|
35
|
+
COMMUNITY_INDEX_NAME = os.environ.get('COMMUNITY_INDEX_NAME', 'communities')
|
|
36
|
+
ENTITY_EDGE_INDEX_NAME = os.environ.get('ENTITY_EDGE_INDEX_NAME', 'entity_edges')
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class GraphProvider(Enum):
|
|
40
|
+
NEO4J = 'neo4j'
|
|
41
|
+
FALKORDB = 'falkordb'
|
|
42
|
+
KUZU = 'kuzu'
|
|
43
|
+
NEPTUNE = 'neptune'
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class GraphDriverSession(ABC):
|
|
47
|
+
provider: GraphProvider
|
|
48
|
+
|
|
49
|
+
async def __aenter__(self):
|
|
50
|
+
return self
|
|
51
|
+
|
|
52
|
+
@abstractmethod
|
|
53
|
+
async def __aexit__(self, exc_type, exc, tb):
|
|
54
|
+
# No cleanup needed for Falkor, but method must exist
|
|
55
|
+
pass
|
|
56
|
+
|
|
57
|
+
@abstractmethod
|
|
58
|
+
async def run(self, query: str, **kwargs: Any) -> Any:
|
|
59
|
+
raise NotImplementedError()
|
|
60
|
+
|
|
61
|
+
@abstractmethod
|
|
62
|
+
async def close(self):
|
|
63
|
+
raise NotImplementedError()
|
|
64
|
+
|
|
65
|
+
@abstractmethod
|
|
66
|
+
async def execute_write(self, func, *args, **kwargs):
|
|
67
|
+
raise NotImplementedError()
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class GraphDriver(ABC):
|
|
71
|
+
provider: GraphProvider
|
|
72
|
+
fulltext_syntax: str = (
|
|
73
|
+
'' # Neo4j (default) syntax does not require a prefix for fulltext queries
|
|
74
|
+
)
|
|
75
|
+
_database: str
|
|
76
|
+
aoss_client: Any # type: ignore
|
|
77
|
+
|
|
78
|
+
@abstractmethod
|
|
79
|
+
def execute_query(self, cypher_query_: str, **kwargs: Any) -> Coroutine:
|
|
80
|
+
raise NotImplementedError()
|
|
81
|
+
|
|
82
|
+
@abstractmethod
|
|
83
|
+
def session(self, database: str | None = None) -> GraphDriverSession:
|
|
84
|
+
raise NotImplementedError()
|
|
85
|
+
|
|
86
|
+
@abstractmethod
|
|
87
|
+
def close(self):
|
|
88
|
+
raise NotImplementedError()
|
|
89
|
+
|
|
90
|
+
@abstractmethod
|
|
91
|
+
def delete_all_indexes(self) -> Coroutine:
|
|
92
|
+
raise NotImplementedError()
|
|
93
|
+
|
|
94
|
+
def with_database(self, database: str) -> 'GraphDriver':
|
|
95
|
+
"""
|
|
96
|
+
Returns a shallow copy of this driver with a different default database.
|
|
97
|
+
Reuses the same connection (e.g. FalkorDB, Neo4j).
|
|
98
|
+
"""
|
|
99
|
+
cloned = copy.copy(self)
|
|
100
|
+
cloned._database = database
|
|
101
|
+
|
|
102
|
+
return cloned
|
|
103
|
+
|
|
104
|
+
def build_fulltext_query(
|
|
105
|
+
self, query: str, group_ids: list[str] | None = None, max_query_length: int = 128
|
|
106
|
+
) -> str:
|
|
107
|
+
"""
|
|
108
|
+
Specific fulltext query builder for database providers.
|
|
109
|
+
Only implemented by providers that need custom fulltext query building.
|
|
110
|
+
"""
|
|
111
|
+
raise NotImplementedError(f'build_fulltext_query not implemented for {self.provider}')
|
|
112
|
+
|
|
113
|
+
async def save_to_aoss(self, name: str, data: list[dict]) -> int:
|
|
114
|
+
return 0
|
|
115
|
+
|
|
116
|
+
async def clear_aoss_indices(self):
|
|
117
|
+
return 1
|
|
@@ -22,28 +22,9 @@ from neo4j import AsyncGraphDatabase, EagerResult
|
|
|
22
22
|
from typing_extensions import LiteralString
|
|
23
23
|
|
|
24
24
|
from graphiti_core.driver.driver import GraphDriver, GraphDriverSession, GraphProvider
|
|
25
|
-
from graphiti_core.helpers import semaphore_gather
|
|
26
25
|
|
|
27
26
|
logger = logging.getLogger(__name__)
|
|
28
27
|
|
|
29
|
-
try:
|
|
30
|
-
import boto3
|
|
31
|
-
from opensearchpy import (
|
|
32
|
-
AIOHttpConnection,
|
|
33
|
-
AsyncOpenSearch,
|
|
34
|
-
AWSV4SignerAuth,
|
|
35
|
-
Urllib3AWSV4SignerAuth,
|
|
36
|
-
Urllib3HttpConnection,
|
|
37
|
-
)
|
|
38
|
-
|
|
39
|
-
_HAS_OPENSEARCH = True
|
|
40
|
-
except ImportError:
|
|
41
|
-
boto3 = None
|
|
42
|
-
OpenSearch = None
|
|
43
|
-
Urllib3AWSV4SignerAuth = None
|
|
44
|
-
Urllib3HttpConnection = None
|
|
45
|
-
_HAS_OPENSEARCH = False
|
|
46
|
-
|
|
47
28
|
|
|
48
29
|
class Neo4jDriver(GraphDriver):
|
|
49
30
|
provider = GraphProvider.NEO4J
|
|
@@ -54,11 +35,6 @@ class Neo4jDriver(GraphDriver):
|
|
|
54
35
|
user: str | None,
|
|
55
36
|
password: str | None,
|
|
56
37
|
database: str = 'neo4j',
|
|
57
|
-
aoss_host: str | None = None,
|
|
58
|
-
aoss_port: int | None = None,
|
|
59
|
-
aws_profile_name: str | None = None,
|
|
60
|
-
aws_region: str | None = None,
|
|
61
|
-
aws_service: str | None = None,
|
|
62
38
|
):
|
|
63
39
|
super().__init__()
|
|
64
40
|
self.client = AsyncGraphDatabase.driver(
|
|
@@ -68,24 +44,6 @@ class Neo4jDriver(GraphDriver):
|
|
|
68
44
|
self._database = database
|
|
69
45
|
|
|
70
46
|
self.aoss_client = None
|
|
71
|
-
if aoss_host and aoss_port and boto3 is not None:
|
|
72
|
-
try:
|
|
73
|
-
region = aws_region
|
|
74
|
-
service = aws_service
|
|
75
|
-
credentials = boto3.Session(profile_name=aws_profile_name).get_credentials()
|
|
76
|
-
auth = AWSV4SignerAuth(credentials, region or '', service or '')
|
|
77
|
-
|
|
78
|
-
self.aoss_client = AsyncOpenSearch(
|
|
79
|
-
hosts=[{'host': aoss_host, 'port': aoss_port}],
|
|
80
|
-
auth=auth,
|
|
81
|
-
use_ssl=True,
|
|
82
|
-
verify_certs=True,
|
|
83
|
-
connection_class=AIOHttpConnection,
|
|
84
|
-
pool_maxsize=20,
|
|
85
|
-
) # type: ignore
|
|
86
|
-
except Exception as e:
|
|
87
|
-
logger.warning(f'Failed to initialize OpenSearch client: {e}')
|
|
88
|
-
self.aoss_client = None
|
|
89
47
|
|
|
90
48
|
async def execute_query(self, cypher_query_: LiteralString, **kwargs: Any) -> EagerResult:
|
|
91
49
|
# Check if database_ is provided in kwargs.
|
|
@@ -111,13 +69,6 @@ class Neo4jDriver(GraphDriver):
|
|
|
111
69
|
return await self.client.close()
|
|
112
70
|
|
|
113
71
|
def delete_all_indexes(self) -> Coroutine:
|
|
114
|
-
if self.aoss_client:
|
|
115
|
-
return semaphore_gather(
|
|
116
|
-
self.client.execute_query(
|
|
117
|
-
'CALL db.indexes() YIELD name DROP INDEX name',
|
|
118
|
-
),
|
|
119
|
-
self.delete_aoss_indices(),
|
|
120
|
-
)
|
|
121
72
|
return self.client.execute_query(
|
|
122
73
|
'CALL db.indexes() YIELD name DROP INDEX name',
|
|
123
74
|
)
|
|
@@ -22,21 +22,16 @@ from typing import Any
|
|
|
22
22
|
|
|
23
23
|
import boto3
|
|
24
24
|
from langchain_aws.graphs import NeptuneAnalyticsGraph, NeptuneGraph
|
|
25
|
-
from opensearchpy import OpenSearch, Urllib3AWSV4SignerAuth, Urllib3HttpConnection
|
|
25
|
+
from opensearchpy import OpenSearch, Urllib3AWSV4SignerAuth, Urllib3HttpConnection, helpers
|
|
26
26
|
|
|
27
|
-
from graphiti_core.driver.driver import
|
|
28
|
-
DEFAULT_SIZE,
|
|
29
|
-
GraphDriver,
|
|
30
|
-
GraphDriverSession,
|
|
31
|
-
GraphProvider,
|
|
32
|
-
)
|
|
27
|
+
from graphiti_core.driver.driver import GraphDriver, GraphDriverSession, GraphProvider
|
|
33
28
|
|
|
34
29
|
logger = logging.getLogger(__name__)
|
|
30
|
+
DEFAULT_SIZE = 10
|
|
35
31
|
|
|
36
|
-
|
|
32
|
+
aoss_indices = [
|
|
37
33
|
{
|
|
38
34
|
'index_name': 'node_name_and_summary',
|
|
39
|
-
'alias_name': 'entities',
|
|
40
35
|
'body': {
|
|
41
36
|
'mappings': {
|
|
42
37
|
'properties': {
|
|
@@ -54,7 +49,6 @@ neptune_aoss_indices = [
|
|
|
54
49
|
},
|
|
55
50
|
{
|
|
56
51
|
'index_name': 'community_name',
|
|
57
|
-
'alias_name': 'communities',
|
|
58
52
|
'body': {
|
|
59
53
|
'mappings': {
|
|
60
54
|
'properties': {
|
|
@@ -71,7 +65,6 @@ neptune_aoss_indices = [
|
|
|
71
65
|
},
|
|
72
66
|
{
|
|
73
67
|
'index_name': 'episode_content',
|
|
74
|
-
'alias_name': 'episodes',
|
|
75
68
|
'body': {
|
|
76
69
|
'mappings': {
|
|
77
70
|
'properties': {
|
|
@@ -95,7 +88,6 @@ neptune_aoss_indices = [
|
|
|
95
88
|
},
|
|
96
89
|
{
|
|
97
90
|
'index_name': 'edge_name_and_fact',
|
|
98
|
-
'alias_name': 'facts',
|
|
99
91
|
'body': {
|
|
100
92
|
'mappings': {
|
|
101
93
|
'properties': {
|
|
@@ -228,27 +220,52 @@ class NeptuneDriver(GraphDriver):
|
|
|
228
220
|
async def _delete_all_data(self) -> Any:
|
|
229
221
|
return await self.execute_query('MATCH (n) DETACH DELETE n')
|
|
230
222
|
|
|
223
|
+
def delete_all_indexes(self) -> Coroutine[Any, Any, Any]:
|
|
224
|
+
return self.delete_all_indexes_impl()
|
|
225
|
+
|
|
226
|
+
async def delete_all_indexes_impl(self) -> Coroutine[Any, Any, Any]:
|
|
227
|
+
# No matter what happens above, always return True
|
|
228
|
+
return self.delete_aoss_indices()
|
|
229
|
+
|
|
231
230
|
async def create_aoss_indices(self):
|
|
232
|
-
for index in
|
|
231
|
+
for index in aoss_indices:
|
|
233
232
|
index_name = index['index_name']
|
|
234
233
|
client = self.aoss_client
|
|
235
|
-
if not client:
|
|
236
|
-
raise ValueError(
|
|
237
|
-
'You must provide an AOSS endpoint to create an OpenSearch driver.'
|
|
238
|
-
)
|
|
239
234
|
if not client.indices.exists(index=index_name):
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
alias_name = index.get('alias_name', index_name)
|
|
243
|
-
|
|
244
|
-
if not client.indices.exists_alias(name=alias_name, index=index_name):
|
|
245
|
-
await client.indices.put_alias(index=index_name, name=alias_name)
|
|
246
|
-
|
|
235
|
+
client.indices.create(index=index_name, body=index['body'])
|
|
247
236
|
# Sleep for 1 minute to let the index creation complete
|
|
248
237
|
await asyncio.sleep(60)
|
|
249
238
|
|
|
250
|
-
def
|
|
251
|
-
|
|
239
|
+
async def delete_aoss_indices(self):
|
|
240
|
+
for index in aoss_indices:
|
|
241
|
+
index_name = index['index_name']
|
|
242
|
+
client = self.aoss_client
|
|
243
|
+
if client.indices.exists(index=index_name):
|
|
244
|
+
client.indices.delete(index=index_name)
|
|
245
|
+
|
|
246
|
+
def run_aoss_query(self, name: str, query_text: str, limit: int = 10) -> dict[str, Any]:
|
|
247
|
+
for index in aoss_indices:
|
|
248
|
+
if name.lower() == index['index_name']:
|
|
249
|
+
index['query']['query']['multi_match']['query'] = query_text
|
|
250
|
+
query = {'size': limit, 'query': index['query']}
|
|
251
|
+
resp = self.aoss_client.search(body=query['query'], index=index['index_name'])
|
|
252
|
+
return resp
|
|
253
|
+
return {}
|
|
254
|
+
|
|
255
|
+
def save_to_aoss(self, name: str, data: list[dict]) -> int:
|
|
256
|
+
for index in aoss_indices:
|
|
257
|
+
if name.lower() == index['index_name']:
|
|
258
|
+
to_index = []
|
|
259
|
+
for d in data:
|
|
260
|
+
item = {'_index': name, '_id': d['uuid']}
|
|
261
|
+
for p in index['body']['mappings']['properties']:
|
|
262
|
+
if p in d:
|
|
263
|
+
item[p] = d[p]
|
|
264
|
+
to_index.append(item)
|
|
265
|
+
success, failed = helpers.bulk(self.aoss_client, to_index, stats_only=True)
|
|
266
|
+
return success
|
|
267
|
+
|
|
268
|
+
return 0
|
|
252
269
|
|
|
253
270
|
|
|
254
271
|
class NeptuneDriverSession(GraphDriverSession):
|
|
@@ -33,12 +33,16 @@ DEFAULT_TEMPERATURE = 0
|
|
|
33
33
|
DEFAULT_CACHE_DIR = './llm_cache'
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
def get_extraction_language_instruction() -> str:
|
|
36
|
+
def get_extraction_language_instruction(group_id: str | None = None) -> str:
|
|
37
37
|
"""Returns instruction for language extraction behavior.
|
|
38
38
|
|
|
39
39
|
Override this function to customize language extraction:
|
|
40
40
|
- Return empty string to disable multilingual instructions
|
|
41
41
|
- Return custom instructions for specific language requirements
|
|
42
|
+
- Use group_id to provide different instructions per group/partition
|
|
43
|
+
|
|
44
|
+
Args:
|
|
45
|
+
group_id: Optional partition identifier for the graph
|
|
42
46
|
|
|
43
47
|
Returns:
|
|
44
48
|
str: Language instruction to append to system messages
|
|
@@ -142,6 +146,7 @@ class LLMClient(ABC):
|
|
|
142
146
|
response_model: type[BaseModel] | None = None,
|
|
143
147
|
max_tokens: int | None = None,
|
|
144
148
|
model_size: ModelSize = ModelSize.medium,
|
|
149
|
+
group_id: str | None = None,
|
|
145
150
|
) -> dict[str, typing.Any]:
|
|
146
151
|
if max_tokens is None:
|
|
147
152
|
max_tokens = self.max_tokens
|
|
@@ -155,7 +160,7 @@ class LLMClient(ABC):
|
|
|
155
160
|
)
|
|
156
161
|
|
|
157
162
|
# Add multilingual extraction instructions
|
|
158
|
-
messages[0].content += get_extraction_language_instruction()
|
|
163
|
+
messages[0].content += get_extraction_language_instruction(group_id)
|
|
159
164
|
|
|
160
165
|
if self.cache_enabled and self.cache_dir is not None:
|
|
161
166
|
cache_key = self._get_cache_key(messages)
|
{graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/gemini_client.py
RENAMED
|
@@ -357,6 +357,7 @@ class GeminiClient(LLMClient):
|
|
|
357
357
|
response_model: type[BaseModel] | None = None,
|
|
358
358
|
max_tokens: int | None = None,
|
|
359
359
|
model_size: ModelSize = ModelSize.medium,
|
|
360
|
+
group_id: str | None = None,
|
|
360
361
|
) -> dict[str, typing.Any]:
|
|
361
362
|
"""
|
|
362
363
|
Generate a response from the Gemini language model with retry logic and error handling.
|
|
@@ -367,6 +368,7 @@ class GeminiClient(LLMClient):
|
|
|
367
368
|
response_model (type[BaseModel] | None): An optional Pydantic model to parse the response into.
|
|
368
369
|
max_tokens (int | None): The maximum number of tokens to generate in the response.
|
|
369
370
|
model_size (ModelSize): The size of the model to use (small or medium).
|
|
371
|
+
group_id (str | None): Optional partition identifier for the graph.
|
|
370
372
|
|
|
371
373
|
Returns:
|
|
372
374
|
dict[str, typing.Any]: The response from the language model.
|
|
@@ -376,7 +378,7 @@ class GeminiClient(LLMClient):
|
|
|
376
378
|
last_output = None
|
|
377
379
|
|
|
378
380
|
# Add multilingual extraction instructions
|
|
379
|
-
messages[0].content += get_extraction_language_instruction()
|
|
381
|
+
messages[0].content += get_extraction_language_instruction(group_id)
|
|
380
382
|
|
|
381
383
|
while retry_count < self.MAX_RETRIES:
|
|
382
384
|
try:
|
{graphiti_core-0.21.0rc13 → graphiti_core-0.22.0rc1}/graphiti_core/llm_client/openai_base_client.py
RENAMED
|
@@ -175,6 +175,7 @@ class BaseOpenAIClient(LLMClient):
|
|
|
175
175
|
response_model: type[BaseModel] | None = None,
|
|
176
176
|
max_tokens: int | None = None,
|
|
177
177
|
model_size: ModelSize = ModelSize.medium,
|
|
178
|
+
group_id: str | None = None,
|
|
178
179
|
) -> dict[str, typing.Any]:
|
|
179
180
|
"""Generate a response with retry logic and error handling."""
|
|
180
181
|
if max_tokens is None:
|
|
@@ -184,7 +185,7 @@ class BaseOpenAIClient(LLMClient):
|
|
|
184
185
|
last_error = None
|
|
185
186
|
|
|
186
187
|
# Add multilingual extraction instructions
|
|
187
|
-
messages[0].content += get_extraction_language_instruction()
|
|
188
|
+
messages[0].content += get_extraction_language_instruction(group_id)
|
|
188
189
|
|
|
189
190
|
while retry_count <= self.MAX_RETRIES:
|
|
190
191
|
try:
|
|
@@ -120,6 +120,7 @@ class OpenAIGenericClient(LLMClient):
|
|
|
120
120
|
response_model: type[BaseModel] | None = None,
|
|
121
121
|
max_tokens: int | None = None,
|
|
122
122
|
model_size: ModelSize = ModelSize.medium,
|
|
123
|
+
group_id: str | None = None,
|
|
123
124
|
) -> dict[str, typing.Any]:
|
|
124
125
|
if max_tokens is None:
|
|
125
126
|
max_tokens = self.max_tokens
|
|
@@ -136,7 +137,7 @@ class OpenAIGenericClient(LLMClient):
|
|
|
136
137
|
)
|
|
137
138
|
|
|
138
139
|
# Add multilingual extraction instructions
|
|
139
|
-
messages[0].content += get_extraction_language_instruction()
|
|
140
|
+
messages[0].content += get_extraction_language_instruction(group_id)
|
|
140
141
|
|
|
141
142
|
while retry_count <= self.MAX_RETRIES:
|
|
142
143
|
try:
|
|
@@ -23,39 +23,44 @@ from .prompt_helpers import to_prompt_json
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class ExtractedEntity(BaseModel):
|
|
26
|
-
name: str = Field(..., description=
|
|
26
|
+
name: str = Field(..., description="Name of the extracted entity")
|
|
27
27
|
entity_type_id: int = Field(
|
|
28
|
-
description=
|
|
29
|
-
|
|
28
|
+
description="ID of the classified entity type. "
|
|
29
|
+
"Must be one of the provided entity_type_id integers.",
|
|
30
30
|
)
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
class ExtractedEntities(BaseModel):
|
|
34
|
-
extracted_entities: list[ExtractedEntity] = Field(
|
|
34
|
+
extracted_entities: list[ExtractedEntity] = Field(
|
|
35
|
+
..., description="List of extracted entities"
|
|
36
|
+
)
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
class MissedEntities(BaseModel):
|
|
38
|
-
missed_entities: list[str] = Field(
|
|
40
|
+
missed_entities: list[str] = Field(
|
|
41
|
+
..., description="Names of entities that weren't extracted"
|
|
42
|
+
)
|
|
39
43
|
|
|
40
44
|
|
|
41
45
|
class EntityClassificationTriple(BaseModel):
|
|
42
|
-
uuid: str = Field(description=
|
|
43
|
-
name: str = Field(description=
|
|
46
|
+
uuid: str = Field(description="UUID of the entity")
|
|
47
|
+
name: str = Field(description="Name of the entity")
|
|
44
48
|
entity_type: str | None = Field(
|
|
45
|
-
default=None,
|
|
49
|
+
default=None,
|
|
50
|
+
description="Type of the entity. Must be one of the provided types or None",
|
|
46
51
|
)
|
|
47
52
|
|
|
48
53
|
|
|
49
54
|
class EntityClassification(BaseModel):
|
|
50
55
|
entity_classifications: list[EntityClassificationTriple] = Field(
|
|
51
|
-
..., description=
|
|
56
|
+
..., description="List of entities classification triples."
|
|
52
57
|
)
|
|
53
58
|
|
|
54
59
|
|
|
55
60
|
class EntitySummary(BaseModel):
|
|
56
61
|
summary: str = Field(
|
|
57
62
|
...,
|
|
58
|
-
description=
|
|
63
|
+
description="Summary containing the important information about the entity. Under 8 sentences.",
|
|
59
64
|
)
|
|
60
65
|
|
|
61
66
|
|
|
@@ -123,8 +128,8 @@ reference entities. Only extract distinct entities from the CURRENT MESSAGE. Don
|
|
|
123
128
|
{context['custom_prompt']}
|
|
124
129
|
"""
|
|
125
130
|
return [
|
|
126
|
-
Message(role=
|
|
127
|
-
Message(role=
|
|
131
|
+
Message(role="system", content=sys_prompt),
|
|
132
|
+
Message(role="user", content=user_prompt),
|
|
128
133
|
]
|
|
129
134
|
|
|
130
135
|
|
|
@@ -156,8 +161,8 @@ Guidelines:
|
|
|
156
161
|
3. Do NOT extract any properties that contain dates
|
|
157
162
|
"""
|
|
158
163
|
return [
|
|
159
|
-
Message(role=
|
|
160
|
-
Message(role=
|
|
164
|
+
Message(role="system", content=sys_prompt),
|
|
165
|
+
Message(role="user", content=user_prompt),
|
|
161
166
|
]
|
|
162
167
|
|
|
163
168
|
|
|
@@ -187,8 +192,8 @@ Guidelines:
|
|
|
187
192
|
4. Be as explicit as possible in your node names, using full names and avoiding abbreviations.
|
|
188
193
|
"""
|
|
189
194
|
return [
|
|
190
|
-
Message(role=
|
|
191
|
-
Message(role=
|
|
195
|
+
Message(role="system", content=sys_prompt),
|
|
196
|
+
Message(role="user", content=user_prompt),
|
|
192
197
|
]
|
|
193
198
|
|
|
194
199
|
|
|
@@ -211,8 +216,8 @@ Given the above previous messages, current message, and list of extracted entiti
|
|
|
211
216
|
extracted.
|
|
212
217
|
"""
|
|
213
218
|
return [
|
|
214
|
-
Message(role=
|
|
215
|
-
Message(role=
|
|
219
|
+
Message(role="system", content=sys_prompt),
|
|
220
|
+
Message(role="user", content=user_prompt),
|
|
216
221
|
]
|
|
217
222
|
|
|
218
223
|
|
|
@@ -243,19 +248,19 @@ def classify_nodes(context: dict[str, Any]) -> list[Message]:
|
|
|
243
248
|
3. If none of the provided entity types accurately classify an extracted node, the type should be set to None
|
|
244
249
|
"""
|
|
245
250
|
return [
|
|
246
|
-
Message(role=
|
|
247
|
-
Message(role=
|
|
251
|
+
Message(role="system", content=sys_prompt),
|
|
252
|
+
Message(role="user", content=user_prompt),
|
|
248
253
|
]
|
|
249
254
|
|
|
250
255
|
|
|
251
256
|
def extract_attributes(context: dict[str, Any]) -> list[Message]:
|
|
252
257
|
return [
|
|
253
258
|
Message(
|
|
254
|
-
role=
|
|
255
|
-
content=
|
|
259
|
+
role="system",
|
|
260
|
+
content="You are a helpful assistant that extracts entity properties from the provided text.",
|
|
256
261
|
),
|
|
257
262
|
Message(
|
|
258
|
-
role=
|
|
263
|
+
role="user",
|
|
259
264
|
content=f"""
|
|
260
265
|
|
|
261
266
|
<MESSAGES>
|
|
@@ -281,11 +286,11 @@ def extract_attributes(context: dict[str, Any]) -> list[Message]:
|
|
|
281
286
|
def extract_summary(context: dict[str, Any]) -> list[Message]:
|
|
282
287
|
return [
|
|
283
288
|
Message(
|
|
284
|
-
role=
|
|
285
|
-
content=
|
|
289
|
+
role="system",
|
|
290
|
+
content="You are a helpful assistant that extracts entity summaries from the provided text.",
|
|
286
291
|
),
|
|
287
292
|
Message(
|
|
288
|
-
role=
|
|
293
|
+
role="user",
|
|
289
294
|
content=f"""
|
|
290
295
|
|
|
291
296
|
<MESSAGES>
|
|
@@ -300,7 +305,7 @@ def extract_summary(context: dict[str, Any]) -> list[Message]:
|
|
|
300
305
|
1. Do not hallucinate entity summary information if they cannot be found in the current context.
|
|
301
306
|
2. Only use the provided MESSAGES and ENTITY to set attribute values.
|
|
302
307
|
3. The summary attribute represents a summary of the ENTITY, and should be updated with new information about the Entity from the MESSAGES.
|
|
303
|
-
|
|
308
|
+
4. Keep the summary concise and to the point. SUMMARIES MUST BE LESS THAN 8 SENTENCES.
|
|
304
309
|
|
|
305
310
|
<ENTITY>
|
|
306
311
|
{context['node']}
|
|
@@ -311,11 +316,11 @@ def extract_summary(context: dict[str, Any]) -> list[Message]:
|
|
|
311
316
|
|
|
312
317
|
|
|
313
318
|
versions: Versions = {
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
"extract_message": extract_message,
|
|
320
|
+
"extract_json": extract_json,
|
|
321
|
+
"extract_text": extract_text,
|
|
322
|
+
"reflexion": reflexion,
|
|
323
|
+
"extract_summary": extract_summary,
|
|
324
|
+
"classify_nodes": classify_nodes,
|
|
325
|
+
"extract_attributes": extract_attributes,
|
|
321
326
|
}
|