Skip to content

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]

refactor(bedrock_mantle): build supported params without mutation

kerry255ef3bc267b
diff --git a/litellm/llms/bedrock_mantle/chat/transformation.py b/litellm/llms/bedrock_mantle/chat/transformation.py
index 5b69d7aff42..41d93a8dd4d 100644
--- a/litellm/llms/bedrock_mantle/chat/transformation.py
+++ b/litellm/llms/bedrock_mantle/chat/transformation.py
@@ -109,15 +109,22 @@ class BedrockMantleChatConfig(BedrockMantleAuthMixin, OpenAILikeChatConfig):
def get_supported_openai_params(self, model: str) -> list:
base_params: Final = super().get_supported_openai_params(model)
- if is_gpt_reasoning_series_name(model) and "verbosity" not in base_params:
- base_params.append("verbosity")
+ extra_params: Final = tuple(
+ param
+ for param, supported in (
+ ("verbosity", is_gpt_reasoning_series_name(model)),
+ ("reasoning_effort", self._supports_reasoning(model)),
+ )
+ if supported and param not in base_params
+ )
+ return [*base_params, *extra_params]
+
+ def _supports_reasoning(self, model: str) -> bool:
try:
- if litellm.supports_reasoning(model=model, custom_llm_provider=self.custom_llm_provider):
- if "reasoning_effort" not in base_params:
- base_params.append("reasoning_effort")
+ return litellm.supports_reasoning(model=model, custom_llm_provider=self.custom_llm_provider)
except Exception as e:
verbose_logger.debug("BedrockMantleChatConfig: error checking reasoning support: %s", e)
- return base_params
+ return False
def get_model_response_iterator(
self,