Refactor GraphRAG into standalone tool
This commit is contained in:
parent
f38ebf65f7
commit
043db73ee6
@ -26,6 +26,7 @@ RUN python -m pip install --no-cache-dir \
|
|||||||
|
|
||||||
COPY app ./app
|
COPY app ./app
|
||||||
COPY scripts ./scripts
|
COPY scripts ./scripts
|
||||||
|
COPY tools ./tools
|
||||||
|
|
||||||
RUN mkdir -p data
|
RUN mkdir -p data
|
||||||
|
|
||||||
|
|||||||
0
tools/__init__.py
Normal file
0
tools/__init__.py
Normal file
0
tools/graphrag/__init__.py
Normal file
0
tools/graphrag/__init__.py
Normal file
@ -5,11 +5,11 @@ import json
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from scripts.graph_db import (
|
from .graph_db import (
|
||||||
create_neo4j_driver,
|
create_neo4j_driver,
|
||||||
get_neo4j_settings,
|
get_neo4j_settings,
|
||||||
)
|
)
|
||||||
from scripts.graphrag import (
|
from .graphrag import (
|
||||||
GRAPH_SCOPE,
|
GRAPH_SCOPE,
|
||||||
build_graph_payload,
|
build_graph_payload,
|
||||||
)
|
)
|
||||||
@ -17,7 +17,7 @@ from scripts.graphrag import (
|
|||||||
|
|
||||||
PROJECT_ROOT = Path(
|
PROJECT_ROOT = Path(
|
||||||
__file__
|
__file__
|
||||||
).resolve().parents[1]
|
).resolve().parents[2]
|
||||||
|
|
||||||
DOCUMENTS_FILE = (
|
DOCUMENTS_FILE = (
|
||||||
PROJECT_ROOT
|
PROJECT_ROOT
|
||||||
@ -1283,7 +1283,7 @@ def search_graph(
|
|||||||
limit: int = DEFAULT_LIMIT,
|
limit: int = DEFAULT_LIMIT,
|
||||||
max_entities: int = DEFAULT_MAX_ENTITIES,
|
max_entities: int = DEFAULT_MAX_ENTITIES,
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
from scripts.graph_db import (
|
from .graph_db import (
|
||||||
create_neo4j_driver,
|
create_neo4j_driver,
|
||||||
get_neo4j_settings,
|
get_neo4j_settings,
|
||||||
)
|
)
|
||||||
@ -1,4 +1,4 @@
|
|||||||
from scripts.graph_db import verify_neo4j_connection
|
from .graph_db import verify_neo4j_connection
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
0
tools/graphrag/tests/__init__.py
Normal file
0
tools/graphrag/tests/__init__.py
Normal file
@ -4,7 +4,7 @@ from typing import Any
|
|||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import scripts.graph_search as graph_search
|
import tools.graphrag.graph_search as graph_search
|
||||||
|
|
||||||
|
|
||||||
class FakeSession:
|
class FakeSession:
|
||||||
@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from scripts.graphrag import (
|
from tools.graphrag.graphrag import (
|
||||||
build_graph_payload,
|
build_graph_payload,
|
||||||
extract_explicit_proposal_title,
|
extract_explicit_proposal_title,
|
||||||
extract_works,
|
extract_works,
|
||||||
Loading…
Reference in New Issue
Block a user