How dimension detection is performed
mainThe system determines the effective embedding dimension during initialization. To optimize performance and avoid unnecessary API calls, it follows these rules:
- Skip Probing (Known Models): If the configured model has a known fixed output (e.g.,
openai:text-embedding-3-small), the system uses the known dimension and skips the startup probe. - Skip Probing (Matching Metadata): If the current
embedding_modelmatches stored metadata that already contains anembedding_dimension, the system reuses that dimension and skips the probe. - Runtime Probing: If the model is unknown/variable and no matching metadata or explicit override exists, the system performs a startup probe by generating an embedding for the string
"test"and measuring its length. - Explicit Overrides: If
embeddings.vectorDimensionis explicitly configured, the system uses that value immediately and skips all auto-detection/probing logic.