Prompt Security provides advanced protection for your AI applications against various security threats including prompt injections and sensitive data exposure, helping ensure safe interactions with LLMs.

To get started with Prompt Security, visit their website:

Get Started with Prompt Security

Using Prompt Security with Portkey

1. Add Prompt Security Credentials to Portkey

  • Click on the Admin Settings button on Sidebar
  • Navigate to Plugins tab under Organisation Settings
  • Click on the edit button for the Prompt Security integration
  • Add your Prompt Security API Key and API Domain (obtain these from your Prompt Security account)

2. Add Prompt Security’s Guardrail Check

  • Navigate to the Guardrails page and click the Create button
  • Search for either “Protect Prompt” or “Protect Response” depending on your needs and click Add
  • Set any actions you want on your check, and create the Guardrail!

Guardrail Actions allow you to orchestrate your guardrails logic. You can learn more about them here

Check NameDescriptionParametersSupported Hooks
Protect PromptProtect a user prompt before it is sent to the LLMNonebeforeRequestHook
Protect ResponseProtect a LLM response before it is sent to the userNoneafterRequestHook

3. Add Guardrail ID to a Config and Make Your Request

  • When you save a Guardrail, you’ll get an associated Guardrail ID - add this ID to the before_request_hooks or after_request_hooks params in your Portkey Config
  • Create these Configs in Portkey UI, save them, and get an associated Config ID to attach to your requests. More here.

Here’s an example configuration:

{
  "input_guardrails": ["guardrails-id-xxx"],
  "output_guardrails": ["guardrails-id-yyy"],
}
const portkey = new Portkey({
    apiKey: "PORTKEY_API_KEY",
    config: "pc-***" // Supports a string config id or a config object
});

For more, refer to the Config documentation.

Your requests are now guarded by Prompt Security’s protection mechanisms, and you can see the verdict and any actions taken directly in your Portkey logs!

Get Support

If you face any issues with the Prompt Security integration, join the Portkey community forum for assistance.