diff --git a/docs/my-website/docs/proxy/team_based_routing.md b/docs/my-website/docs/proxy/team_based_routing.md index ad7e8b977..89b18ec63 100644 --- a/docs/my-website/docs/proxy/team_based_routing.md +++ b/docs/my-website/docs/proxy/team_based_routing.md @@ -71,41 +71,3 @@ curl --location 'http://0.0.0.0:4000/v1/chat/completions' \ }' ``` -## Team Based Logging - -[👉 Tutorial - Allow each team to use their own Langfuse Project / custom callbacks](team_logging.md) - - - - diff --git a/docs/my-website/docs/proxy/team_logging.md b/docs/my-website/docs/proxy/team_logging.md index bc9f19f5b..1cc91c2df 100644 --- a/docs/my-website/docs/proxy/team_logging.md +++ b/docs/my-website/docs/proxy/team_logging.md @@ -2,7 +2,7 @@ import Image from '@theme/IdealImage'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; -# 👥📊 [BETA] Team Based Logging +# 👥📊 Team Based Logging Allow each team to use their own Langfuse Project / custom callbacks @@ -13,6 +13,46 @@ Team 2 -> Logs to Langfuse Project 2 Team 3 -> Disabled Logging (for GDPR compliance) ``` + +## Team Based Logging + +[👉 Tutorial - Allow each team to use their own Langfuse Project / custom callbacks](team_logging.md) + + +## Logging / Caching + +Turn on/off logging and caching for a specific team id. + +**Example:** + +This config would send langfuse logs to 2 different langfuse projects, based on the team id + +```yaml +litellm_settings: + default_team_settings: + - team_id: my-secret-project + success_callback: ["langfuse"] + langfuse_public_key: os.environ/LANGFUSE_PUB_KEY_1 # Project 1 + langfuse_secret: os.environ/LANGFUSE_PRIVATE_KEY_1 # Project 1 + - team_id: ishaans-secret-project + success_callback: ["langfuse"] + langfuse_public_key: os.environ/LANGFUSE_PUB_KEY_2 # Project 2 + langfuse_secret: os.environ/LANGFUSE_SECRET_2 # Project 2 +``` + +Now, when you [generate keys](./virtual_keys.md) for this team-id + +```bash +curl -X POST 'http://0.0.0.0:4000/key/generate' \ +-H 'Authorization: Bearer sk-1234' \ +-H 'Content-Type: application/json' \ +-d '{"team_id": "ishaans-secret-project"}' +``` + +All requests made with these keys will log data to their team-specific logging. --> + +## [BETA] Team Logging via API + :::info ✨ This is an Enterprise only feature [Get Started with Enterprise here](https://calendly.com/d/4mp-gd3-k5k/litellm-1-1-onboarding-chat) @@ -20,9 +60,9 @@ Team 3 -> Disabled Logging (for GDPR compliance) ::: -## Set Callbacks Per Team +### Set Callbacks Per Team -### 1. Set callback for team +#### 1. Set callback for team We make a request to `POST /team/{team_id}/callback` to add a callback for @@ -42,7 +82,7 @@ curl -X POST 'http:/localhost:4000/team/dbe2f686-a686-4896-864a-4c3924458709/cal }' ``` -#### Supported Values +##### Supported Values | Field | Supported Values | Notes | |-------|------------------|-------| @@ -53,7 +93,7 @@ curl -X POST 'http:/localhost:4000/team/dbe2f686-a686-4896-864a-4c3924458709/cal |     `langfuse_secret_key` | string | Required | |     `langfuse_host` | string | Optional (defaults to https://cloud.langfuse.com) | -### 2. Create key for team +#### 2. Create key for team All keys created for team `dbe2f686-a686-4896-864a-4c3924458709` will log to langfuse project specified on [Step 1. Set callback for team](#1-set-callback-for-team) @@ -68,7 +108,7 @@ curl --location 'http://0.0.0.0:4000/key/generate' \ ``` -### 3. Make `/chat/completion` request for team +#### 3. Make `/chat/completion` request for team ```shell curl -i http://localhost:4000/v1/chat/completions \ @@ -85,7 +125,7 @@ curl -i http://localhost:4000/v1/chat/completions \ Expect this to be logged on the langfuse project specified on [Step 1. Set callback for team](#1-set-callback-for-team) -## Disable Logging for a Team +### Disable Logging for a Team To disable logging for a specific team, you can use the following endpoint: @@ -93,7 +133,7 @@ To disable logging for a specific team, you can use the following endpoint: This endpoint removes all success and failure callbacks for the specified team, effectively disabling logging. -### Step 1. Disable logging for team +#### Step 1. Disable logging for team ```shell curl -X POST 'http://localhost:4000/team/YOUR_TEAM_ID/disable_logging' \ @@ -115,7 +155,7 @@ A successful request will return a response similar to this: } ``` -### Step 2. Test it - `/chat/completions` +#### Step 2. Test it - `/chat/completions` Use a key generated for team = `team_id` - you should see no logs on your configured success callback (eg. Langfuse) @@ -131,7 +171,7 @@ curl -i http://localhost:4000/v1/chat/completions \ }' ``` -### Debugging / Troubleshooting +#### Debugging / Troubleshooting - Check active callbacks for team using `GET /team/{team_id}/callback` @@ -142,7 +182,7 @@ curl -X GET 'http://localhost:4000/team/dbe2f686-a686-4896-864a-4c3924458709/cal -H 'Authorization: Bearer sk-1234' ``` -## Team Logging Endpoints +### Team Logging Endpoints - [`POST /team/{team_id}/callback` Add a success/failure callback to a team](https://litellm-api.up.railway.app/#/team%20management/add_team_callbacks_team__team_id__callback_post) - [`GET /team/{team_id}/callback` - Get the success/failure callbacks and variables for a team](https://litellm-api.up.railway.app/#/team%20management/get_team_callbacks_team__team_id__callback_get)