Repository navigation
3. Getting Started
Try the Hugging Face Space. Use synthetic inputs when exploring the hosted demo.
Use Node.js 22 or newer. These pages describe the prepared v0.2.0 release; install the package once published:
npm install genkit @intflows/genkit-guardThe local models handle intent embeddings and PII classification. Download size and memory use depend on the selected models.
# Download MiniLM + OpenAI/privacy-filter
node node_modules/@intflows/genkit-guard/scripts/download-model.jsCreate src/guard.config.ts:
import { defineGuardConfig } from "@intflows/genkit-guard";
export default defineGuardConfig({
models: { extractor: "Xenova/all-MiniLM-L6-v2" },
intent: {
mode: "semantic",
allowedIntent: "integration",
semantic: {
threshold: 0.7,
intents: { integration: "Azure Blob Storage, APIs and integration workflows" }
}
},
pii: { mode: "classifier", model: "openai/privacy-filter", reversible: true }
});In your existing Genkit application:
import { guard, initGuard } from "@intflows/genkit-guard";
import guardConfig from "./guard.config.js";
await initGuard(guardConfig);
// ai is your configured Genkit instance.
const response = await ai.generate({
prompt: "How do I integrate with Azure Blob Storage?",
use: [guard(guardConfig)]
});The .js import is the NodeNext TypeScript convention. No automatic configuration-file discovery occurs. initGuard can fetch missing models and warm them before traffic arrives. The bundled download script prepares its built-in models; it does not read your custom configuration.
See 6.-Full-Setup-Guide for a new application and 5.-PII-Guard for custom labels.
Genkit raises blocked generations as FAILED_PRECONDITION, with detail.response.finishReason set to blocked. Handle this as shown in 6.-Full-Setup-Guide; infrastructure failures use the distinct errors in 12.-Security-and-Operational-Errors.