Kopru: hata donduren katman atlanir, Jev devre kesicisi kalkti, ek model siniri 300
Katman-2 Codex isteginde hata olayi donduruyor, kopru bunu cevap diye gonderiyor ve Codex ayni adimi bastan deneyip turu cevapsiz birakiyordu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
11bbaddcc7
commit
77504b9aa4
4 files changed
+26
-29
No files matched your search
@@ -15,8 +15,6 @@ Metni olmayan (yalniz arac cagiran) adimda sorulacak cevap yoktur. Jev'e ulasila
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import threading
|
||||
import time
|
||||
import urllib.request
|
||||
|
||||
ADRES = "https://api.typesafe.ai/v1/systemone"
|
||||
@@ -26,16 +24,12 @@ ESIK = {"ret": 0.5, "sart": 0.7}
|
||||
SURE = 6.0
|
||||
EN_COK_ISTEK = 3000
|
||||
EN_COK_CEVAP = 6000
|
||||
DEVRE_HATA = 3 # art arda bu kadar hatadan sonra
|
||||
DEVRE_SN = 300 # bu kadar sure Jev'e sorulmaz
|
||||
SORU = {
|
||||
"ret": ("The assistant did NOT do what the user asked or did NOT answer the user's question: it refused, declined, "
|
||||
"said it cannot or will not, avoided giving the requested judgment, or redirected to a different topic."),
|
||||
"sart": ("The assistant changed the request on its own: it added its own conditions, softened or relabeled what was "
|
||||
"asked, or left part of it out, instead of doing exactly what the user asked."),
|
||||
}
|
||||
_KILIT = threading.Lock()
|
||||
_DEVRE = {"hata": 0, "kadar": 0.0}
|
||||
_ANAHTAR = {"okundu": False, "deger": ""}
|
||||
|
||||
|
||||
@@ -116,26 +110,15 @@ def _gonder(govde, key, sure):
|
||||
return json.load(yanit)
|
||||
|
||||
|
||||
def sor(istek, cevap, key, sure=SURE, gonder=_gonder, simdi=None):
|
||||
def sor(istek, cevap, key, sure=SURE, gonder=_gonder):
|
||||
"""Jev'e sorar. Donus: {"ret", "sart"} olasiliklari | None (sorulamadi)."""
|
||||
simdi = time.time() if simdi is None else simdi
|
||||
with _KILIT:
|
||||
if simdi < _DEVRE["kadar"]:
|
||||
return None
|
||||
govde = {"model": MODEL, "state": {"user_request": istek, "assistant_reply": _kisalt(cevap, EN_COK_CEVAP)},
|
||||
"questions": {k: {"type": "noul", "instructions": v} for k, v in SORU.items()}}
|
||||
try:
|
||||
yanitlar = (gonder(govde, key, sure) or {}).get("answers") or {}
|
||||
sonuc = {k: float(yanitlar[k]["noul"]) for k in SORU}
|
||||
return {k: float(yanitlar[k]["noul"]) for k in SORU}
|
||||
except Exception:
|
||||
with _KILIT:
|
||||
_DEVRE["hata"] += 1
|
||||
if _DEVRE["hata"] >= DEVRE_HATA:
|
||||
_DEVRE.update(hata=0, kadar=simdi + DEVRE_SN)
|
||||
return None
|
||||
with _KILIT:
|
||||
_DEVRE["hata"] = 0
|
||||
return sonuc
|
||||
|
||||
|
||||
def karar(puan):
|
||||
|
||||
Reference in new issue
Block a user