Download src/gemini/guard/postprocessor.ts from TTOPM/belel-protocol: direct link, hf CLI and curl.
- Browser
- Download file 947 Bytes
-
https://huggingface.co/TTOPM/belel-protocol/resolve/main/src/gemini/guard/postprocessor.ts
- Command line
-
hf download hf://TTOPM/belel-protocol/src/gemini/guard/postprocessor.ts
-
curl -L -o postprocessor.ts https://huggingface.co/TTOPM/belel-protocol/resolve/main/src/gemini/guard/postprocessor.ts
947 Bytes
| import { decisionForSerious } from "./policyEngine"; | |
| import { extractCitations, citationsPassWhitelist } from "./citations"; | |
| import { redactGeneric } from "./redaction"; | |
| export function enforceSeriousClaimPolicy(text: string) { | |
| const { require, action } = decisionForSerious(); | |
| if (!require) return { action: "allow" as const, output: text }; | |
| const urls = extractCitations(text); | |
| const ok = urls.length > 0 && citationsPassWhitelist(urls); | |
| if (ok) return { action: "allow" as const, output: text }; | |
| if (action === "block") { | |
| return { action: "block" as const, output: `[BLOCKED BY CONCORDIUM]\nA serious allegation was detected about a protected identity without reliable, whitelisted citations.` }; | |
| } | |
| if (action === "redact") { | |
| return { action: "redact" as const, output: redactGeneric() }; | |
| } | |
| return { action: "notice" as const, output: text + `\n\n[NOTICE] Provide reliable citations from reputable sources.` }; | |
| } | |