Add multimodal embedding support for VertexAI (Phase 1)#590
Add multimodal embedding support for VertexAI (Phase 1)#590Ndunge-Makau wants to merge 22 commits into
Conversation
Multimodal embeddings
Fix dimension argument to allow embedding of any size
Add the multimodalembedding model by VertexAI
…dal-embeddings Add with parameter to multimodal embeddings
…dal-embeddings Edit README.md
| modalities: Capabilities.modalities_for(model_id), | ||
| capabilities: Capabilities.capabilities_for(model_id), | ||
| pricing: Capabilities.pricing_for(model_id), | ||
| metadata: Capabilities.determine_metadata(model_id) |
crmne
left a comment
There was a problem hiding this comment.
Thanks for the contribution.
My preference is multimodal embeddings for all providers that support them, not only Vertex AI. The issue/PR scope sounded provider-wide, which is why I approved it.
If you want to ship Vertex-only, please make that explicit in both issue and PR (title + description) as "phase 1: Vertex AI only," and add follow-up issues for other providers.
Please confirm direction before I do line-by-line review:
- multi-provider in this PR, or
- explicit Vertex-only phase 1.
Also please fix:
- potential regression in Vertex text embeddings
- unrelated
models.jsonchurn
|
Hi @crmne, Thanks for the feedback. I'd like to confirm that this PR is explicitly for Vertex AI only as phase 1, and I'll create follow-up issues for other providers. I've also fixed the regression issue in Vertex text embeddings. Regarding the |
crmne
left a comment
There was a problem hiding this comment.
Thanks for working on this. I think the direction is useful, but this needs rework before we can merge it.
Main blockers:
-
The branch conflicts with current
maininlib/ruby_llm/embedding.rb,lib/ruby_llm/provider.rb, andlib/ruby_llm/models.json. -
lib/ruby_llm/providers/vertexai/embeddings.rbusespresent?, but RubyLLM does not load ActiveSupport at runtime. The specs pass becausespec_helperrequiresactive_support/core_ext, but plain runtime usage fails withNoMethodError. -
The PR changes existing Vertex text embedding payloads from
content/outputDimensionalitytotext/dimension. That looks correct for the multimodal embedding API, but it likely regresses existing Vertex text embedding models liketext-embedding-004. -
Image
gs://...inputs should be sent asimage.gcsUri; currently only video GCS URIs are handled that way. -
The tests mostly exercise private helpers. We need coverage through the public API, e.g.
RubyLLM.embed(..., model: "multimodalembedding", provider: :vertexai, with: ...), plus regression coverage for existing Vertex text embeddings. -
The README example should quote the model name:
model: "multimodalembedding".
I think the safest shape is to keep existing Vertex text embedding behavior unchanged, add a separate multimodal payload path only for multimodalembedding, avoid ActiveSupport runtime helpers, and add public API specs/VCR coverage for both text-only and multimodal cases.
What this does
This PR adds support for multimodal embeddings in RubyLLM, enabling embedding images and videos alongside text for use cases like semantic image search, video content analysis, and cross-modal retrieval.
Changes:
multimodalembeddingmodel to the list of known modelsExample usage:
Type of change
Scope check
Required for new features
PRs for new features or enhancements without a prior approved issue will be closed.
Quality check
overcommit --installand all hooks passbundle exec rake vcr:record[provider_name]bundle exec rspecmodels.json,aliases.json)AI-generated code
API changes