update Gemini API : use thinking levels

This commit is contained in:
sebastien committed 2026-10-10 08:47:39 +02:00
1 parent 7bc588e9a1
commit ec6ac9580b
9 files changed
+161 -21

No files matched your search

+13
View File
@@ -0,0 +1,13 @@
from google.genai import types
def thinking_config(level: str | None) -> types.ThinkingConfig | None:
"""Use a supported reasoning level, or omit it for the model default."""
if level is None:
return None
if level not in {"minimal", "low", "medium", "high"}:
raise ValueError(
f"Invalid Gemini thinking level {level!r}; "
'expected "minimal", "low", "medium", "high", or None'
)
return types.ThinkingConfig(thinking_level=level)