fix(ai): classify empty PixelRAG VLM offers as platform barriers
This commit is contained in:
@@ -153,6 +153,8 @@ def _prompt_for_item(item: Mapping[str, Any]) -> str:
|
||||
"Use only visible tile evidence and cite evidence_refs like tile:1.\n"
|
||||
"If the tile is access denied, captcha, login, traffic verification, or not a product/search card, "
|
||||
"set blocked_page_detected=true and leave product fields empty.\n"
|
||||
"Language selection, region selection, app-download, landing, loading, logo-only, or cookie consent "
|
||||
"pages are not product/search cards; set blocked_page_detected=true for them.\n"
|
||||
"Required JSON schema:\n"
|
||||
"{\n"
|
||||
' "blocked_page_detected": false,\n'
|
||||
@@ -183,6 +185,7 @@ def _validate_model_payload(
|
||||
missing_required: list[str] = []
|
||||
field_evidence_missing: list[str] = []
|
||||
low_confidence_fields: list[str] = []
|
||||
present_field_count = 0
|
||||
blocked_detected = bool(parsed.get("blocked_page_detected"))
|
||||
|
||||
for contract in list(item.get("field_contract") or []):
|
||||
@@ -198,6 +201,8 @@ def _validate_model_payload(
|
||||
confidence = 0.0
|
||||
min_confidence = float(contract.get("min_confidence") or DEFAULT_CONFIDENCE_THRESHOLD)
|
||||
present = _field_value_present(value)
|
||||
if present:
|
||||
present_field_count += 1
|
||||
if present and not evidence_refs:
|
||||
field_evidence_missing.append(field_name)
|
||||
if present and confidence < min_confidence:
|
||||
@@ -213,14 +218,22 @@ def _validate_model_payload(
|
||||
for field in declared_missing:
|
||||
if field not in missing_required:
|
||||
missing_required.append(field)
|
||||
non_product_or_interstitial_detected = (
|
||||
not blocked_detected
|
||||
and present_field_count == 0
|
||||
and bool(missing_required)
|
||||
)
|
||||
|
||||
return {
|
||||
"blocked_page_detected": blocked_detected,
|
||||
"non_product_or_interstitial_detected": non_product_or_interstitial_detected,
|
||||
"present_field_count": present_field_count,
|
||||
"missing_required_fields": missing_required,
|
||||
"field_evidence_missing": field_evidence_missing,
|
||||
"low_confidence_fields": low_confidence_fields,
|
||||
"valid_for_identity_matcher_replay": (
|
||||
not blocked_detected
|
||||
and not non_product_or_interstitial_detected
|
||||
and not missing_required
|
||||
and not field_evidence_missing
|
||||
),
|
||||
@@ -501,9 +514,12 @@ def _execute_item(
|
||||
missing_required = list(validation.get("missing_required_fields") or [])
|
||||
evidence_missing = list(validation.get("field_evidence_missing") or [])
|
||||
blocked_detected = bool(validation.get("blocked_page_detected"))
|
||||
non_product_or_interstitial = bool(
|
||||
validation.get("non_product_or_interstitial_detected")
|
||||
)
|
||||
status = "executed_ok"
|
||||
next_action = "run_identity_matcher_replay_then_promotion_gate"
|
||||
if blocked_detected:
|
||||
if blocked_detected or non_product_or_interstitial:
|
||||
status = "executed_warning"
|
||||
next_action = "run_platform_probe_or_use_structured_api"
|
||||
elif missing_required or evidence_missing:
|
||||
|
||||
Reference in New Issue
Block a user