Spaces:
Sleeping
Sleeping
0.7.5: Debug endpoint shows raw LLM quotes + is_substring flag
Browse filesCo-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
230 unmodified lines2312322332342352362372382392402412422432442452462472481 unmodified line250251252253254255256257258259230 unmodified lines)for cand in candidates:llm_result_kind = "skipped"llm_result_len: int | None = Noneif primary_has_try and primary_ready:try:res = primary.try_extract(note, cand)if res is None:llm_result_kind = "returned_none"else:llm_result_kind = "returned_list"llm_result_len = len(res)except Exception as e: # noqa: BLE001llm_result_kind = f"raised:{type(e).__name__}"evidence = pipeline.meat_extractor(note, cand)extraction_trace.append(1 unmodified line"hcc": cand.hcc,"surface": [lnk.condition_span.text for lnk in cand.icd10_links],"evidence_count": len(evidence),"llm_result_kind": llm_result_kind,"llm_result_len": llm_result_len,"evidence": [{"cat": ev.category.value, "quote": ev.quote[:80], "start": ev.start}for ev in evidence],}230 unmodified lines2312322332342352362372382392402412422432442452462472482492502512522532542551 unmodified line257258259260261262263264265230 unmodified lines)for cand in candidates:# Capture RAW pre-verifier LLM output so we can see which quotes# were paraphrased / hallucinated and dropped by Component I.llm_raw: list[dict] = []if primary_has_try and primary_ready:try:res = primary.try_extract(note, cand)if res is not None:for ev in res:in_note = ev.quote in note.textllm_raw.append({"cat": ev.category.value,"quote": ev.quote,"is_substring": in_note,"start": ev.start if in_note else None,})except Exception as e: # noqa: BLE001llm_raw = [{"error": f"{type(e).__name__}: {e}"}]evidence = pipeline.meat_extractor(note, cand)extraction_trace.append(1 unmodified line"hcc": cand.hcc,"surface": [lnk.condition_span.text for lnk in cand.icd10_links],"evidence_count": len(evidence),"llm_raw_output": llm_raw,"verified_evidence": [{"cat": ev.category.value, "quote": ev.quote[:120], "start": ev.start}for ev in evidence],}
app/api/server.py+18-12