feat: метрики качества — арифметика (sum==price*qty) + частота JSON-фиксов
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Process service — SSE pipeline: reset → supplements → LLM → apply."""
|
||||
import json, time, threading
|
||||
from db import supplements, spec_current, spec_events
|
||||
from .metrics import check_arithmetic
|
||||
|
||||
|
||||
def run_pipeline(contract_id, order_ids, sse_send, build_prompt_fn):
|
||||
@@ -108,6 +109,10 @@ def run_pipeline(contract_id, order_ids, sse_send, build_prompt_fn):
|
||||
summary = spec_events.apply_ops(
|
||||
contract_id, sid, s.get("document_id", ""), ops, prompt_id, llm_result
|
||||
)
|
||||
# Arithmetic quality check (free signal, no golden dataset needed)
|
||||
arith_mismatches = check_arithmetic(ops)
|
||||
if arith_mismatches:
|
||||
summary["arithmetic_mismatches"] = len(arith_mismatches)
|
||||
sse_send({"type": "applied", "supplement_id": sid, "summary": summary, "ops": ops})
|
||||
|
||||
total_time = round(time.time() - t0, 1)
|
||||
|
||||
Reference in New Issue
Block a user