diff --git a/docs/components/embedders/models/together.mdx b/docs/components/embedders/models/together.mdx index 75f44227e..a71c1764a 100644 --- a/docs/components/embedders/models/together.mdx +++ b/docs/components/embedders/models/together.mdx @@ -11,7 +11,7 @@ To use Together embedding models, set the `TOGETHER_API_KEY` environment variabl The `embedding_model_dims` parameter for `vector_store` should be set to `1024` for Together embedder. -**Breaking default change.** The default Together embedding model is now `intfloat/multilingual-e5-large-instruct` (**1024-dim**), replacing the previous default `togethercomputer/m2-bert-80M-8k-retrieval` (**768-dim**). If you created a self-hosted vector store with the old default, its collection is 768-dim and will reject the new 1024-dim vectors **recreate/reindex the collection at 1024 dimensions** after upgrading. To defer the change, pin the previous values explicitly (`model="togethercomputer/m2-bert-80M-8k-retrieval"`, `embedding_dims=768`) note Together no longer lists this model among its recommended embeddings, so reindexing at 1024 is the durable path. +**Breaking default change.** The default Together embedding model is now `intfloat/multilingual-e5-large-instruct` (**1024-dim**), replacing the previous default `togethercomputer/m2-bert-80M-8k-retrieval` (**768-dim**). If you created a self-hosted vector store with the old default, its collection is 768-dim and will reject the new 1024-dim vectors — **recreate/reindex the collection at 1024 dimensions** after upgrading. To defer the change, pin the previous values explicitly (`model="togethercomputer/m2-bert-80M-8k-retrieval"`, `embedding_dims=768`) — note Together no longer lists this model among its recommended embeddings, so reindexing at 1024 is the durable path. diff --git a/docs/components/vectordbs/dbs/azure.mdx b/docs/components/vectordbs/dbs/azure.mdx index 4c0554cde..6a43d8f14 100644 --- a/docs/components/vectordbs/dbs/azure.mdx +++ b/docs/components/vectordbs/dbs/azure.mdx @@ -95,7 +95,7 @@ Uses the identity from Azure PowerShell (`Connect-AzAccount`). 7. **Azure Developer CLI Credential:** Uses the session from Azure Developer CLI (`azd auth login`). - If an API is provided, it will be used for authentication over an Azure Identity + If an API key is provided, it will be used for authentication over an Azure Identity To enable Role-Based Access Control (RBAC) for Azure AI Search, follow these steps: 1. In the Azure Portal, navigate to your **Azure AI Search** service. diff --git a/docs/cookbooks/integrations/healthcare-google-adk.mdx b/docs/cookbooks/integrations/healthcare-google-adk.mdx index dcc31295b..2ecf85ab4 100644 --- a/docs/cookbooks/integrations/healthcare-google-adk.mdx +++ b/docs/cookbooks/integrations/healthcare-google-adk.mdx @@ -30,7 +30,7 @@ pip install google-adk mem0ai python-dotenv ## Code Breakdown -Let's get started and understand the different components required in building a healthcare assistant powered by memory +Let's get started and understand the different components required in building a healthcare assistant powered by memory. ```python # Import dependencies diff --git a/docs/integrations/llama-index.mdx b/docs/integrations/llama-index.mdx index f61d50116..141a290d3 100644 --- a/docs/integrations/llama-index.mdx +++ b/docs/integrations/llama-index.mdx @@ -45,7 +45,7 @@ memory_from_client = Mem0Memory.from_client( ) ``` -Context is used to identify the user, agent or the conversation in the Mem0. It is required to be passed in the at least one of the fields in the `Mem0Memory` constructor. It can be any of the following: +Context is used to identify the user, agent or the conversation in the Mem0. It is required to be passed in at least one of the fields in the `Mem0Memory` constructor. It can be any of the following: ```python context = { diff --git a/mem0/vector_stores/valkey.py b/mem0/vector_stores/valkey.py index 0688a1288..189285539 100644 --- a/mem0/vector_stores/valkey.py +++ b/mem0/vector_stores/valkey.py @@ -299,13 +299,8 @@ class ValkeyDB(VectorStoreBase): # Create the key for the hash key = f"{self.prefix}:{id}" - # Check for required fields and provide defaults if missing - if "data" not in payload: - # Silently use default value for missing 'data' field - pass - - # Ensure created_at is present - if "created_at" not in payload: + # Default created_at when missing or None to current time + if not payload.get("created_at"): payload["created_at"] = datetime.now(pytz.timezone(self.timezone)).isoformat() # Prepare the hash data @@ -499,13 +494,8 @@ class ValkeyDB(VectorStoreBase): try: key = f"{self.prefix}:{vector_id}" - # Check for required fields and provide defaults if missing - if "data" not in payload: - # Silently use default value for missing 'data' field - pass - - # Ensure created_at is present - if "created_at" not in payload: + # Default created_at when missing or None to current time + if not payload.get("created_at"): payload["created_at"] = datetime.now(pytz.timezone(self.timezone)).isoformat() # Prepare the hash data @@ -521,7 +511,7 @@ class ValkeyDB(VectorStoreBase): hash_data["embedding"] = np.array(vector, dtype=np.float32).tobytes() # Add updated_at if available - if "updated_at" in payload: + if payload.get("updated_at"): hash_data["updated_at"] = int(datetime.fromisoformat(payload["updated_at"]).timestamp()) # Add optional fields diff --git a/tests/vector_stores/test_valkey.py b/tests/vector_stores/test_valkey.py index 769f511d4..b42a54848 100644 --- a/tests/vector_stores/test_valkey.py +++ b/tests/vector_stores/test_valkey.py @@ -158,6 +158,32 @@ def test_insert_handles_missing_created_at(valkey_db, mock_valkey_client): assert "created_at" in kwargs["mapping"] # Should be added automatically +def test_insert_and_update_with_none_timestamps(valkey_db, mock_valkey_client): + """Regression: a None timestamp must not crash insert() or update(). + + A None created_at falls back to now and a None updated_at is skipped, so + neither reaches fromisoformat() which only accepts a str. + """ + vector = np.random.rand(1536).tolist() + + valkey_db.insert( + vectors=[vector], + payloads=[{"hash": "h", "data": "d", "created_at": None, "updated_at": None}], + ids=["id1"], + ) + _, insert_kwargs = mock_valkey_client.hset.call_args + assert isinstance(insert_kwargs["mapping"]["created_at"], int) + + valkey_db.update( + vector_id="id1", + vector=vector, + payload={"hash": "h", "data": "d", "created_at": None, "updated_at": None}, + ) + _, update_kwargs = mock_valkey_client.hset.call_args + assert isinstance(update_kwargs["mapping"]["created_at"], int) + assert "updated_at" not in update_kwargs["mapping"] + + def test_delete(valkey_db, mock_valkey_client): """Test deleting a vector.""" # Call delete