feat(genkit_vertexai): support Gemini and multimodal embedders#261
feat(genkit_vertexai): support Gemini and multimodal embedders#261CorieW wants to merge 17 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors and expands Vertex AI embedder support by introducing a dedicated embedders.dart module. It adds support for Gemini embedding models (including batch requests), multimodal embeddings, and legacy text embedding models, each with specific request/response handling. A review comment identifies that for text embedding models using the predict endpoint, the task_type field should be moved from the parameters object to the instance object and renamed to task_type (snake_case) for REST API compatibility.
|
the multimodal media-input logic (
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces comprehensive support for Vertex AI embedders, including batch embedding and multimodal capabilities for text, image, and video. It refactors the Vertex AI plugin to use a dedicated embedder module and adds extensive unit tests. Feedback highlights opportunities to improve code robustness by using defensive parsing for API responses and safer URL parsing with Uri.tryParse to avoid potential runtime exceptions.
…s for embedding requests
…frame shape format
Handle Vertex AI embedding models with the correct request shape for Gemini, legacy text embedding, and multimodal embedding APIs. Add fallback behavior for older Gemini models and expand tests around embedder listing, request routing, and mock HTTP responses.
Experienced Problem
Currently, multimodal embedder has a limitation where it can only have one document at one time, due to the following limitation:
Solutions
Implemented Solution
Used metadata property to associate embeddings to documents.
Before these changes, the following things were happening
text-embedding-005- “No input variables specified for this action”.text-multilingual-embedding-002- “No input variables specified for this action”.multimodalembedding@001- Doesn't work.gemini-embedding-001- “No input variables specified for this action”.Testing