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 URI-based file data support #12886

Merged
merged 2 commits into from
May 2, 2024

Conversation

andrewheard
Copy link
Contributor

@andrewheard andrewheard commented May 2, 2024

Added support for URI-based file data (in addition to existing support for data as inline bytes). Files may be uploaded using the Firebase Storage SDK.

Example Usage:

// Obtain a reference to the file in Firebase Storage.
let reference = Storage.storage().reference(withPath: "/image.jpg")
let imagePart = ModelContent.Part.fileData(
  mimetype: "image/jpeg",
  // Construct a gs:// URI from the bucket name and full path
  uri: "gs://\(reference.bucket)/\(reference.fullPath)"
)

#no-changelog

@andrewheard andrewheard requested a review from paulb777 May 2, 2024 14:54
Copy link
Member

@paulb777 paulb777 left a comment

Choose a reason for hiding this comment

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

Tests?

@andrewheard
Copy link
Contributor Author

Tests?

@paulb777 The real test is whether the backend accepts it but I added an encoding test to make it easier to visually inspect the JSON representation (since we have custom Encodable conformance it'd be easy to miss something). Also added a simple API test.

@andrewheard andrewheard merged commit c88763e into release-10.26 May 2, 2024
42 checks passed
@andrewheard andrewheard deleted the ah/vertex-ai-storage branch May 2, 2024 18:28
@firebase firebase locked and limited conversation to collaborators Jun 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants