Skip to content

feat: rpt client updated to 1.6 - #174

Merged
yamaceay merged 20 commits into
mainfrom
upgrade-rpt-clients
Oct 15, 2026
Merged

yamaceay merged 20 commits into
mainfrom
upgrade-rpt-clients

Conversation

@yamaceay

@yamaceay yamaceay commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

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:

  1. components.schemas.SchemaFieldConfig from spec: We add the missing data types to the dtype field in the current DataType
  2. components.schemas.PredictionResult from spec: confidence_interval is added into Predictionitem (current implementation). And also, we add minimum / maximum bounds to confidence as in 1.6.
  3. components.schemas.PredictionConfig from spec: explanations are added to PredictionConfig response, so that it is not silently discarded.
  4. context_mode is added to PredictionConfig and ResponseMetadata (1.6 specific issue).
  5. components.schemas.TargetColumnConfig from spec: top_k is added to TargetColumn. Second of all, prediction_placeholder is casted to be nullable: as of now >=1.5 allows null or numeric as placeholders, while current model enforces str. Corresponding link
  6. components.schemas.{ExplanationConfig / ExplanationResult} models didn't exist before, so they are implemented from scratch.

Definition of Done

  • Code is tested (Unit, Integration, E2E)
  • Error handling created / updated & covered by the tests above
  • Documentation updated
    • Only Public APIs are allowed to be used in documentation/tutorials/sample code
  • (Optional) Aligned changes with the JS/TS and Java SDK
  • (Optional) Release notes updated -->

@yamaceay yamaceay changed the title rpt client updated to 1.6 feat: rpt client updated to 1.6 Oct 2, 2026

@alpkom alpkom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@yamaceay

yamaceay commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

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 prediction_payload, fixing it now

@alpkom

alpkom commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

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 prediction_payload, fixing it now

It's not only about fixing tests. We need to adjust the mock to reflect the backend behavior properly.
And we need to adjust/extend the integration tests to test the new features/attributes in the API, as well.

@yamaceay
yamaceay requested a review from alpkom October 2, 2026 09:44
@yamaceay

yamaceay commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

In the current test environment, there is no such RPT-1.6 deployment, and we need to deploy it for the tests to work

Comment thread packages/gen/gen_ai_hub/proxy/native/sap/models.py Outdated
Comment thread packages/gen/integration_tests/constants.py Outdated
Comment thread packages/gen/integration_tests/native_clients/test_sap_rpt.py Outdated
Comment thread packages/gen/tests/mock.py Outdated
Comment thread sample-code/sample_code/sap_rpt.py Outdated
Comment thread packages/gen/tests/proxy/native/test_sap_rpt.py Outdated
Comment thread packages/gen/tests/proxy/native/test_sap_rpt.py Outdated
Comment thread packages/gen/tests/proxy/native/test_sap_rpt.py Outdated
Comment thread packages/gen/tests/proxy/native/test_sap_rpt.py Outdated
Comment thread packages/gen/tests/proxy/native/test_sap_rpt.py Outdated
@yamaceay

yamaceay commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

@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 PredictionConfig, 1.0 models only have target_columns, 1.5 introduces explanations and 1.6 introduces further context_mode. If we for example allow context_mode to have default values that makes the 1.0 and 1.5 happy, we detach from 1.6 spec. If we solely stick on context_mode being a required parameter, then 1.0 and 1.5 calls will not work.

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?

@yamaceay
yamaceay requested a review from alpkom October 5, 2026 11:02

@mwien mwien left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall, just a few small additional comments

Comment thread packages/gen/integration_tests/constants.py Outdated
Comment thread packages/gen/gen_ai_hub/proxy/native/sap/models.py Outdated
Comment thread packages/gen/gen_ai_hub/proxy/native/sap/models.py Outdated
Comment thread sample-code/README.md Outdated
@yamaceay
yamaceay requested a review from mwien October 6, 2026 10:24
@alpkom

alpkom commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

@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 PredictionConfig, 1.0 models only have target_columns, 1.5 introduces explanations and 1.6 introduces further context_mode. If we for example allow context_mode to have default values that makes the 1.0 and 1.5 happy, we detach from 1.6 spec. If we solely stick on context_mode being a required parameter, then 1.0 and 1.5 calls will not work.

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.
When we handle it this way, we won't need to discover the model version at all.

Comment thread packages/gen/tests/proxy/native/test_sap_rpt.py Outdated
@yamaceay
yamaceay requested a review from alpkom October 7, 2026 10:33
Comment thread packages/gen/tests/proxy/native/test_sap_rpt.py
Comment thread packages/gen/tests/proxy/native/test_sap_rpt.py Outdated
@yamaceay
yamaceay force-pushed the upgrade-rpt-clients branch from a756f4c to 145dd74 Compare October 7, 2026 17:51
@yamaceay

yamaceay commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

@alpkom I think sap-rpt-1.5 needs to be deployed for the tests to pass

@alpkom alpkom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread packages/gen/tests/proxy/native/test_sap_rpt.py
Comment thread packages/gen/integration_tests/setup_aicore.py
@alpkom

alpkom commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

@alpkom I think sap-rpt-1.5 needs to be deployed for the tests to pass

I've commented in-line about how to fix it.

@yamaceay

yamaceay commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

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 sap_rpt_mock_response_code_0 to keep it overall more consistent with the rest of the code. If I didn't misunderstood, you thought this function is still 1.0 rather than 1.6. Let me know if that is not the case

@alpkom

alpkom commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

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 sap_rpt_mock_response_code_0 to keep it overall more consistent with the rest of the code. If I didn't misunderstood, you thought this function is still 1.0 rather than 1.6. Let me know if that is not the case

Yeah, that's right, ignore the relevant comment. I missed that you changed the existing function.

@alpkom alpkom left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.
Just one minor thing in the in-line comments.

Comment thread packages/gen/integration_tests/native_clients/test_sap_rpt.py
@yamaceay

Copy link
Copy Markdown
Contributor Author

@alpkom tests pass again, feel free to review. FYI, now we have a chain of model_dumps until TargetColumn, and the prediction_placeholder is not excluded anymore, while other attributes are excluded if None set.

Comment thread packages/gen/gen_ai_hub/proxy/native/sap/models.py Outdated
Comment thread packages/gen/gen_ai_hub/proxy/native/sap/models.py Outdated
Comment thread packages/gen/gen_ai_hub/proxy/native/sap/models.py Outdated
@yamaceay
yamaceay force-pushed the upgrade-rpt-clients branch from 5c8c4bb to 659d8a9 Compare October 14, 2026 08:36
@yamaceay
yamaceay requested a review from alpkom October 14, 2026 09:12
@yamaceay
yamaceay enabled auto-merge (squash) October 15, 2026 08:43
@yamaceay
yamaceay merged commit 306de34 into main Oct 15, 2026
15 checks passed
@yamaceay
yamaceay deleted the upgrade-rpt-clients branch October 15, 2026 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants