From 6c899ced28b298677b3c92f8f78876c0ff6d9ed0 Mon Sep 17 00:00:00 2001 From: Ishaan Jaff Date: Thu, 1 Aug 2024 15:25:19 -0700 Subject: [PATCH] init gcs using gcs_bucket --- litellm/__init__.py | 1 + litellm/litellm_core_utils/litellm_logging.py | 13 +++++++++++++ litellm/proxy/proxy_config.yaml | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/litellm/__init__.py b/litellm/__init__.py index cc03867cf..0bbccf827 100644 --- a/litellm/__init__.py +++ b/litellm/__init__.py @@ -46,6 +46,7 @@ _custom_logger_compatible_callbacks_literal = Literal[ "galileo", "braintrust", "arize", + "gcs_bucket", ] _known_custom_logger_compatible_callbacks: List = list( get_args(_custom_logger_compatible_callbacks_literal) diff --git a/litellm/litellm_core_utils/litellm_logging.py b/litellm/litellm_core_utils/litellm_logging.py index 868c4a7c2..0f1378f4b 100644 --- a/litellm/litellm_core_utils/litellm_logging.py +++ b/litellm/litellm_core_utils/litellm_logging.py @@ -61,6 +61,7 @@ from ..integrations.custom_logger import CustomLogger from ..integrations.datadog import DataDogLogger from ..integrations.dynamodb import DyanmoDBLogger from ..integrations.galileo import GalileoObserve +from ..integrations.gcs_bucket import GCSBucketLogger from ..integrations.greenscale import GreenscaleLogger from ..integrations.helicone import HeliconeLogger from ..integrations.lago import LagoLogger @@ -2014,6 +2015,14 @@ def _init_custom_logger_compatible_class( _langsmith_logger = LangsmithLogger() _in_memory_loggers.append(_langsmith_logger) return _langsmith_logger # type: ignore + elif logging_integration == "gcs_bucket": + for callback in _in_memory_loggers: + if isinstance(callback, GCSBucketLogger): + return callback # type: ignore + + _gcs_bucket_logger = GCSBucketLogger() + _in_memory_loggers.append(_gcs_bucket_logger) + return _gcs_bucket_logger # type: ignore elif logging_integration == "arize": if "ARIZE_SPACE_KEY" not in os.environ: raise ValueError("ARIZE_SPACE_KEY not found in environment variables") @@ -2128,6 +2137,10 @@ def get_custom_logger_compatible_class( for callback in _in_memory_loggers: if isinstance(callback, LangsmithLogger): return callback + elif logging_integration == "gcs_bucket": + for callback in _in_memory_loggers: + if isinstance(callback, GCSBucketLogger): + return callback elif logging_integration == "otel": from litellm.integrations.opentelemetry import OpenTelemetry diff --git a/litellm/proxy/proxy_config.yaml b/litellm/proxy/proxy_config.yaml index b78832a10..4bc9a8769 100644 --- a/litellm/proxy/proxy_config.yaml +++ b/litellm/proxy/proxy_config.yaml @@ -55,4 +55,4 @@ general_settings: max_response_size_mb: 10 litellm_settings: - success_callback: ["langfuse"] \ No newline at end of file + callbacks: ["gcs_bucket"] # 👈 KEY CHANGE \ No newline at end of file