From fb092107f5e42e1ae2199cd33fce95e7e5a02ca2 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Fri, 28 Aug 2026 15:47:10 +0000 Subject: [PATCH] refactor(bedrock): drop default encoding_format without mutating params dict Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/utils.py | 4 ++-- tests/test_litellm/test_utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/litellm/utils.py b/litellm/utils.py index a8360950963..a8431233549 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -3545,14 +3545,14 @@ def get_optional_params_embeddings( else: # unmapped model supported_params = [] if non_default_params.get("encoding_format") == "float": - non_default_params.pop("encoding_format") + non_default_params = {k: v for k, v in non_default_params.items() if k != "encoding_format"} _check_valid_arg(supported_params=supported_params) final_params = {**kwargs} return final_params supported_params = object.get_supported_openai_params() if non_default_params.get("encoding_format") == "float" and "encoding_format" not in supported_params: - non_default_params.pop("encoding_format") + non_default_params = {k: v for k, v in non_default_params.items() if k != "encoding_format"} _check_valid_arg(supported_params=supported_params) optional_params = object.map_openai_params(non_default_params=non_default_params, optional_params={}) elif custom_llm_provider == "mistral": diff --git a/tests/test_litellm/test_utils.py b/tests/test_litellm/test_utils.py index aa03727aa86..ebcf3756eda 100644 --- a/tests/test_litellm/test_utils.py +++ b/tests/test_litellm/test_utils.py @@ -4426,7 +4426,7 @@ class TestBedrockEmbeddingDefaultEncodingFormat: "some-unmapped-bedrock-model", ], ) - def test_encoding_format_float_is_dropped(self, model): + def test_encoding_format_float_is_dropped(self, model: str): optional_params = litellm.utils.get_optional_params_embeddings( model=model, encoding_format="float",