diff --git a/litellm/llms/sap/chat/models.py b/litellm/llms/sap/chat/models.py index 89a73bfd7cd..c5a430786ef 100644 --- a/litellm/llms/sap/chat/models.py +++ b/litellm/llms/sap/chat/models.py @@ -1,9 +1,8 @@ -from typing import Union, Literal, Optional, Any, Self +from typing import Union, Literal, Optional from enum import Enum import warnings from pydantic import BaseModel, Field, field_validator, model_validator -from pydantic.config import ExtraValues def validate_different_content(v: Union[str, dict, list]) -> str: diff --git a/litellm/llms/sap/chat/transformation.py b/litellm/llms/sap/chat/transformation.py index 8a2e75a8ed3..82cc03cf94d 100755 --- a/litellm/llms/sap/chat/transformation.py +++ b/litellm/llms/sap/chat/transformation.py @@ -211,18 +211,18 @@ class GenAIHubOrchestrationConfig(OpenAIGPTConfig): 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 - # LangChain agents pass strict=true at top level, which fails for GPT models - # Anthropic models accept strict, so preserve it for them - if model.startswith("gpt") and "strict" in optional_params: - optional_params.pop("strict") - def _build_prompt_module( *, model_name: str, template_messages: List[Dict[str, str]], params: dict, ) -> dict: + # Filter strict for GPT models only - SAP AI Core doesn't accept it as a model param + # LangChain agents pass strict=true at top level, which fails for GPT models + # Anthropic models accept strict, so preserve it for them + if model.startswith("gpt") and "strict" in optional_params: + optional_params.pop("strict") + model_version = params.pop("model_version", "latest") tools_ = params.pop("tools", []) diff --git a/litellm/llms/sap/embed/transformation.py b/litellm/llms/sap/embed/transformation.py index 1d1f2ae967d..c74f21c3685 100644 --- a/litellm/llms/sap/embed/transformation.py +++ b/litellm/llms/sap/embed/transformation.py @@ -164,13 +164,16 @@ 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) is not None: - model_dict["timeout"] = optional_params.get("timeout") - if optional_params.get("max_retries", None) is not None: - model_dict["max_retries"] = optional_params.get("max_retries") + timeout = optional_params.get("timeout", None) + if timeout is not None: + model_dict["timeout"] = timeout + max_retries = optional_params.get("max_retries", None) + if max_retries is not None: + model_dict["max_retries"] = max_retries input_dict = {"text": input} - if optional_params.get("type"): - input_dict["type"] = optional_params.get("type") + input_type = optional_params.get("type") + if input_type is not None: + input_dict["type"] = input_type masking = optional_params.get("masking") masking = {"masking": masking} if masking is not None else {} body = {