-
Notifications
You must be signed in to change notification settings - Fork 4k
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
[firebase_vertexai]: embedContent calls result in 404 #13269
Comments
Could this be the |
I'm seeing this exact same issue on macOS. And it's blocking me from doing RAG w/ vertex (even though it works just fine with the gemini SDK). |
A workaround could be (which I'll do) is to implement the embedding in a Firebase function. |
Note that the documentation explicitly states that embedding is not available via Firebase Vertex AI: https://firebase.google.com/docs/vertex-ai/gemini-models#capabilities-features-comparison "Note: Context caching, fine tuning a model, embeddings, and semantic retrieval are supported by various models or the Vertex AI Gemini API, but they're not supported by the Vertex AI in Firebase SDKs." So indeed the only way to go is our own cloud functions. Unless this changes any time in the future this ticket could be converted into a feature request or closed. |
Is there an existing issue for this?
Which plugins are affected?
Other
Which platforms are affected?
Android
Description
I'm trying to obtain emnbeddings for short text content payloads. Neither the
text-embedding-004
(which works with google_generative_ai) nor thetext-multilingual-embedding-002
work, both fail with aFormatException: Unexpected character (at offset 0)
(kinda like #13221) because the JSON interpretation goes side ways due to the return payload beingbodyBytes
length 38[0x3c, 0x68, 0x31, 0x3e, 0x4e, 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x3c, 0x2f, 0x68, 0x31, 0x3e, 0xa, 0x3c, 0x68, 0x32, 0x3e, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x34, 0x30, 0x34, 0x3c, 0x2f, 0x68, 0x32, 0x3e, 0xa]
which UTF decodes to:The interpreter code doesn't care that the HTTP return code is 404 and tries to interpret the first
<
character as a number and then tumbles down the rabbit hole.I tried Firebase Vertex AI, because I'd like to use
text-multilingual-embedding-002
and google_generative_ai only supportstext-embedding-004
google-gemini/generative-ai-dart#209.As far as I see Firebase Vertex AI uses Google AI API under the hood (see
flutterfire/packages/firebase_vertexai/firebase_vertexai/pubspec.yaml
Line 22 in 46b1304
flutterfire/packages/firebase_vertexai/firebase_vertexai/lib/src/vertex_model.dart
Line 75 in 46b1304
I tried to supply
taskType: TaskType.retrievalQuery
with theembedContent
call, however the taskembedContent
in the URL is independent from that, and ultimately I need to find what's the right URL.Google AI API uses
v1beta
in the call URL whereas Firebase Vertex AI usesv2beta
. Not sure if that matters, the domain names are different in the two calls:https://firebaseml.googleapis.com/v2beta/projects/[MY_PROJECT_ID]/locations/us-central1/publishers/google/models/text-embedding-004:embedContent
https://generativelanguage.googleapis.com/v1beta/models/text-embedding-004:embedContent
Reproducing the issue
embedContent
on it.Example:
Firebase Core version
3.4.0
Flutter Version
3.24.1
Relevant Log Output
Flutter dependencies
Expand
Flutter dependencies
snippetAdditional context and comments
There might be other platforms affected besides Android.
The text was updated successfully, but these errors were encountered: