mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
Update s3 cache to support folder
This commit is contained in:
parent
85b5395692
commit
578256a6a2
1 changed files with 4 additions and 1 deletions
|
@ -16,6 +16,7 @@ class S3Logger:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
s3_bucket_name=None,
|
s3_bucket_name=None,
|
||||||
|
s3_path=None,
|
||||||
s3_region_name=None,
|
s3_region_name=None,
|
||||||
s3_api_version=None,
|
s3_api_version=None,
|
||||||
s3_use_ssl=True,
|
s3_use_ssl=True,
|
||||||
|
@ -57,6 +58,7 @@ class S3Logger:
|
||||||
# done reading litellm.s3_callback_params
|
# done reading litellm.s3_callback_params
|
||||||
|
|
||||||
self.bucket_name = s3_bucket_name
|
self.bucket_name = s3_bucket_name
|
||||||
|
self.s3_path = s3_path
|
||||||
# Create an S3 client with custom endpoint URL
|
# Create an S3 client with custom endpoint URL
|
||||||
self.s3_client = boto3.client(
|
self.s3_client = boto3.client(
|
||||||
"s3",
|
"s3",
|
||||||
|
@ -122,8 +124,9 @@ class S3Logger:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
s3_object_key = (
|
s3_object_key = (
|
||||||
|
(self.s3_path.rstrip('/') + '/' if self.s3_path else '') +
|
||||||
payload["id"] + "-time=" + str(start_time)
|
payload["id"] + "-time=" + str(start_time)
|
||||||
) # we need the s3 key to include the time, so we log cache hits too
|
)
|
||||||
|
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue