Skip to content

Commit bffc45c

Browse files
committed
fix: bypass_cache=True in eval tab — each test case now runs fresh
1 parent 0b6ddb1 commit bffc45c

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

analysis/analyzer.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -593,18 +593,21 @@ def _mock_response(text: str, reason: str = "") -> dict:
593593
}
594594

595595

596-
def analyze_transcript(text: str, language: str = "en") -> dict:
596+
def analyze_transcript(text: str, language: str = "en", bypass_cache: bool = False) -> dict:
597597
"""
598-
Full analysis pipeline v7.1
598+
Full analysis pipeline v7.2
599+
bypass_cache=True skips vector + MD5 cache — used by the eval tab so
600+
each test case gets a fresh independent result instead of the same
601+
cached result for all three cases (which caused 93.8% across the board).
599602
"""
600603
start_time = time.time()
601604

602-
# Step 1: Vector cache
605+
# Step 1: Vector cache (skipped when bypass_cache=True)
603606
vector_cache_available = False
604607
try:
605608
from utils.vector_cache import get_cached_result, store_result, is_available
606609
vector_cache_available = is_available()
607-
if vector_cache_available:
610+
if vector_cache_available and not bypass_cache:
608611
cached = get_cached_result(text, language)
609612
if cached:
610613
cached["_from_vector_cache"] = True
@@ -613,13 +616,14 @@ def analyze_transcript(text: str, language: str = "en") -> dict:
613616
store_result = None
614617
vector_cache_available = False
615618

616-
# Step 2: MD5 exact cache
619+
# Step 2: MD5 exact cache (skipped when bypass_cache=True)
617620
try:
618621
from utils.cache import get_cached, set_cache
619-
cached = get_cached(text, language)
620-
if cached:
621-
cached["_from_cache"] = True
622-
return cached
622+
if not bypass_cache:
623+
cached = get_cached(text, language)
624+
if cached:
625+
cached["_from_cache"] = True
626+
return cached
623627
except ImportError:
624628
get_cached = set_cache = None
625629

app.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1653,7 +1653,11 @@ def compute_health_score(R: dict) -> dict:
16531653

16541654
if st.button("Run evaluation →"):
16551655
with st.spinner("Evaluating…"):
1656-
pred = analyze_transcript(tc["transcript"], tc["language"])
1656+
pred = analyze_transcript(
1657+
tc["transcript"],
1658+
tc["language"],
1659+
bypass_cache=True # always fresh — prevents all 3 cases returning same cached result
1660+
)
16571661
report = evaluate(pred, tc["ground_truth"], tc["transcript"])
16581662

16591663
overall = report.get("overall_score", 0)

0 commit comments

Comments
 (0)