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]

(code clean up) use a folder for gcs bucket logging + add readme in folder (#6080)

Ishaan Jaff3cb04480fb92
diff --git a/litellm/integrations/gcs_bucket/Readme.md b/litellm/integrations/gcs_bucket/Readme.md
new file mode 100644
index 00000000000..2ab0b23353b
--- /dev/null
+++ b/litellm/integrations/gcs_bucket/Readme.md
@@ -0,0 +1,12 @@
+# GCS (Google Cloud Storage) Bucket Logging on LiteLLM Gateway
+
+This folder contains the GCS Bucket Logging integration for LiteLLM Gateway.
+
+## Folder Structure
+
+- `gcs_bucket.py`: This is the main file that handles failure/success logging to GCS Bucket
+- `gcs_bucket_base.py`: This file contains the GCSBucketBase class which handles Authentication for GCS Buckets
+
+## Further Reading
+- [Doc setting up GCS Bucket Logging on LiteLLM Proxy (Gateway)](https://docs.litellm.ai/docs/proxy/bucket)
+- [Doc on Key / Team Based logging with GCS](https://docs.litellm.ai/docs/proxy/team_logging)
\ No newline at end of file
diff --git a/litellm/integrations/gcs_bucket.py b/litellm/integrations/gcs_bucket/gcs_bucket.py
similarity index 99%
rename from litellm/integrations/gcs_bucket.py
rename to litellm/integrations/gcs_bucket/gcs_bucket.py
index d583506214e..74436145300 100644
--- a/litellm/integrations/gcs_bucket.py
+++ b/litellm/integrations/gcs_bucket/gcs_bucket.py
@@ -11,7 +11,7 @@ from pydantic import BaseModel, Field
import litellm
from litellm._logging import verbose_logger
from litellm.integrations.custom_logger import CustomLogger
-from litellm.integrations.gcs_bucket_base import GCSBucketBase
+from litellm.integrations.gcs_bucket.gcs_bucket_base import GCSBucketBase
from litellm.litellm_core_utils.logging_utils import (
convert_litellm_response_object_to_dict,
)
diff --git a/litellm/integrations/gcs_bucket_base.py b/litellm/integrations/gcs_bucket/gcs_bucket_base.py
similarity index 100%
rename from litellm/integrations/gcs_bucket_base.py
rename to litellm/integrations/gcs_bucket/gcs_bucket_base.py
diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py
index e040bfb4038..3673e6b67cd 100644
--- a/litellm/litellm_core_utils/litellm_logging.py
+++ b/litellm/litellm_core_utils/litellm_logging.py
@@ -65,7 +65,7 @@ from ..integrations.clickhouse import ClickhouseLogger
from ..integrations.datadog.datadog import DataDogLogger
from ..integrations.dynamodb import DyanmoDBLogger
from ..integrations.galileo import GalileoObserve
-from ..integrations.gcs_bucket import GCSBucketLogger
+from ..integrations.gcs_bucket.gcs_bucket import GCSBucketLogger
from ..integrations.greenscale import GreenscaleLogger
from ..integrations.helicone import HeliconeLogger
from ..integrations.lago import LagoLogger
diff --git a/litellm/proxy/common_utils/load_config_utils.py b/litellm/proxy/common_utils/load_config_utils.py
index a3b8098596b..f262837d922 100644
--- a/litellm/proxy/common_utils/load_config_utils.py
+++ b/litellm/proxy/common_utils/load_config_utils.py
@@ -53,9 +53,9 @@ def get_file_contents_from_s3(bucket_name, object_key):
async def get_config_file_contents_from_gcs(bucket_name, object_key):
try:
- from litellm.integrations.gcs_bucket_base import GCSBucketBase
+ from litellm.integrations.gcs_bucket.gcs_bucket import GCSBucketLogger
- gcs_bucket = GCSBucketBase(
+ gcs_bucket = GCSBucketLogger(
bucket_name=bucket_name,
)
file_contents = await gcs_bucket.download_gcs_object(object_key)
diff --git a/litellm/secret_managers/google_secret_manager.py b/litellm/secret_managers/google_secret_manager.py
index 0d0c3100538..7d661555aac 100644
--- a/litellm/secret_managers/google_secret_manager.py
+++ b/litellm/secret_managers/google_secret_manager.py
@@ -5,7 +5,7 @@ from typing import Optional
import litellm
from litellm._logging import verbose_logger
from litellm.caching import InMemoryCache
-from litellm.integrations.gcs_bucket_base import GCSBucketBase
+from litellm.integrations.gcs_bucket.gcs_bucket_base import GCSBucketBase
from litellm.llms.custom_httpx.http_handler import _get_httpx_client
from litellm.proxy._types import CommonProxyErrors, KeyManagementSystem
diff --git a/tests/local_testing/test_gcs_bucket.py b/tests/local_testing/test_gcs_bucket.py
index 711f454590a..67e12559369 100644
--- a/tests/local_testing/test_gcs_bucket.py
+++ b/tests/local_testing/test_gcs_bucket.py
@@ -16,7 +16,10 @@ import pytest
import litellm
from litellm import completion
from litellm._logging import verbose_logger
-from litellm.integrations.gcs_bucket import GCSBucketLogger, StandardLoggingPayload
+from litellm.integrations.gcs_bucket.gcs_bucket import (
+ GCSBucketLogger,
+ StandardLoggingPayload,
+)
from litellm.types.utils import StandardCallbackDynamicParams
verbose_logger.setLevel(logging.DEBUG)