mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 18:54:30 +00:00
s3 logger - Improve filename to allow easier sorting.
This commit is contained in:
parent
5fc6081b60
commit
cb1990cabc
1 changed files with 14 additions and 3 deletions
|
@ -130,12 +130,22 @@ class S3Logger:
|
|||
|
||||
s3_object_key = (
|
||||
(self.s3_path.rstrip("/") + "/" if self.s3_path else "")
|
||||
+ start_time.strftime('%Y-%m-%d') + "/"
|
||||
+ "time-"
|
||||
+ start_time.strftime('%H-%M-%S-%f')
|
||||
+ "_"
|
||||
+ payload["id"]
|
||||
+ "-time="
|
||||
+ str(start_time)
|
||||
) # we need the s3 key to include the time, so we log cache hits too
|
||||
s3_object_key += ".json"
|
||||
|
||||
s3_object_download_filename = (
|
||||
"time-"
|
||||
+ start_time.strftime('%Y-%m-%dT%H-%M-%S-%f')
|
||||
+ "_"
|
||||
+ payload["id"]
|
||||
+ ".json"
|
||||
)
|
||||
|
||||
import json
|
||||
|
||||
payload = json.dumps(payload)
|
||||
|
@ -148,7 +158,8 @@ class S3Logger:
|
|||
Body=payload,
|
||||
ContentType="application/json",
|
||||
ContentLanguage="en",
|
||||
ContentDisposition=f'inline; filename="{key}.json"',
|
||||
ContentDisposition=f'inline; filename="{s3_object_download_filename}"',
|
||||
CacheControl="private, immutable, max-age=31536000, s-maxage=0",
|
||||
)
|
||||
|
||||
print_verbose(f"Response from s3:{str(response)}")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue