From 1bd5b6339f8bb35c369a4093df0d8cf900c6ce24 Mon Sep 17 00:00:00 2001 From: Vasilisa Parshikova Date: Wed, 11 Mar 2026 18:48:45 +0400 Subject: [PATCH] (sap) fix after bot review --- litellm/llms/sap/chat/transformation.py | 4 ++-- litellm/llms/sap/embed/transformation.py | 4 ++-- .../llms/sap/embed/test_sap_embed_transformation.py | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/litellm/llms/sap/chat/transformation.py b/litellm/llms/sap/chat/transformation.py index 2ba6537242e..26f4fd28ae9 100755 --- a/litellm/llms/sap/chat/transformation.py +++ b/litellm/llms/sap/chat/transformation.py @@ -34,7 +34,7 @@ from .models import ResponseFormatJSONSchema, ResponseFormat, OrchestrationReque from .handler import GenAIHubOrchestrationError, AsyncSAPStreamIterator, SAPStreamIterator def validate_dict(data: dict, model) -> dict: - return model(**data).model_dump(by_alias=True, exclude_none=True) + return model(**data).model_dump(by_alias=True, exclude_unset=True) class GenAIHubOrchestrationConfig(OpenAIGPTConfig): @@ -240,7 +240,7 @@ class GenAIHubOrchestrationConfig(OpenAIGPTConfig): optional_modules = {} optional_modules_lst = ["grounding", "masking", "filtering", "translation"] for module in optional_modules_lst: - if params.get(module, None) is None: + if params.get(module, None) is not None: optional_modules[module] = params.pop(module) return { diff --git a/litellm/llms/sap/embed/transformation.py b/litellm/llms/sap/embed/transformation.py index 4583531402b..018e8282203 100644 --- a/litellm/llms/sap/embed/transformation.py +++ b/litellm/llms/sap/embed/transformation.py @@ -62,7 +62,7 @@ class EmbeddingsModules(BaseModel): class EmbeddingInput(BaseModel): text: Union[str, List[str]] - type: Literal["text", "document", "query"] = "text" + type: Optional[Literal["text", "document", "query"]] = None class EmbeddingConfig(BaseModel): modules: EmbeddingsModules @@ -73,7 +73,7 @@ class EmbeddingRequest(BaseModel): def validate_dict(data: dict, model) -> dict: - return model(**data).model_dump(exclude_none=True, by_alias=True) + return model(**data).model_dump(exclude_unset=True, by_alias=True) class GenAIHubEmbeddingConfig(BaseEmbeddingConfig): 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 bcfe6c47f3b..3c6236d5503 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 @@ -27,8 +27,7 @@ def test_basic_config_transform(fake_token_creator, fake_deployment_url): } }, 'input': { - 'text': 'Hi', - 'type': 'text' + 'text': 'Hi' } } with patch(