Skip to content

Commit c1b72de

Browse files
prompt security docs
1 parent 857c493 commit c1b72de

File tree

4 files changed

+127
-2
lines changed

4 files changed

+127
-2
lines changed

docs.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
"product/guardrails/lasso",
109109
"product/guardrails/aporia",
110110
"product/guardrails/pillar",
111+
"product/guardrails/prompt-security",
111112
"product/guardrails/pangea",
112113
"product/guardrails/acuvity",
113114
"product/guardrails/mistral",

images/guardrails/prompt-secuirty.png

2.28 KB
Loading

product/guardrails/list-of-guardrail-checks.mdx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,21 @@ Each Guardrail Check has a specific purpose, it's own parameters, supported hook
3737
* Analyze and redact text to avoid model manipulation
3838
* Detect malicious content and undesirable data transfers
3939
</Card>
40-
<Card title="Patronus" href="/product/guardrails/list-of-guardrail-checks/patronus-ai" img="/images/guardrails/logo-3.avif">
40+
<Card title="Patronus" href="/product/guardrails/patronus-ai" img="/images/guardrails/logo-3.avif">
4141
* Hallucination detection
4242
* Check for conciseness, helpfulness, politeness
4343
* Check for gender, racial bias
4444
* and more!
4545
</Card>
46-
<Card title="Pillar" href="/product/guardrails/list-of-guardrail-checks/pillar" img="/images/guardrails/logo-2.avif">
46+
<Card title="Pillar" href="/product/guardrails/pillar" img="/images/guardrails/logo-2.avif">
4747
* Scan Prompts
4848
* Scan Responses
4949
For PII, toxicity, prompt injection detection, and more.
5050
</Card>
51+
<Card title="Prompt Security" href="/product/guardrails/prompt-security" img="/images/guardrails/prompt-secuirty.png">
52+
* Scan Prompts
53+
* Scan Responses
54+
</Card>
5155
</CardGroup>
5256

5357

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
---
2+
title: "Prompt Security"
3+
description: "Prompt Security detects and protects against prompt injection, sensitive data exposure, and other AI security threats."
4+
---
5+
6+
[Prompt Security](https://www.prompt.security/solutions/employees) provides advanced protection for your AI applications against various security threats including prompt injections and sensitive data exposure, helping ensure safe interactions with LLMs.
7+
8+
To get started with Prompt Security, visit their website:
9+
<Card title="Get Started with Prompt Security" href="https://www.prompt.security/solutions/employees" />
10+
11+
## Using Prompt Security with Portkey
12+
13+
### 1. Add Prompt Security Credentials to Portkey
14+
15+
* Click on the `Admin Settings` button on Sidebar
16+
* Navigate to `Plugins` tab under Organisation Settings
17+
* Click on the edit button for the Prompt Security integration
18+
* Add your Prompt Security API Key and API Domain (obtain these from your Prompt Security account)
19+
20+
### 2. Add Prompt Security's Guardrail Check
21+
22+
* Navigate to the `Guardrails` page and click the `Create` button
23+
* Search for either "Protect Prompt" or "Protect Response" depending on your needs and click `Add`
24+
* Set any `actions` you want on your check, and create the Guardrail!
25+
26+
<Note>
27+
Guardrail Actions allow you to orchestrate your guardrails logic. You can learn more about them [here](/product/guardrails#there-are-6-types-of-guardrail-actions)
28+
</Note>
29+
30+
| Check Name | Description | Parameters | Supported Hooks |
31+
|------------|-------------|------------|-----------------|
32+
| Protect Prompt | Protect a user prompt before it is sent to the LLM | None | `beforeRequestHook` |
33+
| Protect Response | Protect a LLM response before it is sent to the user | None | `afterRequestHook` |
34+
35+
### 3. Add Guardrail ID to a Config and Make Your Request
36+
37+
* 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
38+
* Create these Configs in Portkey UI, save them, and get an associated Config ID to attach to your requests. [More here](/product/ai-gateway/configs).
39+
40+
Here's an example configuration:
41+
42+
```json
43+
{
44+
"input_guardrails": ["guardrails-id-xxx"],
45+
"output_guardrails": ["guardrails-id-yyy"],
46+
}
47+
```
48+
49+
<Tabs>
50+
<Tab title="NodeJS">
51+
52+
```js
53+
const portkey = new Portkey({
54+
apiKey: "PORTKEY_API_KEY",
55+
config: "pc-***" // Supports a string config id or a config object
56+
});
57+
```
58+
</Tab>
59+
<Tab title="Python">
60+
61+
```py
62+
portkey = Portkey(
63+
api_key="PORTKEY_API_KEY",
64+
config="pc-***" # Supports a string config id or a config object
65+
)
66+
```
67+
</Tab>
68+
<Tab title="OpenAI NodeJS">
69+
70+
```js
71+
const openai = new OpenAI({
72+
apiKey: 'OPENAI_API_KEY',
73+
baseURL: PORTKEY_GATEWAY_URL,
74+
defaultHeaders: createHeaders({
75+
apiKey: "PORTKEY_API_KEY",
76+
config: "CONFIG_ID"
77+
})
78+
});
79+
```
80+
</Tab>
81+
<Tab title="OpenAI Python">
82+
83+
```py
84+
client = OpenAI(
85+
api_key="OPENAI_API_KEY", # defaults to os.environ.get("OPENAI_API_KEY")
86+
base_url=PORTKEY_GATEWAY_URL,
87+
default_headers=createHeaders(
88+
provider="openai",
89+
api_key="PORTKEY_API_KEY", # defaults to os.environ.get("PORTKEY_API_KEY")
90+
config="CONFIG_ID"
91+
)
92+
)
93+
```
94+
</Tab>
95+
<Tab title="cURL">
96+
97+
```sh
98+
curl https://api.portkey.ai/v1/chat/completions \
99+
-H "Content-Type: application/json" \
100+
-H "Authorization: Bearer $OPENAI_API_KEY" \
101+
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
102+
-H "x-portkey-config: $CONFIG_ID" \
103+
-d '{
104+
"model": "gpt-3.5-turbo",
105+
"messages": [{
106+
"role": "user",
107+
"content": "Hello!"
108+
}]
109+
}'
110+
```
111+
</Tab>
112+
</Tabs>
113+
114+
For more, refer to the [Config documentation](/product/ai-gateway/configs).
115+
116+
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!
117+
118+
## Get Support
119+
120+
If you face any issues with the Prompt Security integration, join the [Portkey community forum](https://discord.gg/portkey-llms-in-prod-1143393887742861333) for assistance.

0 commit comments

Comments
 (0)