Skip to content

[Ai] Add workaround for invalid SafetyRating from the backend. #6925

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

Merged
merged 1 commit into from
May 1, 2025

Conversation

rlazo
Copy link
Collaborator

@rlazo rlazo commented May 1, 2025

Due to a bug in the backend, it's possible that we receive an invalid SafetyRating value, without either category or probability. We return null in those cases to enable filtering by the higher level types.

Due to a bug in the backend, it's possible that we receive an invalid
`SafetyRating` value, without either category or probability. We
return null in those cases to enable filtering by the higher level
types.
Copy link
Contributor

github-actions bot commented May 1, 2025

📝 PRs merging into main branch

Our main branch should always be in a releasable state. If you are working on a larger change, or if you don't want this change to see the light of the day just yet, consider using a feature branch first, and only merge into the main branch when the code complete and ready to be released.

Copy link
Contributor

github-actions bot commented May 1, 2025

Vertex AI Mock Responses Check ⚠️

A newer major version of the mock responses for Vertex AI unit tests is available. update_responses.sh should be updated to clone the latest version of the responses: v11.1

@google-oss-bot
Copy link
Contributor

1 Warning
⚠️ Did you forget to add a changelog entry? (Add the 'no-changelog' label to the PR to silence this warning.)

Generated by 🚫 Danger

@google-oss-bot
Copy link
Contributor

Copy link
Contributor

github-actions bot commented May 1, 2025

Test Results

 22 files   -  18   22 suites   - 18   35s ⏱️ +7s
100 tests  -  84  100 ✅  -  84  0 💤 ±0  0 ❌ ±0 
200 runs   - 168  200 ✅  - 168  0 💤 ±0  0 ❌ ±0 

Results for commit 70cc020. ± Comparison against base commit 4b12b33.

This pull request removes 86 and adds 2 tests. Note that renamed tests count towards both.
com.google.firebase.vertexai.GenerativeModelTesting ‑ exception thrown when using invalid location
com.google.firebase.vertexai.GenerativeModelTesting ‑ system calling in request
com.google.firebase.vertexai.SchemaTests ‑ basic schema declaration
com.google.firebase.vertexai.SchemaTests ‑ full schema declaration
com.google.firebase.vertexai.SerializationTests ‑ test Candidate serialization as Json
com.google.firebase.vertexai.SerializationTests ‑ test GenerateContentResponse serialization as Json
com.google.firebase.vertexai.SerializationTests ‑ test Schema serialization as Json
com.google.firebase.vertexai.SerializationTests ‑ test countTokensResponse serialization as Json
com.google.firebase.vertexai.SerializationTests ‑ test modalityTokenCount serialization as Json
com.google.firebase.vertexai.VertexAIStreamingSnapshotTests ‑ citation parsed correctly
…
com.google.firebase.ai.VertexAIStreamingSnapshotTests ‑ invalid safety ratings during image generation
com.google.firebase.ai.VertexAIUnarySnapshotTests ‑ invalid safety ratings during image generation

@rlazo rlazo enabled auto-merge (squash) May 1, 2025 22:06
@rlazo rlazo merged commit 0a880cc into main May 1, 2025
33 checks passed
@rlazo rlazo deleted the rl.backend.ratings.workaround branch May 1, 2025 22:06
Copy link
Collaborator

@andrewheard andrewheard left a comment

Choose a reason for hiding this comment

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

Thanks! You beat me to it. I'll be doing something very similar in the Swift implementation.

@google-oss-bot
Copy link
Contributor

Size Report 1

Affected Products

  • firebase-ai

    TypeBase (4b12b33)Merge (090723f)Diff
    aar816 kB817 kB+380 B (+0.0%)
    apk (aggressive)1.55 MB1.55 MB+96 B (+0.0%)
    apk (release)9.51 MB9.52 MB+280 B (+0.0%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/iLwcU5xZCR.html

daymxn added a commit that referenced this pull request May 6, 2025
daymxn added a commit that referenced this pull request May 7, 2025
Per [b/414829218](https://b.corp.google.com/issues/414829218),

This ensures the Vertex AI SDK is properly aligned for the upcoming
release. More specifically, this PR does the following:

- Adds deprecation notices for all the public classes and interfaces,
**besides** the root `FirebaseVertexAI` class and the relevant extension
methods.
- Updates the golden file version.
- Adds the change from #6925 for working around invalid
`SafetyRating`(s).
- Adds a changelog entry that aligns with the deprecation notices.
- Adds the changes from #6939 for tracking bidi usage.
- Adds the changes from #6910 for aligning the bidi protos.

---------

Co-authored-by: Rodrigo Lazo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants