textmachine/eval/bank_arbitration/retry_mis_b4.py

24 lines
824 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
"""Добор mis1-b4 после 429 (rate limit Mistral): пауза + одиночный повтор с бэкоффом."""
import time
import consilium_probe as cp
def main():
roster = cp.build_roster()
batches = cp.batches_of(roster)
b = batches[4]
system, user = cp.render_terminologist("\n\n".join(cp.block_of(c) for c in b))
cl = cp.client_for("mistral-large-2512")
for attempt in range(4):
try:
time.sleep(20 * (attempt + 1))
cp.call(cl, "mistral-large-2512", system, user + cp.CONF_NUM, "mis1-b4", None, False)
return
except Exception as e: # noqa: BLE001
print(f"attempt {attempt}: {type(e).__name__}: {e}")
raise SystemExit("mis1-b4 не добран")
if __name__ == "__main__":
main()