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

[Go] support sending images to googleai/vertexai #322

Merged
merged 2 commits into from
Jun 4, 2024
Merged

Conversation

ianlancetaylor
Copy link
Contributor

The googleai and vertexai API support gs URIs or raw image bytes. The genkit flow doesn't permit raw bytes, so use base64 encoding of data URIs as the TypeScript code does.

This revealed that the JSON validation code didn't support Part correctly, as the JSON marshaling didn't match the type as seen by the JSON reflection code. Fortunately the JSON reflection package makes it easy to specify a different schema to use for any type.

Somehow menu.jpeg was submitted as an empty file, so fix that.

Description here...

Checklist (if applicable):

  • Tested (manually, unit tested, etc.)
  • Changelog updated
  • Docs updated

The googleai and vertexai API support gs URIs or raw image bytes.
The genkit flow doesn't permit raw bytes, so use base64 encoding
of data URIs as the TypeScript code does.

This revealed that the JSON validation code didn't support Part
correctly, as the JSON marshaling didn't match the type as seen
by the JSON reflection code. Fortunately the JSON reflection package
makes it easy to specify a different schema to use for any type.

Somehow menu.jpeg was submitted as an empty file, so fix that.
Copy link
Contributor

@jba jba left a comment

Choose a reason for hiding this comment

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

Thanks for figuring this out.

go/plugins/vertexai/vertexai.go Outdated Show resolved Hide resolved
@ianlancetaylor ianlancetaylor merged commit 4dd69e5 into main Jun 4, 2024
5 checks passed
@ianlancetaylor ianlancetaylor deleted the iant branch June 4, 2024 17:46
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.

2 participants