[New Plugin] Add FangcunGuard guardrail#1737
Open
zhiyuanzeng99 wants to merge 1 commit into
Open
Conversation
Adds FangcunGuard as a guardrail plugin. FangcunGuard (by FangcunLeap, https://www.fangcunleap.com) is a content-safety classifier that scores text into 10 safety categories (crimes, hate speech, self-harm, cybersecurity, extremism, and more) with a compact, low-latency model. - plugins/fangcunguard/{manifest.json,scan.ts,globals.ts} - Single 'scan' function supporting beforeRequestHook (prompt) and afterRequestHook (response); verdict = is_safe - Registered in plugins/index.ts - Tests in fangcunguard.test.ts (5 passing against the live API) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[New Plugin] FangcunGuard guardrail
Closes #1736
Adds FangcunGuard as a guardrail plugin. FangcunGuard (by FangcunLeap) is a content-safety classifier that scores text into 10 safety categories — crimes, hate speech, self-harm, cybersecurity, extremism, and more — with a compact, low-latency, Chinese-optimized model.
Changes
plugins/fangcunguard/manifest.json— plugin definition (apiKeycredential, optionalcustomHost)plugins/fangcunguard/scan.ts— handler supportingbeforeRequestHook(scan prompt) andafterRequestHook(scan response)plugins/fangcunguard/globals.ts— callsPOST {baseURL}/guard/contextwith a Bearer tokenplugins/fangcunguard/fangcunguard.test.ts— testsplugins/index.tsBehavior
The gateway
verdictmaps directly from the model'sis_safefield (verdict = is_safe): safe content passes, unsafe content is flagged. The full classification (label,unsafe_score,confidence,model) is returned indata. Empty text passes without an API call.Testing
npx jest plugins/fangcunguard/fangcunguard.test.ts— 5 passed against the live API:prettier --checkandtsc --noEmitboth pass.Getting a key
Sign up at https://www.fangcunleap.com or contact info@fangcunleap.com.
🤖 Generated with Claude Code