From b25ca3255b652a6e1dc123b965ff6d3e813ce7a6 Mon Sep 17 00:00:00 2001 From: Vasilisa Parshikova Date: Wed, 11 Mar 2026 17:20:47 +0400 Subject: [PATCH] (sap) fix after bot review --- litellm/llms/sap/chat/models.py | 2 +- litellm/llms/sap/chat/transformation.py | 1 + litellm/llms/sap/embed/transformation.py | 8 ++++++-- .../llms/sap/embed/test_sap_embed_transformation.py | 4 +--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/litellm/llms/sap/chat/models.py b/litellm/llms/sap/chat/models.py index dace7477d23..7c7ad448686 100644 --- a/litellm/llms/sap/chat/models.py +++ b/litellm/llms/sap/chat/models.py @@ -143,7 +143,7 @@ class GroundingSearchConfig(BaseModel): @model_validator(mode='after') def validate_max_chunk_count_and_max_document_count(self): - if self.max_chunk_count and self.max_document_count: + if self.max_chunk_count is not None and self.max_document_count is not None: raise ValueError("Cannot specify both maxChunkCount and maxDocumentCount.") return self diff --git a/litellm/llms/sap/chat/transformation.py b/litellm/llms/sap/chat/transformation.py index 08b7fb8203a..67b017211b2 100755 --- a/litellm/llms/sap/chat/transformation.py +++ b/litellm/llms/sap/chat/transformation.py @@ -196,6 +196,7 @@ class GenAIHubOrchestrationConfig(OpenAIGPTConfig): litellm_params: dict, headers: dict, ) -> dict: + optional_params = dict(optional_params) optional_params.pop("deployment_url", None) # Filter strict for GPT models only - SAP AI Core doesn't accept it as a model param diff --git a/litellm/llms/sap/embed/transformation.py b/litellm/llms/sap/embed/transformation.py index f6330d0706d..df32d4dc826 100644 --- a/litellm/llms/sap/embed/transformation.py +++ b/litellm/llms/sap/embed/transformation.py @@ -49,8 +49,8 @@ class EmbeddingModel(BaseModel): name: str version: str = "latest" params: dict = Field(default_factory=dict) - timeout: int = Field(default=600, ge=1, le=600) - max_retries: int = Field(default=2, ge=0, le=5) + timeout: Optional[int] = Field(default=None, ge=1, le=600) + max_retries: Optional[int] = Field(default=None, ge=0, le=5) class EmbeddingsModelConfig(BaseModel): model: EmbeddingModel @@ -160,6 +160,10 @@ class GenAIHubEmbeddingConfig(BaseEmbeddingConfig): model_dict["name"] = model model_dict["version"] = optional_params.get("version", "latest") model_dict["params"] = optional_params.get("parameters", {}) + if optional_params.get("timeout", None): + model_dict["timeout"] = optional_params.get("timeout") + if optional_params.get("max_retries", None): + model_dict["max_retries"] = optional_params.get("max_retries") input_dict = {"text": input} if optional_params.get("type"): input_dict["type"] = optional_params.get("type") diff --git a/tests/test_litellm/llms/sap/embed/test_sap_embed_transformation.py b/tests/test_litellm/llms/sap/embed/test_sap_embed_transformation.py index e0931807ae1..bcfe6c47f3b 100644 --- a/tests/test_litellm/llms/sap/embed/test_sap_embed_transformation.py +++ b/tests/test_litellm/llms/sap/embed/test_sap_embed_transformation.py @@ -21,9 +21,7 @@ def test_basic_config_transform(fake_token_creator, fake_deployment_url): 'model': { 'name': 'text-embedding-3-small', 'version': 'latest', - 'params': {}, - 'timeout': 600, - 'max_retries': 2 + 'params': {} } } }