From df15f099f3a19ce76c3fc96d2543079a9fa74e2d Mon Sep 17 00:00:00 2001 From: Tobias Goerke Date: Fri, 25 Sep 2026 14:09:36 +0200 Subject: [PATCH] fix(staan): validate types for max_snippets and min_score in StaanSearchConfig --- litellm/llms/staan/search/transformation.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/litellm/llms/staan/search/transformation.py b/litellm/llms/staan/search/transformation.py index e8a2332cfd7..349b03775e0 100644 --- a/litellm/llms/staan/search/transformation.py +++ b/litellm/llms/staan/search/transformation.py @@ -270,10 +270,12 @@ class StaanSearchConfig(BaseSearchConfig): min_score: Final = optional_params.get("min_score") full_content: Final = optional_params.get("full_content") - if should_fetch_snippets and max_snippets is not None and not 1 <= max_snippets <= 10: - raise ValueError("max_snippets must be between 1 and 10") - if should_fetch_snippets and min_score is not None and not 0 <= min_score <= 1: - raise ValueError("min_score must be between 0 and 1") + if should_fetch_snippets and max_snippets is not None: + if isinstance(max_snippets, bool) or not isinstance(max_snippets, int) or not 1 <= max_snippets <= 10: + raise ValueError("max_snippets must be between 1 and 10") + if should_fetch_snippets and min_score is not None: + if isinstance(min_score, bool) or not isinstance(min_score, (int, float)) or not 0 <= min_score <= 1: + raise ValueError("min_score must be between 0 and 1") enrichment_entries: Final = (("extra_snippets", True),) if should_fetch_snippets else () max_snippet_entry: Final = (