diff --git a/mem0/configs/vector_stores/chroma.py b/mem0/configs/vector_stores/chroma.py index 764e6a381..1b65e1436 100644 --- a/mem0/configs/vector_stores/chroma.py +++ b/mem0/configs/vector_stores/chroma.py @@ -32,8 +32,8 @@ class ChromaDbConfig(BaseModel): values.pop("path", None) return values - # Check if local/server configuration is provided (excluding default tmp path for cloud config) - local_config = bool(path and path != "/tmp/chroma") or bool(host and port) + # Check if local/server configuration is provided + local_config = bool(path) or bool(host and port) if not cloud_config and not local_config: raise ValueError("Either ChromaDB Cloud configuration (api_key, tenant) or local configuration (path or host/port) must be provided.") diff --git a/tests/vector_stores/test_chroma.py b/tests/vector_stores/test_chroma.py index be043cb57..57c16d4d9 100644 --- a/tests/vector_stores/test_chroma.py +++ b/tests/vector_stores/test_chroma.py @@ -3,6 +3,7 @@ from unittest.mock import Mock, patch import pytest from mem0.vector_stores.chroma import ChromaDB +from mem0.configs.vector_stores.chroma import ChromaDbConfig @pytest.fixture @@ -249,3 +250,15 @@ def test_generate_where_clause_non_string_values(): # ChromaDB accepts non-string values in filters expected = {"$and": [{"user_id": {"$eq": "alice"}}, {"count": {"$eq": 5}}, {"active": {"$eq": True}}]} assert result == expected + + +def test_chroma_config_accepts_default_tmp_path(): + """Test that ChromaDbConfig accepts the default /tmp/chroma path.""" + config = ChromaDbConfig(path="/tmp/chroma") + assert config.path == "/tmp/chroma" + + +def test_chroma_config_rejects_no_config(): + """Test that ChromaDbConfig rejects when no connection config is provided.""" + with pytest.raises(ValueError): + ChromaDbConfig()