mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-10 22:41:41 +00:00
docs(enterprise.md): add llama guard tutorial to enterprise docs
This commit is contained in:
parent
a8a5bbf453
commit
0a3284e753
3 changed files with 34 additions and 6 deletions
|
|
@ -1,21 +1,46 @@
|
|||
import Tabs from '@theme/Tabs';
|
||||
import TabItem from '@theme/TabItem';
|
||||
|
||||
# 💸 Spend Tracking
|
||||
# ✨ Enterprise Features
|
||||
|
||||
Features here are behind a commercial license in our `/enterprise` folder. [**See Code**](https://github.com/BerriAI/litellm/tree/main/enterprise)
|
||||
|
||||
:::info
|
||||
|
||||
This is an Enterprise only feature [Get Started with Enterprise here](https://github.com/BerriAI/litellm/tree/main/enterprise)
|
||||
[Get Started with Enterprise here](https://github.com/BerriAI/litellm/tree/main/enterprise)
|
||||
|
||||
:::
|
||||
|
||||
Features:
|
||||
- [ ] Content Moderation with LlamaGuard
|
||||
- [ ] Tracking Spend for Custom Tags
|
||||
|
||||
## Content Moderation with LlamaGuard
|
||||
|
||||
Currently works with Sagemaker's LlamaGuard endpoint.
|
||||
|
||||
How to enable this in your config.yaml:
|
||||
|
||||
```yaml
|
||||
litellm_settings:
|
||||
callbacks: ["llamaguard_moderations"]
|
||||
llamaguard_model_name: "sagemaker/jumpstart-dft-meta-textgeneration-llama-guard-7b"
|
||||
```
|
||||
|
||||
Make sure you have the relevant keys in your environment, eg.:
|
||||
|
||||
```
|
||||
os.environ["AWS_ACCESS_KEY_ID"] = ""
|
||||
os.environ["AWS_SECRET_ACCESS_KEY"] = ""
|
||||
os.environ["AWS_REGION_NAME"] = ""
|
||||
```
|
||||
|
||||
## Tracking Spend for Custom Tags
|
||||
|
||||
Requirements:
|
||||
|
||||
- Virtual Keys & a database should be set up, see [virtual keys](https://docs.litellm.ai/docs/proxy/virtual_keys)
|
||||
|
||||
|
||||
## Tracking Spend per Request Tag
|
||||
|
||||
### Usage - /chat/completions requests with request tags
|
||||
|
||||
|
||||
|
|
@ -109,10 +109,10 @@ const sidebars = {
|
|||
label: '📖 All Endpoints',
|
||||
href: 'https://litellm-api.up.railway.app/',
|
||||
},
|
||||
"proxy/enterprise",
|
||||
"proxy/user_keys",
|
||||
"proxy/virtual_keys",
|
||||
"proxy/users",
|
||||
"proxy/spend",
|
||||
"proxy/ui",
|
||||
"proxy/model_management",
|
||||
"proxy/health",
|
||||
|
|
|
|||
|
|
@ -69,6 +69,7 @@ class _OPTIONAL_PresidioPIIMasking(CustomLogger):
|
|||
async with aiohttp.ClientSession() as session:
|
||||
# Make the first request to /analyze
|
||||
analyze_url = f"{self.presidio_analyzer_api_base}/analyze"
|
||||
verbose_proxy_logger.debug(f"Making request to: {analyze_url}")
|
||||
analyze_payload = {"text": text, "language": "en"}
|
||||
redacted_text = None
|
||||
async with session.post(analyze_url, json=analyze_payload) as response:
|
||||
|
|
@ -76,6 +77,7 @@ class _OPTIONAL_PresidioPIIMasking(CustomLogger):
|
|||
|
||||
# Make the second request to /anonymize
|
||||
anonymize_url = f"{self.presidio_anonymizer_api_base}/anonymize"
|
||||
verbose_proxy_logger.debug(f"Making request to: {anonymize_url}")
|
||||
anonymize_payload = {
|
||||
"text": "hello world, my name is Jane Doe. My number is: 034453334",
|
||||
"analyzer_results": analyze_results,
|
||||
|
|
@ -88,6 +90,7 @@ class _OPTIONAL_PresidioPIIMasking(CustomLogger):
|
|||
|
||||
new_text = text
|
||||
if redacted_text is not None:
|
||||
verbose_proxy_logger.debug(f"redacted_text: {redacted_text}")
|
||||
for item in redacted_text["items"]:
|
||||
start = item["start"]
|
||||
end = item["end"]
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue