agentmemory icon indicating copy to clipboard operation
agentmemory copied to clipboard

Embedding dimension lookup fails for model ids with an OpenRouter variant suffix (:floor, :nitro)

Open Rex57 opened this issue 1 month ago • 0 comments

Current-main boundary

On main 007a1a7 (0.9.30), resolveDimensions() looks the model id up in a table after removing a leading provider/ prefix. A variant suffix such as :floor is kept, so the lookup misses and falls back to 1536. OpenRouter accepts these suffixes on embedding models. For a model whose width is not 1536, the dimension guard then rejects every vector.

Reproduction and results

resolveDimensions("openai/text-embedding-3-large", …)        → 3072
resolveDimensions("openai/text-embedding-3-large:floor", …)  → 1536

A live call to POST https://openrouter.ai/api/v1/embeddings with "model": "openai/text-embedding-3-large:floor" returns 3072-wide vectors. With OPENROUTER_EMBEDDING_MODEL=openai/text-embedding-3-large:floor, every embed call fails with Embedding dimension mismatch … expected 1536, got 3072, and semantic search silently stays empty.

Required behavior

The lookup ignores a trailing :variant suffix on the model id. An explicit *_EMBEDDING_DIMENSIONS value still wins.

Acceptance checks

Tests for text-embedding-3-large:floor, openai/text-embedding-3-large:nitro, an unknown model with a suffix (default), and an override with a suffix.

Source and existing work

lookupModelDimensions, dimension guard.

Related: #809, #1373; PRs #856 and #525 change how OpenRouter dimensions are configured but not the suffix handling.

Environment: agentmemory 0.9.30, Node v26.10.0, macOS 27.0.1 (arm64).

Rex57 avatar Oct 08 '26 06:10 Rex57