(sap) fix after bot review

This commit is contained in:
Vasilisa Parshikova 2026-03-11 17:20:47 +04:00
parent 2a523988d3
commit b25ca3255b
4 changed files with 9 additions and 6 deletions

View file

@ -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

View file

@ -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

View file

@ -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")

View file

@ -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': {}
}
}
}