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 Imagen integration tests for GCS and filtering #14403

Merged
merged 1 commit into from
Jan 30, 2025

Conversation

andrewheard
Copy link
Contributor

  • Split Imagen integration tests into a separate file and updated to use Swift Testing.
  • Added a test to validate image generation into GCS.
  • Added a test to validate behaviour when all generated images are filtered out.

#14221
#no-changelog

@andrewheard andrewheard marked this pull request as ready for review January 30, 2025 17:56
@andrewheard andrewheard requested a review from paulb777 January 30, 2025 17:57
#expect(response.images.isEmpty)
let filteredReason = try #require(response.filteredReason)
// 39322892: Detects a person or face when it isn't allowed due to the request safety settings.
#expect(filteredReason.contains("39322892"))
Copy link
Member

Choose a reason for hiding this comment

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

Ugh! such an ugly api

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agreed! Just for reference, the full message (for now) is:

Your request resulted in one or more images that contained people. They are filtered out because you selected the 'Don't allow' option for Person Generation. You can send this request again using the 'Allow (All ages)' or 'Allow (Adults only)' options. See the safety settings documentation for more details. If you think this was an error, send feedback. Support codes: 63236870, 39322892"`.

I figure it will be most reliable to match on the support code since it's less likely to change than the message wording.

Error code Safety category Description Content filtered: prompt input or image output
39322892 People/Face Detects a person or face when it isn't allowed due to the request safety settings. output (image)

The code 63236870 isn't in the docs so I picked 39322892.

@andrewheard andrewheard merged commit 7cbcc47 into vertex-imagen Jan 30, 2025
38 checks passed
@andrewheard andrewheard deleted the ah/vertex-imagen-integration-tests branch January 30, 2025 22:53
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.

2 participants