Skip to content

Commit fcc367c

Browse files
committed
Reasoning.effort is stored as a word; only the constructor takes None (type checkers see both)
Signed-off-by: Maxime Rivest <mrive052@gmail.com>
1 parent b1d4815 commit fcc367c

3 files changed

Lines changed: 16 additions & 3 deletions

File tree

‎lm15/types.py‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1824,10 +1824,22 @@ class Reasoning:
18241824
MAP-7 rule 3, amended 2026-10-10).
18251825
"""
18261826

1827-
effort: ReasoningEffort | None = None
1827+
# Stored: always a word once built (a budget alone fills it, below). The
1828+
# constructor also takes None; the generated __init__ block says so.
1829+
effort: ReasoningEffort = None # type: ignore[assignment]
18281830
thinking_budget: int | None = None
18291831
summary: ReasoningSummary | None = None
18301832

1833+
# BEGIN generated by tools/gen_init_signatures.py: do not edit
1834+
if TYPE_CHECKING:
1835+
def __init__(
1836+
self,
1837+
effort: ReasoningEffort | None = ...,
1838+
thinking_budget: int | None = ...,
1839+
summary: ReasoningSummary | None = ...,
1840+
) -> None: ...
1841+
# END generated
1842+
18311843
def __post_init__(self) -> None:
18321844
if self.effort is None:
18331845
if self.thinking_budget is None:

‎tools/gen_init_signatures.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
TYPES: dict[str, tuple[str, ...]] = {
3737
"lm15.types": (
3838
"ToolCallPart", "ToolResultPart", "DataPart", "Message", "FunctionTool", "BuiltinTool",
39-
"ToolChoice", "Config", "Request", "TokenLogprob", "FileUploadRequest",
39+
"ToolChoice", "Reasoning", "Config", "Request", "TokenLogprob", "FileUploadRequest",
4040
"SpeechGenerationRequest",
4141
"FilePage", "CachePage", "BatchRequest", "ImageGenerationRequest",
4242
"ImageGenerationResponse", "VideoGenerationRequest", "LiveConfig",
@@ -52,6 +52,7 @@
5252
# __post_init__; the test cross-checks them by constructing the value).
5353
WIDER: dict[tuple[str, str], str] = {
5454
("Message", "parts"): "Part | Sequence[Part]",
55+
("Reasoning", "effort"): "ReasoningEffort | None",
5556
("ToolChoice", "allowed"): "str | Sequence[str]",
5657
("Config", "stop"): "str | Sequence[str]",
5758
("Request", "messages"): "Message | Sequence[Message]",

‎typecheck/baseline.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174
11 lm15/providers/openai.py|union-attr|Item "list[JsonValue]" of "int | float | str | list[JsonValue] | dict[str, JsonValue] | Any | dict[str | Any, int | float | str | list[JsonValue] | dict[str, JsonValue] | Any | None] | None" has no attribute "get"
175175
5 lm15/providers/openai.py|union-attr|Item "str" of "Any | int | float | str | list[JsonValue] | dict[str, JsonValue] | dict[str | Any, int | float | str | list[JsonValue] | dict[str, JsonValue] | Any | None]" has no attribute "get"
176176
11 lm15/providers/openai.py|union-attr|Item "str" of "int | float | str | list[JsonValue] | dict[str, JsonValue] | Any | dict[str | Any, int | float | str | list[JsonValue] | dict[str, JsonValue] | Any | None] | None" has no attribute "get"
177-
1 lm15/providers/openai_chat.py|arg-type|Argument "effort" to "Reasoning" has incompatible type "str"; expected "Literal['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max']"
177+
1 lm15/providers/openai_chat.py|arg-type|Argument "effort" to "Reasoning" has incompatible type "str"; expected "Literal['off', 'minimal', 'low', 'medium', 'high', 'xhigh', 'max'] | None"
178178
1 lm15/providers/openai_chat.py|arg-type|Argument "finish_reason" to "Response" has incompatible type "str"; expected "Literal['stop', 'length', 'tool_call', 'content_filter', 'error']"
179179
1 lm15/providers/openai_chat.py|arg-type|Argument "finish_reason" to "StreamEndEvent" has incompatible type "str"; expected "Literal['stop', 'length', 'tool_call', 'content_filter', 'error'] | None"
180180
1 lm15/providers/openai_chat.py|arg-type|Argument "key" to "max" has incompatible type overloaded function; expected "Callable[[str], SupportsDunderLT[Any] | SupportsDunderGT[Any]]"

0 commit comments

Comments
 (0)