Instructions to use sasitsar/rampart with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use sasitsar/rampart with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('token-classification', 'sasitsar/rampart');
Download examples/basic-chat.ts from sasitsar/rampart: direct link, hf CLI and curl.
- Browser
- Download file 325 Bytes
-
https://huggingface.co/sasitsar/rampart/resolve/main/examples/basic-chat.ts
- Command line
-
hf download hf://sasitsar/rampart/examples/basic-chat.ts
-
curl -L -o basic-chat.ts https://huggingface.co/sasitsar/rampart/resolve/main/examples/basic-chat.ts
325 Bytes
| import { createGuard } from "../index.ts"; | |
| const guard = await createGuard(); | |
| const safe = await guard.protect("My name is Alex Rivera. My SSN is 472-81-0094."); | |
| const reply = await llm(safe.text); | |
| console.log(guard.reveal(reply)); | |
| async function llm(text: string): Promise<string> { | |
| return "Got it, [GIVEN_NAME_1]."; | |
| } |