From 604170e9f8ae1a178d24d36aa374b89defa878ec Mon Sep 17 00:00:00 2001 From: Alexander Barannikov <32936723+japdubengsub@users.noreply.github.com> Date: Wed, 30 Oct 2024 18:56:18 +0000 Subject: [PATCH] NA: Fixing the side effects of the function and printing the correct error message (#518) * fix - print real key name * fix do not change original passed dict --- .../src/opik/evaluation/models/litellm_chat_model.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sdks/python/src/opik/evaluation/models/litellm_chat_model.py b/sdks/python/src/opik/evaluation/models/litellm_chat_model.py index d30e8c0973..aff83f0146 100644 --- a/sdks/python/src/opik/evaluation/models/litellm_chat_model.py +++ b/sdks/python/src/opik/evaluation/models/litellm_chat_model.py @@ -56,14 +56,15 @@ def _check_must_support_arguments(self, args: Optional[List[str]]) -> None: raise ValueError(f"Unsupported parameter: '{key}'!") def _filter_supported_params(self, params: Dict[str, Any]) -> Dict[str, Any]: - valid_params = params + valid_params = {} - for key in params: + for key, value in params.items(): if key not in self.supported_params: LOGGER.debug( - "This model does not support the {key} parameter and it has been ignored." + f"This model does not support the '{key}' parameter and it has been ignored." ) - valid_params.pop(key, None) + else: + valid_params[key] = value return valid_params