From 1e7d04a06536d9a713b1de0a00a555b1bf120ee3 Mon Sep 17 00:00:00 2001 From: jibanez-staticduo Date: Wed, 30 Sep 2026 14:08:51 +0200 Subject: [PATCH] refactor(router): declare the reasoning transport options on the param models that use them Declaring `forward_reasoning_content` and `reasoning_content_field` on `GenericLiteLLMParams` reached every caller that builds those params from an unannotated `**kwargs`, because basedpyright reports one unknown-argument diagnostic per declared parameter at every such spread site: 113 sites, so the two fields added 226 diagnostics and pushed `reportUnknownArgumentType` past its ceiling without any of those files changing. `LiteLLM_Params` (deployment and creation) and `updateLiteLLMParams` (model update) are the models that carry the options, and neither is built by spreading unknown kwargs, so declaring them there keeps the API, the generated dashboard types and the partial-update behaviour identical while the shared signature stays as it was. --- litellm/types/router.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/litellm/types/router.py b/litellm/types/router.py index fc19efa4b58..7fa49352a9c 100644 --- a/litellm/types/router.py +++ b/litellm/types/router.py @@ -425,11 +425,6 @@ class GenericLiteLLMParams(CredentialLiteLLMParams, CustomPricingLiteLLMParams): ) model_config = ConfigDict(extra="allow", arbitrary_types_allowed=True) merge_reasoning_content_in_choices: bool | None = False - forward_reasoning_content: bool | None = None - reasoning_content_field: str | None = Field( - default=None, - description="Historical assistant reasoning field: reasoning_content (default) or reasoning.", - ) model_info: dict | None = None mock_response: str | ModelResponse | Exception | object | None = None @@ -531,6 +526,11 @@ class LiteLLM_Params(GenericLiteLLMParams): model: str model_config = ConfigDict(extra="allow", arbitrary_types_allowed=True) + forward_reasoning_content: bool | None = None + reasoning_content_field: str | None = Field( + default=None, + description="Historical assistant reasoning field: reasoning_content (default) or reasoning.", + ) def __contains__(self, key) -> bool: # Define custom behavior for the 'in' operator @@ -553,6 +553,11 @@ class updateLiteLLMParams(GenericLiteLLMParams): # This class is used to update the LiteLLM_Params # only differece is model is optional model: str | None = None + forward_reasoning_content: bool | None = None + reasoning_content_field: str | None = Field( + default=None, + description="Historical assistant reasoning field: reasoning_content (default) or reasoning.", + ) class updateDeployment(BaseModel):