Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

feat log responses in folders

Ishaan Jaffff80e90febd4
diff --git a/litellm/integrations/gcs_bucket.py b/litellm/integrations/gcs_bucket.py
index a16d952861e..46f55f8f01c 100644
--- a/litellm/integrations/gcs_bucket.py
+++ b/litellm/integrations/gcs_bucket.py
@@ -81,7 +81,12 @@ class GCSBucketLogger(CustomLogger):
)
json_logged_payload = json.dumps(logging_payload)
- object_name = response_obj["id"]
+
+ # Get the current date
+ current_date = datetime.now().strftime("%Y-%m-%d")
+
+ # Modify the object_name to include the date-based folder
+ object_name = f"{current_date}/{response_obj['id']}"
response = await self.async_httpx_client.post(
headers=headers,
url=f"https://storage.googleapis.com/upload/storage/v1/b/{self.BUCKET_NAME}/o?uploadType=media&name={object_name}",