mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
(sap) fix after bot review
This commit is contained in:
parent
9bdf6e087f
commit
315f1755e8
4 changed files with 19 additions and 3 deletions
|
|
@ -1,5 +1,6 @@
|
|||
from typing import Union, Literal, Optional
|
||||
from enum import Enum
|
||||
import warnings
|
||||
|
||||
from pydantic import BaseModel, Field, field_validator, model_validator
|
||||
|
||||
|
|
@ -375,6 +376,14 @@ class MaskingModuleConfig(BaseModel):
|
|||
"DEPRECATED: parameter 'masking_providers' will be removed Sept 15, 2026. Use 'providers' instead."
|
||||
)
|
||||
|
||||
if has_masking_providers:
|
||||
warnings.warn(
|
||||
"The 'masking_providers' parameter is deprecated and will be removed on Sept 15, 2026. "
|
||||
"Use 'providers' instead.",
|
||||
DeprecationWarning,
|
||||
stacklevel=2,
|
||||
)
|
||||
|
||||
return self
|
||||
|
||||
|
||||
|
|
@ -660,6 +669,14 @@ class TranslationModuleConfig(BaseModel):
|
|||
input: Optional[SAPDocumentTranslationInput] = None
|
||||
output: Optional[SAPDocumentTranslationOutput] = None
|
||||
|
||||
@model_validator(mode="after")
|
||||
def enforce_min_properties(self) -> "TranslationModuleConfig":
|
||||
if self.input is None and self.output is None:
|
||||
raise ValueError(
|
||||
"TranslationModuleConfig requires at least one of 'input' or 'output'."
|
||||
)
|
||||
return self
|
||||
|
||||
|
||||
class ModuleConfig(BaseModel):
|
||||
prompt_templating: PromptTemplatingModuleConfig
|
||||
|
|
|
|||
|
|
@ -310,7 +310,7 @@ class GenAIHubOrchestrationConfig(OpenAIGPTConfig):
|
|||
request_body = {
|
||||
"config": {
|
||||
"modules": modules_payload,
|
||||
"stream": stream_config,
|
||||
**({"stream": stream_config} if stream_config else {})
|
||||
},
|
||||
**placeholder_values,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ 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):
|
||||
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")
|
||||
|
|
|
|||
|
|
@ -118,7 +118,6 @@ class TestSAPTransformationIntegration:
|
|||
'model': {'name': 'gpt-4o', 'params': {}, 'version': 'latest'}
|
||||
}
|
||||
},
|
||||
'stream': {}
|
||||
}
|
||||
}
|
||||
config = mock_config.transform_request(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue