From 32f7e68c4bbfa070840c6bdba9b045f2946c53fc Mon Sep 17 00:00:00 2001 From: venti <1308199824@qq.com> Date: Sat, 30 May 2026 16:48:52 +0800 Subject: [PATCH] fix: add backward-compat ModelType re-export for v2.x API compatibility (fixes #2356) --- packages/graphrag/graphrag/config/enums.py | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/graphrag/graphrag/config/enums.py b/packages/graphrag/graphrag/config/enums.py index 5084f2154b..cd3b22c866 100644 --- a/packages/graphrag/graphrag/config/enums.py +++ b/packages/graphrag/graphrag/config/enums.py @@ -7,6 +7,30 @@ from enum import Enum +import warnings + + +class ModelType(str, Enum): + """Backward-compatible alias for model configuration type. + + .. deprecated:: + Use ``LLMProviderType`` from ``graphrag_llm.config.types`` instead. + This alias is kept for backward compatibility with v2.x APIs. + """ + + LLM = "llm" + Embedding = "embedding" + + @classmethod + def _missing_(cls, value: object) -> "ModelType | None": + warnings.warn( + f"Unknown ModelType value '{value}'. " + "Consider using graphrag_llm.config.types.LLMProviderType instead.", + DeprecationWarning, + stacklevel=2, + ) + return None + class ReportingType(str, Enum): """The reporting configuration type for the pipeline."""