Repository navigation
feat: rpt client updated to 1.6 - #174
Conversation
alpkom
left a comment
There was a problem hiding this comment.
Could you adjust the RPT mock responses in the tests/mock.py to reflect the API changes?
And maybe adjust the integration_tests as well, in order to make use of the new attributes in the API?
Current tests are failing partly because of the optional vs. required behavior of |
It's not only about fixing tests. We need to adjust the mock to reflect the backend behavior properly. |
|
In the current test environment, there is no such RPT-1.6 deployment, and we need to deploy it for the tests to work |
|
@alpkom Here is my thought process: How do we happy-test if there is only one client (which is 1.6)? For example in case of Since we only have decided to keep only one RPT client (which is fully 1.6 compliant) and want to also preserve 1.0 and 1.5 functionalities, the only way out is to automatically detect what version the current RPT deployment belongs to. Names can be customized, so I don't think pattern-matching on deployment names is a maintainable solution. Does that match to your comments? |
We need to be backward compatible. So, for the newly added optional parameters, don't set the default value at all. Leave them optional, without a default value, so if the parameter is not set, they'll be dropped when the HTTP request is formed. No harm done, since the backend will anyways set the default value. Only reason we set them in SDK was convenience. |
a756f4c to
145dd74
Compare
|
@alpkom I think |
alpkom
left a comment
There was a problem hiding this comment.
In the tests/proxy/native/test_sap_rpt.py, we only have unit tests for the new model response. We need to define mock server tests for that, as well. Take a look at the sap_rpt_mock_response_code_0() function in mock.py, and create a similar one for the new model response, and use that one to introduce new mock server tests in the test_sap_rpt.py.
I've commented in-line about how to fix it. |
|
Perfect, thank you for your comments @alpkom Actually the mock responses now are fully 1.6, I removed all other happy path mock responses for 1.0 and 1.5, and renamed the mock response of 1.6 to |
Yeah, that's right, ignore the relevant comment. I missed that you changed the existing function. |
alpkom
left a comment
There was a problem hiding this comment.
Looks good to me.
Just one minor thing in the in-line comments.
|
@alpkom tests pass again, feel free to review. FYI, now we have a chain of |
5c8c4bb to
659d8a9
Compare
Context
Closes SAP/ai-sdk-python-backlog#17.
What this PR does and why it is needed
This PR aims to upgrade the RPT Client logic on the SDK side for the newest version 1.6, grouped in 6 significant sections:
components.schemas.SchemaFieldConfigfrom spec: We add the missing data types to the dtype field in the currentDataTypecomponents.schemas.PredictionResultfrom spec:confidence_intervalis added into Predictionitem (current implementation). And also, we addminimum/maximumbounds toconfidenceas in 1.6.components.schemas.PredictionConfigfrom spec:explanationsare added to PredictionConfig response, so that it is not silently discarded.context_modeis added to PredictionConfig and ResponseMetadata (1.6 specific issue).components.schemas.TargetColumnConfigfrom spec:top_kis added to TargetColumn. Second of all,prediction_placeholderis casted to be nullable: as of now >=1.5 allowsnullornumericas placeholders, while current model enforcesstr. Corresponding linkcomponents.schemas.{ExplanationConfig / ExplanationResult}models didn't exist before, so they are implemented from scratch.Definition of Done