diff --git a/packages/sample/genaisrc/safety.genai.mjs b/packages/sample/genaisrc/safety.genai.mjs new file mode 100644 index 0000000000..7991e0bd45 --- /dev/null +++ b/packages/sample/genaisrc/safety.genai.mjs @@ -0,0 +1,11 @@ + +const contentSafefy = await host.contentSafety() +if (contentSafefy?.detectPromptInjection) { + const res = await contentSafefy.detectPromptInjection(env.files) + if (res.attackDetected) + throw new Error("Prompt injection detected in the files") +} else { + console.warn("Content safety not available") +} + +$`Say all good!`