Use different seeds for retries
This commit is contained in:
1 parent
c58bbc3672
commit
b6c2a634ca
7 files changed
+91
-10
No files matched your search
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user