The Embedding Model Is a Contract

Index and query must agree

A vector's dimension is the number of values it contains. all-MiniLM-L6-v2 is the embedding model used here, and every vector it produces has 384 values. A stored group of vectors is an index or collection. A 768-value query cannot be compared with that collection. A different model that also makes 384 values is more dangerous: the code may run, but its coordinates describe a different map.

Store the embedding model name, exact revision, normalization setting (whether vector lengths were adjusted), and dimension beside the collection. If any part changes, deliberately re-index by rebuilding all stored vectors with the new contract.

Warning: Never pad, truncate, or reshape vectors to hide a dimension mismatch. That makes syntactically valid garbage.