Skip to content

Commit 83f309f

Browse files
committed
found more relative imports
1 parent 5a311bb commit 83f309f

File tree

14 files changed

+43
-30
lines changed

14 files changed

+43
-30
lines changed

graphrag/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@
33

44
"""The GraphRAG package."""
55

6-
from .cli.main import app
6+
from graphrag.cli.main import app
77

88
app(prog_name="graphrag")

graphrag/callbacks/factories.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,16 @@
88

99
from datashaper import WorkflowCallbacks
1010

11+
from graphrag.callbacks.blob_workflow_callbacks import BlobWorkflowCallbacks
12+
from graphrag.callbacks.console_workflow_callbacks import ConsoleWorkflowCallbacks
13+
from graphrag.callbacks.file_workflow_callbacks import FileWorkflowCallbacks
1114
from graphrag.config.enums import ReportingType
1215
from graphrag.index.config.reporting import (
1316
PipelineBlobReportingConfig,
1417
PipelineFileReportingConfig,
1518
PipelineReportingConfig,
1619
)
1720

18-
from .blob_workflow_callbacks import BlobWorkflowCallbacks
19-
from .console_workflow_callbacks import ConsoleWorkflowCallbacks
20-
from .file_workflow_callbacks import FileWorkflowCallbacks
21-
2221

2322
def create_pipeline_reporter(
2423
config: PipelineReportingConfig | None, root_dir: str | None

graphrag/callbacks/global_search_callbacks.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@
33

44
"""GlobalSearch LLM Callbacks."""
55

6+
from graphrag.callbacks.llm_callbacks import BaseLLMCallback
67
from graphrag.query.structured_search.base import SearchResult
78

8-
from .llm_callbacks import BaseLLMCallback
9-
109

1110
class GlobalSearchLLMCallback(BaseLLMCallback):
1211
"""GlobalSearch LLM Callbacks."""

graphrag/cli/main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def _initialize_cli(
100100
],
101101
):
102102
"""Generate a default configuration file."""
103-
from .initialize import initialize_project_at
103+
from graphrag.cli.initialize import initialize_project_at
104104

105105
initialize_project_at(path=root)
106106

@@ -165,7 +165,7 @@ def _index_cli(
165165
] = None,
166166
):
167167
"""Build a knowledge graph index."""
168-
from .index import index_cli
168+
from graphrag.cli.index import index_cli
169169

170170
index_cli(
171171
root_dir=root,
@@ -234,7 +234,7 @@ def _update_cli(
234234
235235
Applies a default storage configuration (if not provided by config), saving the new index to the local file system in the `update_output` folder.
236236
"""
237-
from .index import update_cli
237+
from graphrag.cli.index import update_cli
238238

239239
update_cli(
240240
root_dir=root,
@@ -337,7 +337,7 @@ def _prompt_tune_cli(
337337
"""Generate custom graphrag prompts with your own data (i.e. auto templating)."""
338338
import asyncio
339339

340-
from .prompt_tune import prompt_tune
340+
from graphrag.cli.prompt_tune import prompt_tune
341341

342342
loop = asyncio.get_event_loop()
343343
loop.run_until_complete(
@@ -422,7 +422,7 @@ def _query_cli(
422422
] = False,
423423
):
424424
"""Query a knowledge graph index."""
425-
from .query import run_drift_search, run_global_search, run_local_search
425+
from graphrag.cli.query import run_drift_search, run_global_search, run_local_search
426426

427427
match method:
428428
case SearchType.LOCAL:

graphrag/config/defaults.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@
77

88
from datashaper import AsyncType
99

10-
from graphrag.vector_stores.factory import VectorStoreType
11-
12-
from .enums import (
10+
from graphrag.config.enums import (
1311
CacheType,
1412
InputFileType,
1513
InputType,
@@ -18,6 +16,7 @@
1816
StorageType,
1917
TextEmbeddingTarget,
2018
)
19+
from graphrag.vector_stores.factory import VectorStoreType
2120

2221
ASYNC_MODE = AsyncType.Threaded
2322
ENCODING_MODEL = "cl100k_base"

graphrag/index/operations/chunk_text/chunk_text.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,13 @@ def load_strategy(strategy: ChunkStrategyType) -> ChunkStrategy:
121121
"""Load strategy method definition."""
122122
match strategy:
123123
case ChunkStrategyType.tokens:
124-
from .strategies import run_tokens
124+
from graphrag.index.operations.chunk_text.strategies import run_tokens
125125

126126
return run_tokens
127127
case ChunkStrategyType.sentence:
128128
# NLTK
129129
from graphrag.index.bootstrap import bootstrap
130-
131-
from .strategies import run_sentences
130+
from graphrag.index.operations.chunk_text.strategies import run_sentences
132131

133132
bootstrap()
134133
return run_sentences

graphrag/index/operations/embed_graph/embed_graph.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@
1212

1313
from graphrag.index.graph.embedding import embed_nod2vec
1414
from graphrag.index.graph.utils import stable_largest_connected_component
15+
from graphrag.index.operations.embed_graph.typing import NodeEmbeddings
1516
from graphrag.index.utils.load_graph import load_graph
1617

17-
from .typing import NodeEmbeddings
18-
1918

2019
class EmbedGraphStrategyType(str, Enum):
2120
"""EmbedGraphStrategyType class definition."""

graphrag/index/operations/embed_text/embed_text.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,15 @@ def load_strategy(strategy: TextEmbedStrategyType) -> TextEmbeddingStrategy:
238238
"""Load strategy method definition."""
239239
match strategy:
240240
case TextEmbedStrategyType.openai:
241-
from .strategies.openai import run as run_openai
241+
from graphrag.index.operations.embed_text.strategies.openai import (
242+
run as run_openai,
243+
)
242244

243245
return run_openai
244246
case TextEmbedStrategyType.mock:
245-
from .strategies.mock import run as run_mock
247+
from graphrag.index.operations.embed_text.strategies.mock import (
248+
run as run_mock,
249+
)
246250

247251
return run_mock
248252
case _:

graphrag/index/operations/extract_covariates/extract_covariates.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ def load_strategy(strategy_type: ExtractClaimsStrategyType) -> CovariateExtractS
7575
"""Load strategy method definition."""
7676
match strategy_type:
7777
case ExtractClaimsStrategyType.graph_intelligence:
78-
from .strategies import run_graph_intelligence
78+
from graphrag.index.operations.extract_covariates.strategies import (
79+
run_graph_intelligence,
80+
)
7981

8082
return run_graph_intelligence
8183
case _:

graphrag/index/operations/extract_entities/extract_entities.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,18 @@ def _load_strategy(strategy_type: ExtractEntityStrategyType) -> EntityExtractStr
164164
"""Load strategy method definition."""
165165
match strategy_type:
166166
case ExtractEntityStrategyType.graph_intelligence:
167-
from .strategies.graph_intelligence import run_graph_intelligence
167+
from graphrag.index.operations.extract_entities.strategies.graph_intelligence import (
168+
run_graph_intelligence,
169+
)
168170

169171
return run_graph_intelligence
170172

171173
case ExtractEntityStrategyType.nltk:
172174
bootstrap()
173175
# dynamically import nltk strategy to avoid dependency if not used
174-
from .strategies.nltk import run as run_nltk
176+
from graphrag.index.operations.extract_entities.strategies.nltk import (
177+
run as run_nltk,
178+
)
175179

176180
return run_nltk
177181
case _:

0 commit comments

Comments
 (0)