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]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
(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.mdnew file mode 100644index 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 filediff --git a/litellm/integrations/gcs_bucket.py b/litellm/integrations/gcs_bucket/gcs_bucket.pysimilarity index 99%rename from litellm/integrations/gcs_bucket.pyrename to litellm/integrations/gcs_bucket/gcs_bucket.pyindex 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, Fieldimport litellmfrom litellm._logging import verbose_loggerfrom litellm.integrations.custom_logger import CustomLogger-from litellm.integrations.gcs_bucket_base import GCSBucketBase+from litellm.integrations.gcs_bucket.gcs_bucket_base import GCSBucketBasefrom 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.pysimilarity index 100%rename from litellm/integrations/gcs_bucket_base.pyrename to litellm/integrations/gcs_bucket/gcs_bucket_base.pydiff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.pyindex 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 ClickhouseLoggerfrom ..integrations.datadog.datadog import DataDogLoggerfrom ..integrations.dynamodb import DyanmoDBLoggerfrom ..integrations.galileo import GalileoObserve-from ..integrations.gcs_bucket import GCSBucketLogger+from ..integrations.gcs_bucket.gcs_bucket import GCSBucketLoggerfrom ..integrations.greenscale import GreenscaleLoggerfrom ..integrations.helicone import HeliconeLoggerfrom ..integrations.lago import LagoLoggerdiff --git a/litellm/proxy/common_utils/load_config_utils.py b/litellm/proxy/common_utils/load_config_utils.pyindex 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.pyindex 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 Optionalimport litellmfrom litellm._logging import verbose_loggerfrom litellm.caching import InMemoryCache-from litellm.integrations.gcs_bucket_base import GCSBucketBase+from litellm.integrations.gcs_bucket.gcs_bucket_base import GCSBucketBasefrom litellm.llms.custom_httpx.http_handler import _get_httpx_clientfrom litellm.proxy._types import CommonProxyErrors, KeyManagementSystemdiff --git a/tests/local_testing/test_gcs_bucket.py b/tests/local_testing/test_gcs_bucket.pyindex 711f454590a..67e12559369 100644--- a/tests/local_testing/test_gcs_bucket.py+++ b/tests/local_testing/test_gcs_bucket.py@@ -16,7 +16,10 @@ import pytestimport litellmfrom litellm import completionfrom 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 StandardCallbackDynamicParamsverbose_logger.setLevel(logging.DEBUG)