mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-10 03:28:53 +00:00
fix: fix stop param indentation, remove continue, add noqa PLR0915
This commit is contained in:
parent
397877720b
commit
81d8fd4707
1 changed files with 10 additions and 12 deletions
|
|
@ -875,7 +875,7 @@ class AmazonConverseConfig(BaseConfig):
|
|||
optional_params: dict,
|
||||
model: str,
|
||||
drop_params: bool,
|
||||
) -> dict:
|
||||
) -> dict: # noqa: PLR0915
|
||||
is_thinking_enabled = self.is_thinking_enabled(non_default_params)
|
||||
|
||||
for param, value in non_default_params.items():
|
||||
|
|
@ -891,17 +891,15 @@ class AmazonConverseConfig(BaseConfig):
|
|||
optional_params["maxTokens"] = value
|
||||
if param == "stream":
|
||||
optional_params["stream"] = value
|
||||
if param == "stop":
|
||||
if isinstance(value, str):
|
||||
if len(value) == 0: # converse raises error for empty strings
|
||||
continue
|
||||
value = [value]
|
||||
elif isinstance(value, list):
|
||||
# Filter out empty strings from list (Bedrock rejects them)
|
||||
value = [v for v in value if isinstance(v, str) and len(v) > 0]
|
||||
if not value: # Skip if empty list or all empty strings
|
||||
continue
|
||||
optional_params["stopSequences"] = value
|
||||
if param == "stop":
|
||||
if isinstance(value, str):
|
||||
if len(value) > 0: # skip empty strings (converse rejects them)
|
||||
optional_params["stopSequences"] = [value]
|
||||
elif isinstance(value, list):
|
||||
# Filter out empty strings from list (Bedrock rejects them)
|
||||
filtered = [v for v in value if isinstance(v, str) and len(v) > 0]
|
||||
if filtered: # only set if non-empty after filtering
|
||||
optional_params["stopSequences"] = filtered
|
||||
if param == "temperature":
|
||||
optional_params["temperature"] = value
|
||||
if param == "top_p":
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue