From 07407b770d691b441da24a26f84f13efbb634ab2 Mon Sep 17 00:00:00 2001 From: XianBW <36835909+XianBW@users.noreply.github.com> Date: Tue, 15 Jul 2025 18:41:18 +0800 Subject: [PATCH] chore: log LITELLM_SETTINGS when first use (#1074) * log LITELLM_SETTINGS when first use * fix ci --- rdagent/oai/backend/litellm.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rdagent/oai/backend/litellm.py b/rdagent/oai/backend/litellm.py index 1f9574bb..03039623 100644 --- a/rdagent/oai/backend/litellm.py +++ b/rdagent/oai/backend/litellm.py @@ -40,15 +40,19 @@ class LiteLLMSettings(LLMSettings): LITELLM_SETTINGS = LiteLLMSettings() -logger.info(f"{LITELLM_SETTINGS}") -logger.log_object(LITELLM_SETTINGS.model_dump(), tag="LITELLM_SETTINGS") ACC_COST = 0.0 class LiteLLMAPIBackend(APIBackend): """LiteLLM implementation of APIBackend interface""" + _has_logged_settings: bool = False + def __init__(self, *args: Any, **kwargs: Any) -> None: + if not self.__class__._has_logged_settings: + logger.info(f"{LITELLM_SETTINGS}") + logger.log_object(LITELLM_SETTINGS.model_dump(), tag="LITELLM_SETTINGS") + self.__class__._has_logged_settings = True super().__init__(*args, **kwargs) def _calculate_token_from_messages(self, messages: list[dict[str, Any]]) -> int: