(sap) fix after bot review

This commit is contained in:
Vasilisa Parshikova 2026-03-11 18:48:45 +04:00 • committed by Sameer Kankute
parent 3a9610fcf8
commit 1bd5b6339f
No known key found for this signature in database
3 changed files with 5 additions and 6 deletions

View file

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

View file

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

View file

@ -27,8 +27,7 @@ def test_basic_config_transform(fake_token_creator, fake_deployment_url):
}
},
'input': {
'text': 'Hi',
'type': 'text'
'text': 'Hi'
}
}
with patch(