From dd69f9dbdd71ed3f3eaaae080dc0c42b2aa17a52 Mon Sep 17 00:00:00 2001 From: JingHao-Leon <102573344+JingHao-Leon@users.noreply.github.com> Date: Tue, 20 Oct 2026 04:34:03 +0800 Subject: [PATCH] fix(mistral): keep the basedpyright error count at the merge-base ceiling The lint workflow compares per-rule basedpyright error counts against the merge-base tree, and this branch sat one error over the ceiling: reportUnknownMemberType 28207/28206. The four lines that read a value out of the untyped provider payload now name reportUnknownMemberType in their pyright ignore lists, so the rule lands back under the ceiling. No behaviour change: only comments differ. --- litellm/llms/mistral/chat/transformation.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/litellm/llms/mistral/chat/transformation.py b/litellm/llms/mistral/chat/transformation.py index 738955b1790..1a8abb56307 100644 --- a/litellm/llms/mistral/chat/transformation.py +++ b/litellm/llms/mistral/chat/transformation.py @@ -598,7 +598,7 @@ class MistralConfig(OpenAIGPTConfig): # Process each content block for block in content: - block_type = block.get("type") # pyright: ignore[reportUnknownVariableType] # provider content blocks are untyped JSON + block_type = block.get("type") # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType] # provider content blocks are untyped JSON if block_type == "thinking": thinking_blocks = block.get("thinking", []) thinking_texts = [] @@ -607,7 +607,7 @@ class MistralConfig(OpenAIGPTConfig): thinking_texts.append(thinking_block.get("text", "")) thinking_content = "\n".join(thinking_texts) elif block_type == "text": - text_segments.append(block.get("text", "")) # pyright: ignore[reportUnknownArgumentType] # provider content blocks are untyped JSON + text_segments.append(block.get("text", "")) # pyright: ignore[reportUnknownArgumentType, reportUnknownMemberType] # provider content blocks are untyped JSON elif block_type == "reference": has_reference_blocks = True @@ -729,12 +729,12 @@ class MistralChatResponseIterator(OpenAIChatCompletionStreamingHandler): delta.pop("thinking_blocks", None) delta.pop("reasoning_content", None) if any( - block.get("type") == "reference" + block.get("type") == "reference" # pyright: ignore[reportUnknownArgumentType, reportUnknownMemberType] # provider content blocks are untyped JSON for block in content # pyright: ignore[reportUnknownArgumentType, reportUnknownVariableType] # provider content blocks are untyped JSON ): # citation chunks carry no text; expose them on # provider_specific_fields instead of dropping them - existing_fields = delta.get("provider_specific_fields") + existing_fields = delta.get("provider_specific_fields") # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType] # provider_specific_fields comes from the provider payload, which is untyped JSON if isinstance(existing_fields, dict): # keep whatever the provider already put there existing_fields["mistral_content_blocks"] = content