Skip to content

fix(gemini): resolve embedding dimensions dynamically instead of hardcoding#1513

Open
McTr0 wants to merge 1 commit into0xPlaygrounds:mainfrom
McTr0:fix/gemini-embedding-ndims
Open

fix(gemini): resolve embedding dimensions dynamically instead of hardcoding#1513
McTr0 wants to merge 1 commit into0xPlaygrounds:mainfrom
McTr0:fix/gemini-embedding-ndims

Conversation

@McTr0
Copy link

@McTr0 McTr0 commented Mar 13, 2026

Previously ndims() was hardcoded to return 768 regardless of the actual model or user configuration. This caused dimension mismatches when using gemini-embedding-001 (native default: 3072) with downstream vector stores.

Changes:

  • Add model_default_ndims() lookup (EMBEDDING_001=3072, EMBEDDING_004=768)

  • Change ndims field from Option to usize

  • Resolve dimensions in make(): user-specified > model default > 768

  • ndims() now returns self.ndims directly (matching OpenAI pattern)

BREAKING CHANGE: EmbeddingModel::new() and with_model() now take usize instead of Option for the ndims parameter.

Relates to #452

…coding

Previously ndims() was hardcoded to return 768 regardless of the actual model or user configuration. This caused dimension mismatches when using gemini-embedding-001 (native default: 3072) with downstream vector stores.

Changes:

- Add model_default_ndims() lookup (EMBEDDING_001=3072, EMBEDDING_004=768)

- Change ndims field from Option<usize> to usize

- Resolve dimensions in make(): user-specified > model default > 768

- ndims() now returns self.ndims directly (matching OpenAI pattern)

BREAKING CHANGE: EmbeddingModel::new() and with_model() now take usize instead of Option<usize> for the ndims parameter.

Closes 0xPlaygrounds#452
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant