@intflows/genkit-guard 0.0.8-alpha.0 → 0.0.8-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
# **@intflows/genkit-guard**
|
|
1
|
+
# **@intflows/genkit-guard**
|
|
2
|
+
|
|
3
|
+
#### _This version uses OpenAI/privacy-filter instead of bert-base-NER_
|
|
4
|
+
|
|
2
5
|
### **Lightweight Intent, PII, and Safety Guardrails for Genkit**
|
|
3
6
|
|
|
4
7
|
`@intflows/genkit-guard` provides a modular guardrail layer for Genkit flows.
|
|
@@ -24,7 +27,7 @@ This library is designed for developers who want **practical, production‑ready
|
|
|
24
27
|
Blocks jailbreak attempts using pattern‑based heuristics.
|
|
25
28
|
|
|
26
29
|
- **Model‑Light Architecture**
|
|
27
|
-
The package uses local `all-MiniLM-L6-v2` and `
|
|
30
|
+
The package uses local `all-MiniLM-L6-v2` and `openai/privacy-filter` Models, these Models are downloaded once and cached locally.
|
|
28
31
|
|
|
29
32
|
- **Drop‑in Genkit Middleware**
|
|
30
33
|
Works with `ai.generate`, `ai.generateStream`, and Genkit flows.
|
|
@@ -38,12 +41,12 @@ This library is designed for developers who want **practical, production‑ready
|
|
|
38
41
|
npm install @intflows/genkit-guard
|
|
39
42
|
```
|
|
40
43
|
|
|
41
|
-
This library uses lightweight transformer models (MiniLM +
|
|
44
|
+
This library uses lightweight transformer models (MiniLM + Openai/privacy-filter).
|
|
42
45
|
|
|
43
46
|
Download them once.
|
|
44
47
|
|
|
45
48
|
```bash
|
|
46
|
-
## Download the transformer models (MiniLM +
|
|
49
|
+
## Download the transformer models (MiniLM + OpenAI/privacy-filter)
|
|
47
50
|
node node_modules/@intflows/genkit-guard/scripts/download-model.js
|
|
48
51
|
```
|
|
49
52
|
|
|
@@ -62,6 +65,7 @@ npm install @intflows/genkit-guard
|
|
|
62
65
|
# Download Local Models (Only needed once)
|
|
63
66
|
node node_modules/@intflows/genkit-guard/scripts/download-model.js
|
|
64
67
|
```
|
|
68
|
+
_ This downloads the models to ./models folder, the total size is ~1.5 GB ( 1GB for Openai/privacy-filter + .5 GB for MiniLM-L6-v2)
|
|
65
69
|
|
|
66
70
|
### 2. Update genkit
|
|
67
71
|
|
|
@@ -133,9 +137,9 @@ Before the LLM sees the prompt:
|
|
|
133
137
|
Detected PII includes:
|
|
134
138
|
|
|
135
139
|
- Emails
|
|
136
|
-
- Phone numbers
|
|
137
|
-
- Names (NER)
|
|
140
|
+
- Phone numbers
|
|
138
141
|
- AU identifiers (Medicare, TFN, ABN, etc.)
|
|
142
|
+
- PII detected by local Model (OpenAI/privacy-filter)
|
|
139
143
|
|
|
140
144
|
### **3. LLM Call**
|
|
141
145
|
The masked prompt is sent to the model.
|