Integrating Portkey with AI Guard
This tutorial guides you through installing and configuring the Portkey plugin to integrate with Pangea’s AI Guard service. You’ll learn how to set up Portkey to call AI Guard in Pangea SaaS and Edge deployment scenarios, ensuring secure and optimized access to Pangea’s API.
AI Guard is a security service designed to protect Large Language Models (LLMs) from attacks such as prompt injections, data exfiltration, and malicious content submissions. Integrating with Portkey provides enhanced routing, traffic control, and security for AI Guard operations.
If you are looking to integrate Pangea within your Edge deployed environment, first start here. Once your Pangea Edge services are deployed, you may use the respective domain to configure your Portkey integration.
Step 1: Add Pangea credentials to Portkey
To begin, you need to configure the Pangea plugin within Portkey by adding your credentials.
- Navigate to the Plugins page under Settings in Portkey.
- Locate Pangea integration and click the edit button.
- Enter your Pangea token and domain information.
To obtain a Pangea token, log in to the Pangea User Console , navigate to the API Credentials section, and generate a new token.
Ensure that the token has appropriate permissions for the services you intend to use.
Step 2: Add a Guardrail check for AI Guard
Guardrails help ensure API requests to AI Guard are inspected and secured according to your configurations.
- Navigate to the Guardrails page in Portkey.
- Search for Pangea AI Guard and click Add.
- Write a meaningful name in the top input box and (optionally) configure the recipe and debug settings as needed.
- Save your Guardrail to generate a Guardrail ID.
Guardrail Details
Check Name | Description | Parameters | Supported Hooks |
---|---|---|---|
AI Guard | Analyze and redact text to avoid model manipulation and malicious content | recipe (string), debug (boolean) | beforeRequestHook , afterRequestHook |