From f130ff2587944d9c5fb81a38ac4975759f8f0057 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Tue, 20 Aug 2024 17:23:00 -0700 Subject: [PATCH] fix doc guardrails --- .../docs/proxy/guardrails/aporia_api.md | 8 ++- .../docs/proxy/guardrails/quick_start.md | 66 ++++++++++++++++++- 2 files changed, 72 insertions(+), 2 deletions(-) diff --git a/docs/my-website/docs/proxy/guardrails/aporia_api.md b/docs/my-website/docs/proxy/guardrails/aporia_api.md index a69696c6bc7..d5b6bd636cf 100644 --- a/docs/my-website/docs/proxy/guardrails/aporia_api.md +++ b/docs/my-website/docs/proxy/guardrails/aporia_api.md @@ -135,7 +135,13 @@ curl -i http://localhost:4000/v1/chat/completions \ -## 5. Control Guardrails per Project (API Key) +## 5. ✨ Control Guardrails per Project (API Key) + +:::info + +✨ This is an Enterprise only feature [Contact us to get a free trial](https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat) + +::: Use this to control what guardrails run per project. In this tutorial we only want the following guardrails to run for 1 project (API Key) - `guardrails`: ["aporia-pre-guard", "aporia-post-guard"] diff --git a/docs/my-website/docs/proxy/guardrails/quick_start.md b/docs/my-website/docs/proxy/guardrails/quick_start.md index c557cde438a..703d32dd332 100644 --- a/docs/my-website/docs/proxy/guardrails/quick_start.md +++ b/docs/my-website/docs/proxy/guardrails/quick_start.md @@ -110,4 +110,68 @@ curl -i http://localhost:4000/v1/chat/completions \ - \ No newline at end of file + + + +## Advanced +### ✨ Control Guardrails per Project (API Key) + +:::info + +✨ This is an Enterprise only feature [Contact us to get a free trial](https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat) + +::: + +Use this to control what guardrails run per project. In this tutorial we only want the following guardrails to run for 1 project (API Key) +- `guardrails`: ["aporia-pre-guard", "aporia-post-guard"] + +**Step 1** Create Key with guardrail settings + + + + +```shell +curl -X POST 'http://0.0.0.0:4000/key/generate' \ + -H 'Authorization: Bearer sk-1234' \ + -H 'Content-Type: application/json' \ + -D '{ + "guardrails": ["aporia-pre-guard", "aporia-post-guard"] + } + }' +``` + + + + +```shell +curl --location 'http://0.0.0.0:4000/key/update' \ + --header 'Authorization: Bearer sk-1234' \ + --header 'Content-Type: application/json' \ + --data '{ + "key": "sk-jNm1Zar7XfNdZXp49Z1kSQ", + "guardrails": ["aporia-pre-guard", "aporia-post-guard"] + } +}' +``` + + + + +**Step 2** Test it with new key + +```shell +curl --location 'http://0.0.0.0:4000/chat/completions' \ + --header 'Authorization: Bearer sk-jNm1Zar7XfNdZXp49Z1kSQ' \ + --header 'Content-Type: application/json' \ + --data '{ + "model": "gpt-3.5-turbo", + "messages": [ + { + "role": "user", + "content": "my email is ishaan@berri.ai" + } + ] +}' +``` + +