Providers
Google Gemini
Wrap @google/generative-ai's generateContent the same way -- retries and redaction apply before the request ever reaches Google.
← All recipes
import { Maskea, retries, pii } from "@nopeatech/maskea";
import { GoogleGenerativeAI } from "@google/generative-ai";
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY!);
const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });
const maskea = new Maskea()
.use(retries({ max: 3 }))
.use(pii({ mode: "mask" }));
const generate = maskea.wrap(model.generateContent.bind(model));
const result = await generate("Summarize this ticket: ...");Checked against the shipped @nopeatech/maskea API. Full docs at nopea.tech/maskea/docs.