Skip to content

feat: add optional HuggingFace semantic-analysis layer#4

Merged
ravisastryk merged 1 commit into
mainfrom
feat/v2-semantic-analysis
May 3, 2026
Merged

feat: add optional HuggingFace semantic-analysis layer#4
ravisastryk merged 1 commit into
mainfrom
feat/v2-semantic-analysis

Conversation

@ravisastryk
Copy link
Copy Markdown
Owner

  • New internal/semantic package: pure-Go HF Inference API client, parallel model dispatch, score fusion, fail-open/fail-closed handling.
  • Scanner gains SetSemanticAnalyzer + fuseSemantic hook called from Scan and ScanResponse; PrescanResponse exposes semantic_score, findings, etc.
  • Response-mode PII spans flow into the rewriter so safe_rewrite masks the same characters the HF model flagged (e.g. [REDACTED_PII_SSN]).
  • internal/config loads YAML + env (SP_SEMANTIC, HF_TOKEN, profile, timeout, api_base). Scripts auto-load .env (gitignored).
  • Default profiles target the live HF Inference Providers router; 401/403/ 404/410 surface actionable errors.

- New internal/semantic package: pure-Go HF Inference API client, parallel
  model dispatch, score fusion, fail-open/fail-closed handling.
- Scanner gains SetSemanticAnalyzer + fuseSemantic hook called from Scan
  and ScanResponse; PrescanResponse exposes semantic_score, findings, etc.
- Response-mode PII spans flow into the rewriter so safe_rewrite masks the
  same characters the HF model flagged (e.g. [REDACTED_PII_SSN]).
- internal/config loads YAML + env (SP_SEMANTIC, HF_TOKEN, profile,
  timeout, api_base). Scripts auto-load .env (gitignored).
- Default profiles target the live HF Inference Providers router; 401/403/
  404/410 surface actionable errors.
- README rewritten with a step-by-step Getting started section;
  docs/output-scanning.md folded in. Tests + lint clean.
@ravisastryk ravisastryk self-assigned this May 3, 2026
@ravisastryk ravisastryk added the enhancement New feature or request label May 3, 2026
@ravisastryk ravisastryk marked this pull request as ready for review May 3, 2026 16:24
@ravisastryk ravisastryk merged commit d551bee into main May 3, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant