Use different seeds for retries

This commit is contained in:
sebastien committed 2026-10-12 11:24:13 +02:00
1 parent c58bbc3672
commit b6c2a634ca
7 files changed
+91 -10

No files matched your search

+10
View File
@@ -1,6 +1,16 @@
import secrets
from google.genai import types
def fresh_seed(previous: int | None = None) -> int:
"""Choose a random int32 seed, excluding the preceding attempt's seed."""
limit = 2**31
if previous is None:
return secrets.randbelow(limit)
return (previous + 1 + secrets.randbelow(limit - 1)) % limit
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: