Prerequisites: Setup optimodel here

Now you’re ready to start adding guardrails to your calls. Here is the general syntax:

Blocking Requests

In addition to the guard itself, you can also use the blockRequest flag to block requests when a guard is active and give a custom message to return instead.

Available Guardrails

meta-llama/Prompt-Guard-86M

Utilize Meta’s prompt guard to protect against jailbreaks and injection attacks. See the model card here for more information.

Note: We recommend starting with only jailbreak with a value of 0.999 unless you know what you are doing

microsoft/Presidio-Guard

Utilize Microsoft’s Presidio Guard to protect against PII. See the model card here for more information.

lytix/Regex-Guard

Simple regex guard to protect against given regex patterns. See here for source code on how its implemented.