textmachine/eval/premise_review/glm_thinking_control.py

52 lines
2.5 KiB
Python
Raw 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
"""КОНТРОЛЬ к §C отчёта 18: чемпион glm-5 ехал с ВЫКЛЮЧЕННЫМ мышлением, претенденты — с включённым.
Отчёт 18 §D объявляет эту асимметрию как ограничение, но замером её не закрывает. Здесь она
закрывается: тот же ростер, те же 5 батчей, тот же промпт и та же добавка CONF_NUM — меняется
РОВНО ОДНО: `thinking` не отключается (тег `glm2`).
Зачем это нужно именно так: контроль может только УХУДШИТЬ мой собственный побочный вывод
«luna даёт качество чемпиона за 39% цены» — если glm-5 с мышлением поднимется выше 25/45, паритет
исчезнет. Контроль, способный убить лишь удобный мне результат, — не подгонка ворот, а её обратное.
Риг НЕ правится: `consilium_probe.py` импортируется как есть.
"""
from __future__ import annotations
import sys
import time
from pathlib import Path
HERE = Path(__file__).resolve().parent
sys.path.insert(0, str(HERE.parent / "bank_arbitration"))
import consilium_probe as C # noqa: E402
CEILING_USD = 0.12 # потолок этого контроля; glm-5 = $1.0 вход / $3.2 выход за 1M
def main() -> None:
roster = C.build_roster()
batches = C.batches_of(roster)
print(f"ростер {len(roster)} · батчей {len(batches)}")
C.slug_check("glm-5")
total = 0.0
cl = C.client_for("glm-5")
for i, b in enumerate(batches):
tag = f"glm2-b{i}"
if (C.RAW / f"{tag}.json").exists():
print(f"[{tag}] уже есть, пропуск")
continue
if total > CEILING_USD:
print(f"СТОП по потолку: ${total:.6f} > ${CEILING_USD}")
return
system, user = C.render_terminologist("\n\n".join(C.block_of(c) for c in b))
# thinking_off=False ⇒ extra_body без {"thinking":{"type":"disabled"}} ⇒ мышление ВКЛЮЧЕНО
rec = C.call(cl, "glm-5", system, user + C.CONF_NUM, tag, None, False)
total += rec["cost_usd"]
time.sleep(1.0)
print(f"контроль glm2 стоил ${total:.6f}")
if __name__ == "__main__":
main()