Skip to content

Commit 011b71b

Browse files
fix(bedrock): guard effort key access in normalize_bedrock_opus_output_config_effort
Defensively check that 'effort' is a valid key in _BEDROCK_OUTPUT_CONFIG_EFFORT_ORDER before indexing, to prevent a KeyError if the hardcoded guard tuple ever drifts from the order dict's keys. Co-authored-by: Yassin Kortam <[email protected]>
1 parent ceb727f commit 011b71b

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

litellm/llms/bedrock/common_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,10 @@ def normalize_bedrock_opus_output_config_effort(model: str, output_config: Any)
701701
return
702702

703703
effort = output_config.get("effort")
704-
if effort not in ("xhigh", "max"):
704+
if (
705+
effort not in ("xhigh", "max")
706+
or effort not in _BEDROCK_OUTPUT_CONFIG_EFFORT_ORDER
707+
):
705708
return
706709

707710
ceiling = _get_bedrock_output_config_effort_ceiling(model)

0 commit comments

Comments
 (0)