diff --git a/.semversioner/next-release/patch-2026053119245844167500.json b/.semversioner/next-release/patch-2026053119245844167500.json new file mode 100644 index 0000000000..a3849c8fc5 --- /dev/null +++ b/.semversioner/next-release/patch-2026053119245844167500.json @@ -0,0 +1,4 @@ +{ + "type": "patch", + "description": "Allow non-OpenAI service_tier values in LLMCompletionResponse so indexing does not fail with LiteLLM-routed providers (e.g. Gemini via OpenRouter)." +} \ No newline at end of file diff --git a/packages/graphrag-llm/graphrag_llm/types/types.py b/packages/graphrag-llm/graphrag_llm/types/types.py index 0980cba3aa..e2b8c2213d 100644 --- a/packages/graphrag-llm/graphrag_llm/types/types.py +++ b/packages/graphrag-llm/graphrag_llm/types/types.py @@ -91,6 +91,12 @@ class LLMCompletionResponse(ChatCompletion, Generic[ResponseFormat]): provided ResponseFormat model. """ + # Widen OpenAI's strict `service_tier` literal. Non-OpenAI providers routed + # through LiteLLM (e.g. Gemini via OpenRouter) return values outside OpenAI's + # enum, which would otherwise fail pydantic validation when constructing this + # model. graphrag-llm does not use this field. See issue #2389. + service_tier: str | None = None # type: ignore + formatted_response: ResponseFormat | None = None # type: ignore """Formatted response according to the specified response_format json schema."""