nvidia-nat-redis 1.4.0a20251028__py3-none-any.whl → 1.4.0a20260127__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.
- nat/meta/pypi.md +1 -1
- nat/plugins/redis/memory.py +5 -8
- nat/plugins/redis/object_store.py +13 -11
- nat/plugins/redis/redis_editor.py +1 -1
- nat/plugins/redis/redis_object_store.py +16 -5
- nat/plugins/redis/register.py +1 -1
- nat/plugins/redis/schema.py +1 -1
- {nvidia_nat_redis-1.4.0a20251028.dist-info → nvidia_nat_redis-1.4.0a20260127.dist-info}/METADATA +4 -4
- nvidia_nat_redis-1.4.0a20260127.dist-info/RECORD +15 -0
- {nvidia_nat_redis-1.4.0a20251028.dist-info → nvidia_nat_redis-1.4.0a20260127.dist-info}/WHEEL +1 -1
- nvidia_nat_redis-1.4.0a20251028.dist-info/RECORD +0 -15
- {nvidia_nat_redis-1.4.0a20251028.dist-info → nvidia_nat_redis-1.4.0a20260127.dist-info}/entry_points.txt +0 -0
- {nvidia_nat_redis-1.4.0a20251028.dist-info → nvidia_nat_redis-1.4.0a20260127.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
- {nvidia_nat_redis-1.4.0a20251028.dist-info → nvidia_nat_redis-1.4.0a20260127.dist-info}/licenses/LICENSE.md +0 -0
- {nvidia_nat_redis-1.4.0a20251028.dist-info → nvidia_nat_redis-1.4.0a20260127.dist-info}/top_level.txt +0 -0
nat/meta/pypi.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<!--
|
|
2
|
-
SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
|
+
SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
3
3
|
SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
|
|
5
5
|
Licensed under the Apache License, Version 2.0 (the "License");
|
nat/plugins/redis/memory.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -14,10 +14,11 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
16
|
from pydantic import Field
|
|
17
|
-
from pydantic import SecretStr
|
|
18
17
|
|
|
19
18
|
from nat.builder.builder import Builder
|
|
20
19
|
from nat.cli.register_workflow import register_memory
|
|
20
|
+
from nat.data_models.common import OptionalSecretStr
|
|
21
|
+
from nat.data_models.common import get_secret_value
|
|
21
22
|
from nat.data_models.component_ref import EmbedderRef
|
|
22
23
|
from nat.data_models.memory import MemoryBaseConfig
|
|
23
24
|
|
|
@@ -26,7 +27,7 @@ class RedisMemoryClientConfig(MemoryBaseConfig, name="redis_memory"):
|
|
|
26
27
|
host: str = Field(default="localhost", description="Redis server host")
|
|
27
28
|
db: int = Field(default=0, description="Redis DB")
|
|
28
29
|
port: int = Field(default=6379, description="Redis server port")
|
|
29
|
-
password:
|
|
30
|
+
password: OptionalSecretStr = Field(default=None, description="Password for the Redis server")
|
|
30
31
|
key_prefix: str = Field(default="nat", description="Key prefix to use for redis keys")
|
|
31
32
|
embedder: EmbedderRef = Field(description=("Instance name of the memory client instance from the workflow "
|
|
32
33
|
"configuration object."))
|
|
@@ -42,14 +43,10 @@ async def redis_memory_client(config: RedisMemoryClientConfig, builder: Builder)
|
|
|
42
43
|
|
|
43
44
|
from .schema import ensure_index_exists
|
|
44
45
|
|
|
45
|
-
redis_password = None
|
|
46
|
-
if config.password is not None:
|
|
47
|
-
redis_password = config.password.get_secret_value()
|
|
48
|
-
|
|
49
46
|
redis_client = redis.Redis(host=config.host,
|
|
50
47
|
port=config.port,
|
|
51
48
|
db=config.db,
|
|
52
|
-
password=
|
|
49
|
+
password=get_secret_value(config.password),
|
|
53
50
|
decode_responses=True,
|
|
54
51
|
socket_timeout=5.0,
|
|
55
52
|
socket_connect_timeout=5.0)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -14,30 +14,32 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
16
|
from pydantic import Field
|
|
17
|
-
from pydantic import
|
|
18
|
-
from pydantic import field_serializer
|
|
17
|
+
from pydantic import field_validator
|
|
19
18
|
|
|
20
19
|
from nat.builder.builder import Builder
|
|
21
20
|
from nat.cli.register_workflow import register_object_store
|
|
21
|
+
from nat.data_models.common import OptionalSecretStr
|
|
22
22
|
from nat.data_models.object_store import ObjectStoreBaseConfig
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
class RedisObjectStoreClientConfig(ObjectStoreBaseConfig, name="redis"):
|
|
26
26
|
"""
|
|
27
|
-
Object store that stores objects in a Redis database.
|
|
27
|
+
Object store that stores objects in a Redis database with optional TTL.
|
|
28
28
|
"""
|
|
29
29
|
|
|
30
30
|
host: str = Field(default="localhost", description="The host of the Redis server")
|
|
31
31
|
db: int = Field(default=0, description="The Redis logical database number")
|
|
32
32
|
port: int = Field(default=6379, description="The port of the Redis server")
|
|
33
33
|
bucket_name: str = Field(description="The name of the bucket to use for the object store")
|
|
34
|
-
password:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
password: OptionalSecretStr = Field(default=None, description="The password for the Redis server")
|
|
35
|
+
ttl: int | None = Field(default=None, description="TTL in seconds for objects (None = no expiration)")
|
|
36
|
+
|
|
37
|
+
@field_validator("ttl")
|
|
38
|
+
@classmethod
|
|
39
|
+
def validate_ttl(cls, v: int | None) -> int | None:
|
|
40
|
+
if v is not None and v <= 0:
|
|
41
|
+
raise ValueError("TTL must be a positive integer greater than 0")
|
|
42
|
+
return v
|
|
41
43
|
|
|
42
44
|
|
|
43
45
|
@register_object_store(config_type=RedisObjectStoreClientConfig)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2024-
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2024-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -28,12 +28,22 @@ logger = logging.getLogger(__name__)
|
|
|
28
28
|
|
|
29
29
|
class RedisObjectStore(ObjectStore):
|
|
30
30
|
"""
|
|
31
|
-
Implementation of ObjectStore that stores objects in Redis.
|
|
31
|
+
Implementation of ObjectStore that stores objects in Redis with optional TTL.
|
|
32
32
|
|
|
33
33
|
Each object is stored as a single binary value at key "nat/object_store/{bucket_name}/{object_key}".
|
|
34
|
+
When TTL is configured, keys will automatically expire after the specified duration in seconds.
|
|
34
35
|
"""
|
|
35
36
|
|
|
36
|
-
def __init__(
|
|
37
|
+
def __init__(
|
|
38
|
+
self,
|
|
39
|
+
*,
|
|
40
|
+
bucket_name: str,
|
|
41
|
+
host: str,
|
|
42
|
+
port: int,
|
|
43
|
+
db: int,
|
|
44
|
+
password: str | None = None,
|
|
45
|
+
ttl: int | None = None,
|
|
46
|
+
):
|
|
37
47
|
|
|
38
48
|
super().__init__()
|
|
39
49
|
|
|
@@ -42,6 +52,7 @@ class RedisObjectStore(ObjectStore):
|
|
|
42
52
|
self._port = port
|
|
43
53
|
self._db = db
|
|
44
54
|
self._password = password
|
|
55
|
+
self._ttl = ttl
|
|
45
56
|
self._client: redis.Redis | None = None
|
|
46
57
|
|
|
47
58
|
async def __aenter__(self) -> "RedisObjectStore":
|
|
@@ -88,7 +99,7 @@ class RedisObjectStore(ObjectStore):
|
|
|
88
99
|
|
|
89
100
|
item_json = item.model_dump_json()
|
|
90
101
|
# Redis SET with NX ensures we do not overwrite existing keys
|
|
91
|
-
if not await self._client.set(full_key, item_json, nx=True):
|
|
102
|
+
if not await self._client.set(full_key, item_json, nx=True, ex=self._ttl):
|
|
92
103
|
raise KeyAlreadyExistsError(key=key,
|
|
93
104
|
additional_message=f"Redis bucket {self._bucket_name} already has key {key}")
|
|
94
105
|
|
|
@@ -100,7 +111,7 @@ class RedisObjectStore(ObjectStore):
|
|
|
100
111
|
|
|
101
112
|
full_key = self._make_key(key)
|
|
102
113
|
item_json = item.model_dump_json()
|
|
103
|
-
await self._client.set(full_key, item_json)
|
|
114
|
+
await self._client.set(full_key, item_json, ex=self._ttl)
|
|
104
115
|
|
|
105
116
|
@override
|
|
106
117
|
async def get_object(self, key: str) -> ObjectStoreItem:
|
nat/plugins/redis/register.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
nat/plugins/redis/schema.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
2
2
|
# SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
#
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
{nvidia_nat_redis-1.4.0a20251028.dist-info → nvidia_nat_redis-1.4.0a20260127.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvidia-nat-redis
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.0a20260127
|
|
4
4
|
Summary: Subpackage for Redis integration in NeMo Agent toolkit
|
|
5
5
|
Author: NVIDIA Corporation
|
|
6
6
|
Maintainer: NVIDIA Corporation
|
|
@@ -16,12 +16,12 @@ Requires-Python: <3.14,>=3.11
|
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
License-File: LICENSE-3rd-party.txt
|
|
18
18
|
License-File: LICENSE.md
|
|
19
|
-
Requires-Dist: nvidia-nat==v1.4.
|
|
20
|
-
Requires-Dist: redis
|
|
19
|
+
Requires-Dist: nvidia-nat==v1.4.0a20260127
|
|
20
|
+
Requires-Dist: redis<5.0.0,>=4.3.4
|
|
21
21
|
Dynamic: license-file
|
|
22
22
|
|
|
23
23
|
<!--
|
|
24
|
-
SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
24
|
+
SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
|
|
25
25
|
SPDX-License-Identifier: Apache-2.0
|
|
26
26
|
|
|
27
27
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
nat/meta/pypi.md,sha256=BAi1_MjQHFjNWdFul67NeSrwTwBlzvsEu9rcXUKzOho,1095
|
|
2
|
+
nat/plugins/redis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
+
nat/plugins/redis/memory.py,sha256=Z_xxRi2mOxnVFwN3maoQNy6KMMJC_d8RrdiDxLLY8x0,2830
|
|
4
|
+
nat/plugins/redis/object_store.py,sha256=YttUfeRg-ipo--Jz8iCKbAvRgG0YG-j-5ZGpYN2Jjoc,2238
|
|
5
|
+
nat/plugins/redis/redis_editor.py,sha256=wdN4Oe-AAJtlYsjxwl0SAZITPulXAG0zOjCGRug-LeA,9746
|
|
6
|
+
nat/plugins/redis/redis_object_store.py,sha256=9hjvhDtehTFoP-iz2PhHw8QL1jLd0ivwtRfoTeZOZy4,4672
|
|
7
|
+
nat/plugins/redis/register.py,sha256=dk9o8B_k0QzUxU8JRxpAYyDfbh0xlENz3i0dzZuZI2Q,839
|
|
8
|
+
nat/plugins/redis/schema.py,sha256=fOFwnXPYCMzzEoFN8KNkU2_gMBNF0RCmeRTqccxD_aM,5594
|
|
9
|
+
nvidia_nat_redis-1.4.0a20260127.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
|
|
10
|
+
nvidia_nat_redis-1.4.0a20260127.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
11
|
+
nvidia_nat_redis-1.4.0a20260127.dist-info/METADATA,sha256=Pxgw-7g09zfUhAGIFprcPkdEsGrP43Hr_JoZ-QryfRc,1906
|
|
12
|
+
nvidia_nat_redis-1.4.0a20260127.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
13
|
+
nvidia_nat_redis-1.4.0a20260127.dist-info/entry_points.txt,sha256=nyS8t8L9CbRFIMlE70RQBtJXrflBP4Ltl5zAkIl44So,56
|
|
14
|
+
nvidia_nat_redis-1.4.0a20260127.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
|
15
|
+
nvidia_nat_redis-1.4.0a20260127.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
nat/meta/pypi.md,sha256=TpeNbVZJxzvEf0Gh3BGvLHPYsKnXjgM_KQVCayBPXso,1090
|
|
2
|
-
nat/plugins/redis/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
|
-
nat/plugins/redis/memory.py,sha256=U6cFp0QYb2Peh5f_zNMqM_uPgPC-E3jU1dgxcoPDf1k,2854
|
|
4
|
-
nat/plugins/redis/object_store.py,sha256=ZcNFG6Hb2V2zA-5sRS2US18lkTwEoPV4xAce4gHsVHI,2031
|
|
5
|
-
nat/plugins/redis/redis_editor.py,sha256=nkSIWi1HUPald088fXTuF0rmZ0uS_3V65Vxy20vLSgk,9746
|
|
6
|
-
nat/plugins/redis/redis_object_store.py,sha256=wRKB3HGfywoHp_XF2Rc4JqnAmJtGLb5usAfXeqNzINY,4402
|
|
7
|
-
nat/plugins/redis/register.py,sha256=dJBKi-7W72ipkmZTOIo1E3ETffmJIlYhQTOlrkiFH3A,834
|
|
8
|
-
nat/plugins/redis/schema.py,sha256=Zcas3hIIqG7wuR94baYRFycmnccB3CuGmTs4p8Vv4mA,5589
|
|
9
|
-
nvidia_nat_redis-1.4.0a20251028.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
|
|
10
|
-
nvidia_nat_redis-1.4.0a20251028.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
11
|
-
nvidia_nat_redis-1.4.0a20251028.dist-info/METADATA,sha256=3Xc_Oke0BtPl0GspsqYCd9u3nFJ3k6lHJWJcUzjetI4,1894
|
|
12
|
-
nvidia_nat_redis-1.4.0a20251028.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
13
|
-
nvidia_nat_redis-1.4.0a20251028.dist-info/entry_points.txt,sha256=nyS8t8L9CbRFIMlE70RQBtJXrflBP4Ltl5zAkIl44So,56
|
|
14
|
-
nvidia_nat_redis-1.4.0a20251028.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
|
15
|
-
nvidia_nat_redis-1.4.0a20251028.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|