feat: auto-detect embedding dimension during validation #10993
+354
−48
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.
Related GitHub Issue
Closes: #10991
Roo Code Task Context (Optional)
N/A
Description
This PR implements auto-detection of embedding dimensions during embedder validation to address the issue where users can configure incorrect embedding dimensions, causing Qdrant to reject vector upserts with dimension mismatches.
Key Implementation Details:
detectedDimensionfield to the validation result typevalidateEmbedder()now returns the detected dimensioncreateVectorStore()accepts an optionaldetectedDimensionparameter with the following priority order:getModelDimension()modelDimensionsetting_recreateServices()validates the embedder first, captures the detected dimension, and passes it tocreateServices()Design Choices:
Test Procedure
Automated Tests: Added new test cases covering:
Test Commands:
Manual Testing Scenario:
Pre-Submission Checklist
Screenshots / Videos
N/A - This is a backend-only change with no UI impact.
Documentation Updates
Additional Notes
This addresses the specific scenario described in issue #10991 where a user configured 1536 dimensions but their Ollama qwen3-embedding model actually produces 4096-dimension embeddings, causing Qdrant to reject upserts with the error: "Wrong input: Vector inserting dimension is expected to be 1536."
Get in Touch
N/A - Automated PR