From b761ce9dd17960c9a565327a30e30f6db5909bd9 Mon Sep 17 00:00:00 2001 From: Krrish Dholakia Date: Mon, 1 Jul 2024 17:22:31 -0700 Subject: [PATCH] fix(s3.py): fix s3 path logging on proxy --- docs/my-website/docs/proxy/logging.md | 1 + litellm/integrations/s3.py | 9 +++++++-- litellm/proxy/_new_secret_config.yaml | 10 ++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/docs/my-website/docs/proxy/logging.md b/docs/my-website/docs/proxy/logging.md index f9ed5db3dd..83bf8ee95d 100644 --- a/docs/my-website/docs/proxy/logging.md +++ b/docs/my-website/docs/proxy/logging.md @@ -1188,6 +1188,7 @@ litellm_settings: s3_region_name: us-west-2 # AWS Region Name for S3 s3_aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID # us os.environ/ to pass environment variables. This is AWS Access Key ID for S3 s3_aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY # AWS Secret Access Key for S3 + s3_path: my-test-path # [OPTIONAL] set path in bucket you want to write logs to s3_endpoint_url: https://s3.amazonaws.com # [OPTIONAL] S3 endpoint URL, if you want to use Backblaze/cloudflare s3 buckets ``` diff --git a/litellm/integrations/s3.py b/litellm/integrations/s3.py index 0796d1048b..6e8c4a4e43 100644 --- a/litellm/integrations/s3.py +++ b/litellm/integrations/s3.py @@ -1,10 +1,14 @@ #### What this does #### # On success + failure, log events to Supabase +import datetime import os +import subprocess +import sys import traceback -import datetime, subprocess, sys -import litellm, uuid +import uuid + +import litellm from litellm._logging import print_verbose, verbose_logger @@ -54,6 +58,7 @@ class S3Logger: "s3_aws_session_token" ) s3_config = litellm.s3_callback_params.get("s3_config") + s3_path = litellm.s3_callback_params.get("s3_path") # done reading litellm.s3_callback_params self.bucket_name = s3_bucket_name diff --git a/litellm/proxy/_new_secret_config.yaml b/litellm/proxy/_new_secret_config.yaml index 2693ce3d30..f21a9e832e 100644 --- a/litellm/proxy/_new_secret_config.yaml +++ b/litellm/proxy/_new_secret_config.yaml @@ -2,3 +2,13 @@ model_list: - model_name: "*" # all requests where model not in your config go to this deployment litellm_params: model: "openai/*" + +litellm_settings: + success_callback: ["s3"] + s3_callback_params: + s3_bucket_name: my-test-bucket-22-litellm # AWS Bucket Name for S3 + s3_region_name: us-west-2 # AWS Region Name for S3 + s3_aws_access_key_id: os.environ/AWS_ACCESS_KEY_ID # us os.environ/ to pass environment variables. This is AWS Access Key ID for S3 + s3_aws_secret_access_key: os.environ/AWS_SECRET_ACCESS_KEY # AWS Secret Access Key for S3 + s3_path: my-test-path +