Unverified Commit abcffbba authored by Thomas Parnell's avatar Thomas Parnell Committed by GitHub
Browse files

[CI] Fix mypy pre-commit errors on main (#36882)


Signed-off-by: default avatarThomas Parnell <tpa@zurich.ibm.com>
Co-authored-by: default avatarClaude Opus 4.6 <noreply@anthropic.com>
parent 53ec16a7
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
import contextlib import contextlib
import json import json
from collections.abc import Sequence
from pathlib import Path from pathlib import Path
from typing import Any, overload from typing import Any, overload
...@@ -299,7 +300,9 @@ class KimiAudioTokenizer(TokenizerLike): ...@@ -299,7 +300,9 @@ class KimiAudioTokenizer(TokenizerLike):
tokens = self._maybe_truncate(tokens, max_length) tokens = self._maybe_truncate(tokens, max_length)
return tokens return tokens
def decode(self, ids: list[int] | int, skip_special_tokens: bool = False) -> str: def decode(
self, ids: Sequence[int] | int, skip_special_tokens: bool = False
) -> str:
"""Decode token IDs to text, optionally skipping special tokens.""" """Decode token IDs to text, optionally skipping special tokens."""
if isinstance(ids, int): if isinstance(ids, int):
ids = [ids] ids = [ids]
...@@ -321,7 +324,7 @@ class KimiAudioTokenizer(TokenizerLike): ...@@ -321,7 +324,7 @@ class KimiAudioTokenizer(TokenizerLike):
return [self._token_to_id.get(token, self._unk_token_id) for token in tokens] return [self._token_to_id.get(token, self._unk_token_id) for token in tokens]
def convert_ids_to_tokens( def convert_ids_to_tokens(
self, ids: list[int], skip_special_tokens: bool = False self, ids: Sequence[int], skip_special_tokens: bool = False
) -> list[str]: ) -> list[str]:
tokens = [] tokens = []
for token_id in ids: for token_id in ids:
......
...@@ -68,7 +68,7 @@ class ToolParser: ...@@ -68,7 +68,7 @@ class ToolParser:
# tool_choice: "Forced Function" or "required" will override # tool_choice: "Forced Function" or "required" will override
# structured output json settings to make tool calling work correctly # structured output json settings to make tool calling work correctly
request.structured_outputs = StructuredOutputsParams( request.structured_outputs = StructuredOutputsParams(
json=json_schema_from_tool json=json_schema_from_tool # type: ignore[call-arg]
) )
request.response_format = None request.response_format = None
if isinstance(request, ResponsesRequest): if isinstance(request, ResponsesRequest):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment