Repository navigation
Support VertexAI embedding task_type and title - #824
Closed
goianiense wants to merge 1 commit into
Closed
goianiense wants to merge 1 commit into
goianiense wants to merge 1 commit into
Conversation
Plumb provider-specific kwargs through RubyLLM.embed so VertexAI can send task_type (and title for RETRIEVAL_DOCUMENT) on gemini-embedding-001 instances, matching the Vertex predict API shape. Closes #810
Owner
|
Thanks for the PR. The underlying Vertex AI embedding issue is fixed on main, but through the general one-shot params API rather than provider-specific top-level keywords. The fix landed in 1bc6fc0, with the follow-up keyword cleanup in 5cdf01f. Use params for Vertex AI request fields: RubyLLM.embed(
"hello",
model: "gemini-embedding-001",
provider: :vertexai,
dimensions: 1536,
params: { task_type: "SEMANTIC_SIMILARITY" }
)For document embeddings, params can include both task_type and title. RubyLLM applies those fields to each Vertex AI embedding instance. Closing this PR as superseded by the implementation on main. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
**provider_params) throughRubyLLM.embed→Provider#embed→Protocol#embed→render_embedding_payloadtask_type(e.g.SEMANTIC_SIMILARITY,RETRIEVAL_QUERY,RETRIEVAL_DOCUMENT) and optionaltitleon each instance**splat so extra options don't raiseFixes #810
Usage
Produces a VertexAI payload shaped like:
{ "instances": [ { "content": "hello", "task_type": "SEMANTIC_SIMILARITY" } ], "parameters": { "outputDimensionality": 1536 } }For document embeddings:
Test plan
VertexAI::Embeddings#render_embedding_payloadcoveringtask_type,title, batch instances, and dimensionsRubyLLM.embedforwardstask_type/titleto the provider (reproducedArgumentError: unknown keyword: :task_typebefore the fix)