nvidia-nat-test 1.4.0a20251023__py3-none-any.whl → 1.4.0a20251024__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-test might be problematic. Click here for more details.
- nat/test/plugin.py +38 -0
- nat/test/utils.py +13 -21
- {nvidia_nat_test-1.4.0a20251023.dist-info → nvidia_nat_test-1.4.0a20251024.dist-info}/METADATA +2 -2
- {nvidia_nat_test-1.4.0a20251023.dist-info → nvidia_nat_test-1.4.0a20251024.dist-info}/RECORD +9 -9
- {nvidia_nat_test-1.4.0a20251023.dist-info → nvidia_nat_test-1.4.0a20251024.dist-info}/WHEEL +0 -0
- {nvidia_nat_test-1.4.0a20251023.dist-info → nvidia_nat_test-1.4.0a20251024.dist-info}/entry_points.txt +0 -0
- {nvidia_nat_test-1.4.0a20251023.dist-info → nvidia_nat_test-1.4.0a20251024.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
- {nvidia_nat_test-1.4.0a20251023.dist-info → nvidia_nat_test-1.4.0a20251024.dist-info}/licenses/LICENSE.md +0 -0
- {nvidia_nat_test-1.4.0a20251023.dist-info → nvidia_nat_test-1.4.0a20251024.dist-info}/top_level.txt +0 -0
nat/test/plugin.py
CHANGED
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
16
|
import os
|
|
17
|
+
import random
|
|
17
18
|
import subprocess
|
|
19
|
+
import time
|
|
18
20
|
import types
|
|
19
21
|
import typing
|
|
20
22
|
from collections.abc import AsyncGenerator
|
|
@@ -25,6 +27,8 @@ import pytest
|
|
|
25
27
|
import pytest_asyncio
|
|
26
28
|
|
|
27
29
|
if typing.TYPE_CHECKING:
|
|
30
|
+
import langsmith.client
|
|
31
|
+
|
|
28
32
|
from docker.client import DockerClient
|
|
29
33
|
|
|
30
34
|
|
|
@@ -262,6 +266,40 @@ def require_weave_fixture(fail_missing: bool) -> types.ModuleType:
|
|
|
262
266
|
pytest.skip(reason=reason)
|
|
263
267
|
|
|
264
268
|
|
|
269
|
+
@pytest.fixture(name="langsmith_api_key", scope='session')
|
|
270
|
+
def langsmith_api_key_fixture(fail_missing: bool):
|
|
271
|
+
"""
|
|
272
|
+
Use for integration tests that require a LangSmith API key.
|
|
273
|
+
"""
|
|
274
|
+
yield require_env_variables(
|
|
275
|
+
varnames=["LANGSMITH_API_KEY"],
|
|
276
|
+
reason="LangSmith integration tests require the `LANGSMITH_API_KEY` environment variable to be defined.",
|
|
277
|
+
fail_missing=fail_missing)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
@pytest.fixture(name="langsmith_client")
|
|
281
|
+
def langsmith_client_fixture(langsmith_api_key: str, fail_missing: bool) -> "langsmith.client.Client":
|
|
282
|
+
try:
|
|
283
|
+
import langsmith.client
|
|
284
|
+
client = langsmith.client.Client()
|
|
285
|
+
return client
|
|
286
|
+
except ImportError:
|
|
287
|
+
reason = "LangSmith integration tests require the `langsmith` package to be installed."
|
|
288
|
+
if fail_missing:
|
|
289
|
+
raise RuntimeError(reason)
|
|
290
|
+
pytest.skip(reason=reason)
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
@pytest.fixture(name="langsmith_project_name")
|
|
294
|
+
def langsmith_project_name_fixture(langsmith_client: "langsmith.client.Client") -> Generator[str]:
|
|
295
|
+
# Createa a unique project name for each test run
|
|
296
|
+
project_name = f"nat-e2e-test-{time.time()}-{random.random()}"
|
|
297
|
+
langsmith_client.create_project(project_name)
|
|
298
|
+
yield project_name
|
|
299
|
+
|
|
300
|
+
langsmith_client.delete_project(project_name=project_name)
|
|
301
|
+
|
|
302
|
+
|
|
265
303
|
@pytest.fixture(name="require_docker", scope='session')
|
|
266
304
|
def require_docker_fixture(fail_missing: bool) -> "DockerClient":
|
|
267
305
|
"""
|
nat/test/utils.py
CHANGED
|
@@ -68,27 +68,19 @@ def locate_example_config(example_config_class: type,
|
|
|
68
68
|
return config_path
|
|
69
69
|
|
|
70
70
|
|
|
71
|
-
async def run_workflow(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
from nat.
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
assert config_file is not None, "Either config_file or config must be provided"
|
|
85
|
-
assert Path(config_file).exists(), f"Config file {config_file} does not exist"
|
|
86
|
-
config = load_config(config_file)
|
|
87
|
-
|
|
88
|
-
async with WorkflowBuilder.from_config(config=config) as workflow_builder:
|
|
89
|
-
workflow = SessionManager(await workflow_builder.build())
|
|
90
|
-
async with workflow.run(question) as runner:
|
|
91
|
-
result = await runner.result(to_type=str)
|
|
71
|
+
async def run_workflow(*,
|
|
72
|
+
config: "Config | None" = None,
|
|
73
|
+
config_file: "StrPath | None" = None,
|
|
74
|
+
question: str,
|
|
75
|
+
expected_answer: str,
|
|
76
|
+
assert_expected_answer: bool = True) -> str:
|
|
77
|
+
"""
|
|
78
|
+
Test specific wrapper for `nat.utils.run_workflow` to run a workflow with a question and validate the expected
|
|
79
|
+
answer. This variant always sets the result type to `str`.
|
|
80
|
+
"""
|
|
81
|
+
from nat.utils import run_workflow as nat_run_workflow
|
|
82
|
+
|
|
83
|
+
result = await nat_run_workflow(config=config, config_file=config_file, prompt=question, to_type=str)
|
|
92
84
|
|
|
93
85
|
if assert_expected_answer:
|
|
94
86
|
assert expected_answer.lower() in result.lower(), f"Expected '{expected_answer}' in '{result}'"
|
{nvidia_nat_test-1.4.0a20251023.dist-info → nvidia_nat_test-1.4.0a20251024.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvidia-nat-test
|
|
3
|
-
Version: 1.4.
|
|
3
|
+
Version: 1.4.0a20251024
|
|
4
4
|
Summary: Testing utilities for NeMo Agent toolkit
|
|
5
5
|
Author: NVIDIA Corporation
|
|
6
6
|
Maintainer: NVIDIA Corporation
|
|
@@ -16,7 +16,7 @@ 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.
|
|
19
|
+
Requires-Dist: nvidia-nat==v1.4.0a20251024
|
|
20
20
|
Requires-Dist: langchain-community~=0.3
|
|
21
21
|
Requires-Dist: pytest~=8.3
|
|
22
22
|
Dynamic: license-file
|
{nvidia_nat_test-1.4.0a20251023.dist-info → nvidia_nat_test-1.4.0a20251024.dist-info}/RECORD
RENAMED
|
@@ -5,14 +5,14 @@ nat/test/functions.py,sha256=ZxXVzfaLBGOpR5qtmMrKU7q-M9-vVGGj3Xi5mrw4vHY,3557
|
|
|
5
5
|
nat/test/llm.py,sha256=f6bz6arAQjhjuOKFrLfu_U1LbiyFzQmpM-q8b-WKSrU,9550
|
|
6
6
|
nat/test/memory.py,sha256=xki_A2yiMhEZuQk60K7t04QRqf32nQqnfzD5Iv7fkvw,1456
|
|
7
7
|
nat/test/object_store_tests.py,sha256=PyJioOtoSzILPq6LuD-sOZ_89PIcgXWZweoHBQpK2zQ,4281
|
|
8
|
-
nat/test/plugin.py,sha256=
|
|
8
|
+
nat/test/plugin.py,sha256=VbKEduSIll8TlyKQtLX5LJ0LzCyXQDwCTxeirZKnrMY,22257
|
|
9
9
|
nat/test/register.py,sha256=o1BEA5fyxyFyCxXhQ6ArmtuNpgRyTEfvw6HdBgECPLI,897
|
|
10
10
|
nat/test/tool_test_runner.py,sha256=SxavwXHkvCQDl_PUiiiqgvGfexKJJTeBdI5i1qk6AzI,21712
|
|
11
|
-
nat/test/utils.py,sha256=
|
|
12
|
-
nvidia_nat_test-1.4.
|
|
13
|
-
nvidia_nat_test-1.4.
|
|
14
|
-
nvidia_nat_test-1.4.
|
|
15
|
-
nvidia_nat_test-1.4.
|
|
16
|
-
nvidia_nat_test-1.4.
|
|
17
|
-
nvidia_nat_test-1.4.
|
|
18
|
-
nvidia_nat_test-1.4.
|
|
11
|
+
nat/test/utils.py,sha256=x0xi3Oo2CYKqQdJ2nKqr9HvzBN6snjwzKGbVTOneqRs,5731
|
|
12
|
+
nvidia_nat_test-1.4.0a20251024.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
|
|
13
|
+
nvidia_nat_test-1.4.0a20251024.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
14
|
+
nvidia_nat_test-1.4.0a20251024.dist-info/METADATA,sha256=XbMMIEco3xAp5nx7PzeNaNnuyUyyhp7-mAqWvt3vFno,1925
|
|
15
|
+
nvidia_nat_test-1.4.0a20251024.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
16
|
+
nvidia_nat_test-1.4.0a20251024.dist-info/entry_points.txt,sha256=7dOP9XB6iMDqvav3gYx9VWUwA8RrFzhbAa8nGeC8e4Y,99
|
|
17
|
+
nvidia_nat_test-1.4.0a20251024.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
|
|
18
|
+
nvidia_nat_test-1.4.0a20251024.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{nvidia_nat_test-1.4.0a20251023.dist-info → nvidia_nat_test-1.4.0a20251024.dist-info}/top_level.txt
RENAMED
|
File without changes
|