From 6c36030e60c3181f2605b9ca69cce45817f83077 Mon Sep 17 00:00:00 2001 From: KnyazSh Date: Wed, 26 Aug 2026 20:33:27 +0000 Subject: [PATCH] fix(lint): Partly fix TID251 lint issues --- litellm/llms/gigachat/chat/streaming.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/litellm/llms/gigachat/chat/streaming.py b/litellm/llms/gigachat/chat/streaming.py index 3ed31c62d7d..e7ca0bec83d 100644 --- a/litellm/llms/gigachat/chat/streaming.py +++ b/litellm/llms/gigachat/chat/streaming.py @@ -5,7 +5,7 @@ GigaChat Streaming Response Handler import json import uuid from collections.abc import Mapping, Sequence -from typing import Any, Final, cast +from typing import Any, Final from litellm.llms.gigachat.utils import convert_usage from litellm.types.llms.openai import ( @@ -76,7 +76,10 @@ class GigaChatModelResponseIterator: if chunk_finish_reason == "stop": usage_data: Final = chunk.get("usage") or {} # mutable-ok: empty dict default if usage_data: - usage = convert_usage(cast("Mapping[str, int]", usage_data)) # cast-ok: dict from chunk has int values + validated_usage: Final = { + k: int(v) for k, v in dict(usage_data).items() + } # rebind-ok: dict comprehension + usage = convert_usage(validated_usage) usage_block = ChatCompletionUsageBlock( prompt_tokens=usage.prompt_tokens, completion_tokens=usage.completion_tokens, @@ -90,7 +93,7 @@ class GigaChatModelResponseIterator: ) return GenericStreamingChunk( - text=cast(str, text), + text=str(text), tool_use=tool_use, is_finished=chunk_finish_reason is not None, finish_reason=finish_reason or "",