-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Refactor builder pattern in VertexAiGeminiSafetySetting #3326
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Refactor builder pattern in VertexAiGeminiSafetySetting #3326
Conversation
Signed-off-by: jay <[email protected]>
4533c0c
to
0e1a536
Compare
Boss, would really appreciate it if you could take a quick look at this PR 🫡 |
Signed-off-by: jay <[email protected]>
84e6164
to
3f96019
Compare
Boss, I’ve fixed the formatting issues using spring-javaformat:apply. |
@mjkhub Thanks for the PR using the builder! |
this.category = HarmCategory.HARM_CATEGORY_UNSPECIFIED; | ||
this.threshold = HarmBlockThreshold.HARM_BLOCK_THRESHOLD_UNSPECIFIED; | ||
this.method = HarmBlockMethod.HARM_BLOCK_METHOD_UNSPECIFIED; | ||
private VertexAiGeminiSafetySetting(Builder builder) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are changing the public accessor of this constructor to private, we need to deprecate this constructor by keeping this change. The deprecated method can further be removed right after 1.1.0 release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The ctor should not accept a builder, the builder should be calling the private ctor that contains the full argument list
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated the code to use the full-argument constructor as you mentioned 🫡
As for deprecating the public constructor, I tried to add the annotation, but since the new one has the exact same parameters, it's not actually possible to keep both.
Since this class is currently only used in test code, I believe it’s safe to make this change without introducing any issues.
Signed-off-by: jay <[email protected]>
Hey boss, I noticed a small part that could be cleaned up to better align with the builder pattern.
It’s not a big change, but I thought it might be helpful—please take a look when you have a chance.
Thanks 👍