Pangea provides AI Guard service for scanning LLM inputs and outputs to avoid manipulation of the model, addition of malicious content, and other undesirable data transfers.

To get started with Pangea, visit their documentation:

Get Started with Pangea AI Guard

Using Pangea with Portkey

1. Add Pangea Credentials to Portkey

  • Navigate to the Plugins page under Sidebar
  • Click on the edit button for the Pangea integration
  • Add your Pangea token and domain information (refer to Pangea’s documentation for how to obtain these credentials)

2. Add Pangea’s Guardrail Check

  • Navigate to the Guardrails page and click the Create button
  • Search for Pangea’s AI Guard and click Add
  • Configure your guardrail settings: recipe & debug (see Pangea’s API documentation for more details)
  • Set any actions you want on your check, and create the Guardrail!

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

Check NameDescriptionParametersSupported Hooks
AI GuardAnalyze and redact text to avoid manipulation of the model and malicious contentrecipe (string), debug (boolean)beforeRequestHook, afterRequestHook

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:

{
  "before_request_hooks": [
      {"id": "guardrails-id-xxx"}
    ],
  "after_request_hooks": [
      {"id": "guardrails-id-xxx"}
  ]
}
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 Pangea AI Guard and you can see the Verdict and any action you take directly on Portkey logs! More detailed logs for your requests will also be available on your Pangea dashboard.


Using Raw Guardrails with Pangea

You can define Pangea guardrails directly in your code for more programmatic control without using the Portkey UI. This “raw guardrails” approach lets you dynamically configure guardrails based on your application’s needs.

We recommend that you create guardrails using the Portkey UI whenever possible. Raw guardrails are more complex and require you to manage credentials and configurations directly in your code.

Get Support

If you face any issues with the Pangea integration, just ping the @pangea team on the community forum.

Learn More

Was this page helpful?