Skip to content

Commit 80367be

Browse files
authored
Remove config input models (#1570)
* Remove config input models * remove unit tests related to config input models * add semversioner change * Merge branch 'main' into config-remove-input-models
1 parent 185f513 commit 80367be

25 files changed

+10
-836
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"type": "patch",
3+
"description": "Remove config input models."
4+
}

graphrag/config/create_graphrag_config.py

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,10 @@
66
import os
77
from enum import Enum
88
from pathlib import Path
9-
from typing import cast
9+
from typing import Any, cast
1010

1111
from datashaper import AsyncType
1212
from environs import Env
13-
from pydantic import TypeAdapter
1413

1514
import graphrag.config.defaults as defs
1615
from graphrag.config.enums import (
@@ -28,8 +27,6 @@
2827
AzureApiBaseMissingError,
2928
AzureDeploymentNameMissingError,
3029
)
31-
from graphrag.config.input_models.graphrag_config_input import GraphRagConfigInput
32-
from graphrag.config.input_models.llm_config_input import LLMConfigInput
3330
from graphrag.config.models.basic_search_config import BasicSearchConfig
3431
from graphrag.config.models.cache_config import CacheConfig
3532
from graphrag.config.models.chunking_config import ChunkingConfig, ChunkStrategyType
@@ -55,27 +52,24 @@
5552
from graphrag.config.models.umap_config import UmapConfig
5653
from graphrag.config.read_dotenv import read_dotenv
5754

58-
InputModelValidator = TypeAdapter(GraphRagConfigInput)
59-
6055

6156
def create_graphrag_config(
62-
values: GraphRagConfigInput | None = None, root_dir: str | None = None
57+
values: dict[str, Any] | None = None, root_dir: str | None = None
6358
) -> GraphRagConfig:
6459
"""Load Configuration Parameters from a dictionary."""
6560
values = values or {}
6661
root_dir = root_dir or str(Path.cwd())
6762
env = _make_env(root_dir)
6863
_token_replace(cast("dict", values))
69-
InputModelValidator.validate_python(values, strict=True)
7064

7165
reader = EnvironmentReader(env)
7266

73-
def hydrate_async_type(input: LLMConfigInput, base: AsyncType) -> AsyncType:
67+
def hydrate_async_type(input: dict[str, Any], base: AsyncType) -> AsyncType:
7468
value = input.get(Fragment.async_mode)
7569
return AsyncType(value) if value else base
7670

7771
def hydrate_llm_params(
78-
config: LLMConfigInput, base: LLMParameters
72+
config: dict[str, Any], base: LLMParameters
7973
) -> LLMParameters:
8074
with reader.use(config.get("llm")):
8175
llm_type = reader.str(Fragment.type)
@@ -132,7 +126,7 @@ def hydrate_llm_params(
132126
)
133127

134128
def hydrate_embeddings_params(
135-
config: LLMConfigInput, base: LLMParameters
129+
config: dict[str, Any], base: LLMParameters
136130
) -> LLMParameters:
137131
with reader.use(config.get("llm")):
138132
api_type = reader.str(Fragment.type) or defs.EMBEDDING_TYPE
@@ -198,7 +192,7 @@ def hydrate_embeddings_params(
198192
)
199193

200194
def hydrate_parallelization_params(
201-
config: LLMConfigInput, base: ParallelizationParameters
195+
config: dict[str, Any], base: ParallelizationParameters
202196
) -> ParallelizationParameters:
203197
with reader.use(config.get("parallelization")):
204198
return ParallelizationParameters(

graphrag/config/input_models/__init__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

graphrag/config/input_models/basic_search_config_input.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

graphrag/config/input_models/cache_config_input.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

graphrag/config/input_models/chunking_config_input.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

graphrag/config/input_models/claim_extraction_config_input.py

Lines changed: 0 additions & 19 deletions
This file was deleted.

graphrag/config/input_models/cluster_graph_config_input.py

Lines changed: 0 additions & 13 deletions
This file was deleted.

graphrag/config/input_models/community_reports_config_input.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

graphrag/config/input_models/embed_graph_config_input.py

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)