nvidia-nat-mem0ai 1.4.0a20251108__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of nvidia-nat-mem0ai might be problematic. Click here for more details.

nat/meta/pypi.md ADDED
@@ -0,0 +1,23 @@
1
+ <!--
2
+ SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3
+ SPDX-License-Identifier: Apache-2.0
4
+
5
+ Licensed under the Apache License, Version 2.0 (the "License");
6
+ you may not use this file except in compliance with the License.
7
+ You may obtain a copy of the License at
8
+
9
+ http://www.apache.org/licenses/LICENSE-2.0
10
+
11
+ Unless required by applicable law or agreed to in writing, software
12
+ distributed under the License is distributed on an "AS IS" BASIS,
13
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ See the License for the specific language governing permissions and
15
+ limitations under the License.
16
+ -->
17
+
18
+ ![NVIDIA NeMo Agent Toolkit](https://media.githubusercontent.com/media/NVIDIA/NeMo-Agent-Toolkit/refs/heads/main/docs/source/_static/banner.png "NeMo Agent toolkit banner image")
19
+
20
+ # NVIDIA NeMo Agent Toolkit Subpackage
21
+ This is a subpackage for Mem0 memory integration in NeMo Agent toolkit.
22
+
23
+ For more information about the NVIDIA NeMo Agent toolkit, please visit the [NeMo Agent toolkit GitHub Repo](https://github.com/NVIDIA/NeMo-Agent-Toolkit).
File without changes
@@ -0,0 +1,115 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ import asyncio
17
+ import warnings
18
+
19
+ from pydantic.warnings import PydanticDeprecatedSince20
20
+
21
+ with warnings.catch_warnings():
22
+ warnings.filterwarnings("ignore", category=PydanticDeprecatedSince20)
23
+ from mem0 import AsyncMemoryClient
24
+
25
+ from nat.memory.interfaces import MemoryEditor
26
+ from nat.memory.models import MemoryItem
27
+
28
+
29
+ class Mem0Editor(MemoryEditor):
30
+ """
31
+ Wrapper class that implements NAT interfaces for Mem0 Integrations Async.
32
+ """
33
+
34
+ def __init__(self, mem0_client: AsyncMemoryClient):
35
+ """
36
+ Initialize class with Predefined Mem0 Client.
37
+
38
+ Args:
39
+ mem0_client (AsyncMemoryClient): Preinstantiated
40
+ AsyncMemoryClient object for Mem0.
41
+ """
42
+ self._client = mem0_client
43
+
44
+ async def add_items(self, items: list[MemoryItem]) -> None:
45
+ """
46
+ Insert Multiple MemoryItems into the memory.
47
+ Each MemoryItem is translated and uploaded.
48
+ """
49
+
50
+ coroutines = []
51
+
52
+ # Iteratively insert memories into Mem0
53
+ for memory_item in items:
54
+ item_meta = memory_item.metadata
55
+ content = memory_item.conversation
56
+
57
+ user_id = memory_item.user_id # This must be specified
58
+ run_id = item_meta.pop("run_id", None)
59
+ tags = memory_item.tags
60
+
61
+ coroutines.append(
62
+ self._client.add(content,
63
+ user_id=user_id,
64
+ run_id=run_id,
65
+ tags=tags,
66
+ metadata=item_meta,
67
+ output_format="v1.1"))
68
+
69
+ await asyncio.gather(*coroutines)
70
+
71
+ async def search(self, query: str, top_k: int = 5, **kwargs) \
72
+ -> list[MemoryItem]:
73
+ """
74
+ Retrieve items relevant to the given query.
75
+
76
+ Args:
77
+ query (str): The query string to match.
78
+ top_k (int): Maximum number of items to return.
79
+ kwargs: Other keyword arguments for search.
80
+
81
+ Returns:
82
+ list[MemoryItem]: The most relevant
83
+ MemoryItems for the given query.
84
+ """
85
+
86
+ user_id = kwargs.pop("user_id") # Ensure user ID is in keyword arguments
87
+
88
+ search_result = await self._client.search(query, user_id=user_id, top_k=top_k, output_format="v1.1", **kwargs)
89
+
90
+ # Construct MemoryItem instances
91
+ memories = []
92
+
93
+ for res in search_result["results"]:
94
+ item_meta = res.pop("metadata", {})
95
+
96
+ memories.append(
97
+ MemoryItem(conversation=res.pop("input", []),
98
+ user_id=user_id,
99
+ memory=res["memory"],
100
+ tags=res.pop("categories", []) or [],
101
+ metadata=item_meta))
102
+
103
+ return memories
104
+
105
+ async def remove_items(self, **kwargs):
106
+
107
+ if "memory_id" in kwargs:
108
+
109
+ memory_id = kwargs.pop("memory_id")
110
+ await self._client.delete(memory_id)
111
+
112
+ elif "user_id" in kwargs:
113
+
114
+ user_id = kwargs.pop("user_id")
115
+ await self._client.delete_all(user_id=user_id)
@@ -0,0 +1,57 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from nat.builder.builder import Builder
17
+ from nat.cli.register_workflow import register_memory
18
+ from nat.data_models.memory import MemoryBaseConfig
19
+ from nat.data_models.retry_mixin import RetryMixin
20
+ from nat.utils.exception_handlers.automatic_retries import patch_with_retry
21
+
22
+
23
+ class Mem0MemoryClientConfig(MemoryBaseConfig, RetryMixin, name="mem0_memory"):
24
+ host: str | None = None
25
+ organization: str | None = None
26
+ project: str | None = None
27
+ org_id: str | None = None
28
+ project_id: str | None = None
29
+
30
+
31
+ @register_memory(config_type=Mem0MemoryClientConfig)
32
+ async def mem0_memory_client(config: Mem0MemoryClientConfig, builder: Builder):
33
+ import os
34
+
35
+ from mem0 import AsyncMemoryClient
36
+
37
+ from nat.plugins.mem0ai.mem0_editor import Mem0Editor
38
+
39
+ mem0_api_key = os.environ.get("MEM0_API_KEY")
40
+
41
+ if mem0_api_key is None:
42
+ raise RuntimeError("Mem0 API key is not set. Please specify it in the environment variable 'MEM0_API_KEY'.")
43
+
44
+ mem0_client = AsyncMemoryClient(api_key=mem0_api_key,
45
+ host=config.host,
46
+ org_id=config.org_id,
47
+ project_id=config.project_id)
48
+
49
+ memory_editor = Mem0Editor(mem0_client=mem0_client)
50
+
51
+ if isinstance(config, RetryMixin):
52
+ memory_editor = patch_with_retry(memory_editor,
53
+ retries=config.num_retries,
54
+ retry_codes=config.retry_on_status_codes,
55
+ retry_on_messages=config.retry_on_errors)
56
+
57
+ yield memory_editor
@@ -0,0 +1,21 @@
1
+ # SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
+ # SPDX-License-Identifier: Apache-2.0
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ # flake8: noqa
17
+ # isort:skip_file
18
+
19
+ # Import any providers which need to be automatically registered here
20
+
21
+ from . import memory
@@ -0,0 +1,45 @@
1
+ Metadata-Version: 2.4
2
+ Name: nvidia-nat-mem0ai
3
+ Version: 1.4.0a20251108
4
+ Summary: Subpackage for Mem0 integration in NeMo Agent toolkit
5
+ Author: NVIDIA Corporation
6
+ Maintainer: NVIDIA Corporation
7
+ License: Apache-2.0
8
+ Project-URL: documentation, https://docs.nvidia.com/nemo/agent-toolkit/latest/
9
+ Project-URL: source, https://github.com/NVIDIA/NeMo-Agent-Toolkit
10
+ Keywords: ai,agents,memory
11
+ Classifier: Programming Language :: Python
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Requires-Python: <3.14,>=3.11
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE-3rd-party.txt
18
+ License-File: LICENSE.md
19
+ Requires-Dist: nvidia-nat==v1.4.0a20251108
20
+ Requires-Dist: mem0ai~=0.1.30
21
+ Dynamic: license-file
22
+
23
+ <!--
24
+ SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
25
+ SPDX-License-Identifier: Apache-2.0
26
+
27
+ Licensed under the Apache License, Version 2.0 (the "License");
28
+ you may not use this file except in compliance with the License.
29
+ You may obtain a copy of the License at
30
+
31
+ http://www.apache.org/licenses/LICENSE-2.0
32
+
33
+ Unless required by applicable law or agreed to in writing, software
34
+ distributed under the License is distributed on an "AS IS" BASIS,
35
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36
+ See the License for the specific language governing permissions and
37
+ limitations under the License.
38
+ -->
39
+
40
+ ![NVIDIA NeMo Agent Toolkit](https://media.githubusercontent.com/media/NVIDIA/NeMo-Agent-Toolkit/refs/heads/main/docs/source/_static/banner.png "NeMo Agent toolkit banner image")
41
+
42
+ # NVIDIA NeMo Agent Toolkit Subpackage
43
+ This is a subpackage for Mem0 memory integration in NeMo Agent toolkit.
44
+
45
+ For more information about the NVIDIA NeMo Agent toolkit, please visit the [NeMo Agent toolkit GitHub Repo](https://github.com/NVIDIA/NeMo-Agent-Toolkit).
@@ -0,0 +1,12 @@
1
+ nat/meta/pypi.md,sha256=7XuJcdD6mLfdsNxAbZP0xBwy66gfptwYqnOoC06xz_8,1112
2
+ nat/plugins/mem0ai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ nat/plugins/mem0ai/mem0_editor.py,sha256=_6LAurerAMFk0fIhIzMxW_9c12nZIFOxDthcANeJA9M,3812
4
+ nat/plugins/mem0ai/memory.py,sha256=-uO0kcuCpAXrRZnzU2dfM5yHm87go4nOhBUZ03i9Qtk,2291
5
+ nat/plugins/mem0ai/register.py,sha256=n5QJ6VHpLSV4j9WJEc7IgvWHbSyfy8KYeE9XKz4NZxo,807
6
+ nvidia_nat_mem0ai-1.4.0a20251108.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
7
+ nvidia_nat_mem0ai-1.4.0a20251108.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
8
+ nvidia_nat_mem0ai-1.4.0a20251108.dist-info/METADATA,sha256=Sy23uavDsvaKABLwzENsQ3FvQzUXzpA0Hq8cd1C4RnE,1918
9
+ nvidia_nat_mem0ai-1.4.0a20251108.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
10
+ nvidia_nat_mem0ai-1.4.0a20251108.dist-info/entry_points.txt,sha256=3eEklM2ToRyptUsWn00bINNml1FWTMaEZlNq29G4SjQ,58
11
+ nvidia_nat_mem0ai-1.4.0a20251108.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
12
+ nvidia_nat_mem0ai-1.4.0a20251108.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [nat.components]
2
+ nat_mem0ai = nat.plugins.mem0ai.register