Skip to content
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

[Vertex AI] Add HarmBlockMethod enum and method property #13876

Merged
merged 3 commits into from
Oct 14, 2024

Conversation

andrewheard
Copy link
Contributor

@andrewheard andrewheard commented Oct 11, 2024

Added the HarmBlockMethod enum and added the method property to SafetySetting. Verified encoding when both methods are provided, as well as when method is omitted, in the integration test.

Aligned with Android / JS on method being optional with no default value (firebase/firebase-android-sdk#6379 and firebase/firebase-js-sdk#8567).

@andrewheard
Copy link
Contributor Author

andrewheard commented Oct 11, 2024

@rlazo Would you be opposed to changing internal val method: HarmBlockMethod = HarmBlockMethod.PROBABILITY to internal val method: HarmBlockMethod? = null ?

SafetySetting.method is specifically documented as "Optional" in the Vertex AI REST API docs and annotated as (google.api.field_behavior) = OPTIONAL in the proto (the category and threshold are (google.api.field_behavior) = REQUIRED).

@hsubox76 It looks like method is required in the JavaScript SDK -- though not strictly enforced by the TypeScript compiler IIUC.

cc: @cynthiajoan Since I think the Dart implementation is still pending.

On the server side, the Python SDK defaults this to None.

@andrewheard andrewheard marked this pull request as ready for review October 14, 2024 20:24
@andrewheard
Copy link
Contributor Author

cc: @rachelsaunders I linked to the Cloud docs since there isn't anything about HarmBlockMethod in https://firebase.google.com/docs/vertex-ai/safety-settings.

@rachelsaunders
Copy link

https://firebase.google.com/docs/vertex-ai/safety-settings

Thanks for this additional flag. I think this will fall within the scope of the same ticket that I filed in response to the comment thread in the other PR.

@andrewheard andrewheard merged commit 178a522 into main Oct 14, 2024
34 checks passed
@andrewheard andrewheard deleted the ah/vertex-block-method branch October 14, 2024 21:25
MojtabaHs pushed a commit to MojtabaHs/firebase-ios-sdk that referenced this pull request Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants