Skip to content

3. Getting Started

Hemantkohli1604 edited this page Apr 3, 2026 · 1 revision

Installation

## Install the package
npm install @intflows/genkit-guard

This library uses lightweight transformer models (MiniLM + BERT‑NER). Download them once.

## Download the transformer models (MiniLM + BERT‑NER)
node node_modules/@intflows/genkit-guard/scripts/download-model.js

Models are cached locally and reused across runs.

Quick Start

Paste this into your index.ts

import { guard, initGuard } from "@intflows/genkit-guard";

await initGuard();

const response = await ai.generate({
  prompt: "How do I integrate with Azure Blob Storage?",
  use: [
    guard({
      intent: {
        mode: "semantic",
        allowedIntent: "integration",
        semantic: {
          threshold: 0.7,
          intents: {
            integration: "Azure Blob, APIs, workflows"
          }
        }
      },
      pii: { reversible: true }
    })
  ]
});

Clone this wiki locally