Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/v0x/components/vectordbs/dbs/opensearch.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,19 @@ config = {
"host": "your-domain.us-west-2.aoss.amazonaws.com",
"port": 443,
"http_auth": auth,
"embedding_model_dims": 1024,
"embedding_model_dims": 1536, # should match embedder's dimensions

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Isn't it applicable to every other Vector Provider?

Copy link
Contributor Author

@vedant381 vedant381 Oct 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is. Many vector stores — like Qdrant and OpenSearch — default to 1536 dimensions, aligning with OpenAI’s embedding output. However, in this case, the dimension was explicitly set to 1024, which caused the mismatch. That’s why I mentioned it’s a deeper, system-level issue. While this change will resolve your immediate problem, it doesn’t address the underlying inconsistency between embedders and vector store configurations.

Moreover , if you go through the documentations for other vector stores, they are passing embedding_model_dims as 1536 hence the issue won't be there.

"connection_class": RequestsHttpConnection,
"pool_maxsize": 20,
"use_ssl": True,
"verify_certs": True
}
},
"embedder": {
"provider": "openai",
"config": {
"model": "text-embedding-3-small",
"embedding_dims": 1536
}
}
}
```
Expand Down
4 changes: 4 additions & 0 deletions mem0/utils/factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ class VectorStoreFactory:
def create(cls, provider_name, config):
class_type = cls.provider_to_class.get(provider_name)
if class_type:
# Ensure the config includes embedding_model_dims, using the default from VectorStoreBase if not defined
if "embedding_model_dims" not in config:
from mem0.vector_stores.base import VectorStoreBase
config["embedding_model_dims"] = VectorStoreBase.embedding_model_dims
if not isinstance(config, dict):
config = config.model_dump()
vector_store_instance = load_class(class_type)
Expand Down
1 change: 1 addition & 0 deletions mem0/vector_stores/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@


class VectorStoreBase(ABC):
embedding_model_dims = 1536 # Default value for embedding model dimensions which aligns with default OpenAI embedder dimensions
@abstractmethod
def create_col(self, name, vector_size, distance):
"""Create a new collection."""
Expand Down
Loading