nvidia-nat-test 1.3.0rc2__py3-none-any.whl → 1.3.0rc3__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/test/llm.py CHANGED
@@ -203,3 +203,34 @@ async def test_llm_agno(config: TestLLMConfig, builder: Builder):
203
203
  yield chooser.next_response()
204
204
 
205
205
  yield AgnoTestLLM()
206
+
207
+
208
+ @register_llm_client(config_type=TestLLMConfig, wrapper_type=LLMFrameworkEnum.ADK)
209
+ async def test_llm_adk(config: TestLLMConfig, builder: Builder):
210
+ """LLM client for Google ADK."""
211
+
212
+ try:
213
+ from google.adk.models.base_llm import BaseLlm
214
+ from google.adk.models.llm_request import LlmRequest
215
+ from google.adk.models.llm_response import LlmResponse
216
+ from google.genai import types
217
+ except ImportError as exc:
218
+ raise ImportError("Google ADK is required for using the test_llm with ADK. "
219
+ "Please install the `nvidia-nat-adk` package. ") from exc
220
+
221
+ chooser = _ResponseChooser(response_seq=config.response_seq, delay_ms=config.delay_ms)
222
+
223
+ class ADKTestLLM(BaseLlm):
224
+
225
+ async def generate_content_async(self,
226
+ llm_request: LlmRequest,
227
+ stream: bool = False) -> AsyncGenerator[LlmResponse, None]:
228
+ self._maybe_append_user_content(llm_request)
229
+ await chooser.async_sleep()
230
+ text = chooser.next_response()
231
+ yield LlmResponse(content=types.Content(role="model", parts=[types.Part.from_text(text=text)]))
232
+
233
+ def connect(self, *_args: Any, **_kwargs: Any) -> None:
234
+ return None
235
+
236
+ yield ADKTestLLM(model="nat_test_llm")
nat/test/plugin.py CHANGED
@@ -153,7 +153,7 @@ def nvidia_api_key_fixture(fail_missing: bool):
153
153
  @pytest.fixture(name="serp_api_key", scope='session')
154
154
  def serp_api_key_fixture(fail_missing: bool):
155
155
  """
156
- Use for integration tests that require a SERP API key.
156
+ Use for integration tests that require a SERP API (serpapi.com) key.
157
157
  """
158
158
  yield require_env_variables(
159
159
  varnames=["SERP_API_KEY"],
@@ -161,6 +161,17 @@ def serp_api_key_fixture(fail_missing: bool):
161
161
  fail_missing=fail_missing)
162
162
 
163
163
 
164
+ @pytest.fixture(name="serperdev", scope='session')
165
+ def serperdev_api_key_fixture(fail_missing: bool):
166
+ """
167
+ Use for integration tests that require a Serper Dev API (https://serper.dev) key.
168
+ """
169
+ yield require_env_variables(
170
+ varnames=["SERPERDEV_API_KEY"],
171
+ reason="SERPERDEV integration tests require the `SERPERDEV_API_KEY` environment variable to be defined.",
172
+ fail_missing=fail_missing)
173
+
174
+
164
175
  @pytest.fixture(name="tavily_api_key", scope='session')
165
176
  def tavily_api_key_fixture(fail_missing: bool):
166
177
  """
nat/test/utils.py CHANGED
@@ -17,10 +17,16 @@ import importlib.resources
17
17
  import inspect
18
18
  import subprocess
19
19
  import typing
20
+ from contextlib import asynccontextmanager
20
21
  from pathlib import Path
21
22
 
22
23
  if typing.TYPE_CHECKING:
24
+ from collections.abc import AsyncIterator
25
+
26
+ from httpx import AsyncClient
27
+
23
28
  from nat.data_models.config import Config
29
+ from nat.front_ends.fastapi.fastapi_front_end_plugin_worker import FastApiFrontEndPluginWorker
24
30
  from nat.utils.type_utils import StrPath
25
31
 
26
32
 
@@ -85,3 +91,37 @@ async def run_workflow(
85
91
  assert expected_answer.lower() in result.lower(), f"Expected '{expected_answer}' in '{result}'"
86
92
 
87
93
  return result
94
+
95
+
96
+ @asynccontextmanager
97
+ async def build_nat_client(
98
+ config: "Config",
99
+ worker_class: "type[FastApiFrontEndPluginWorker] | None" = None) -> "AsyncIterator[AsyncClient]":
100
+ """
101
+ Build a NAT client for testing purposes.
102
+
103
+ Creates a test client with an ASGI transport for the specified configuration.
104
+ The client is backed by a FastAPI application built from the provided worker class.
105
+
106
+ Args:
107
+ config: The NAT configuration to use for building the client.
108
+ worker_class: Optional worker class to use. Defaults to FastApiFrontEndPluginWorker.
109
+
110
+ Yields:
111
+ An AsyncClient instance configured for testing.
112
+ """
113
+ from asgi_lifespan import LifespanManager
114
+ from httpx import ASGITransport
115
+ from httpx import AsyncClient
116
+
117
+ from nat.front_ends.fastapi.fastapi_front_end_plugin_worker import FastApiFrontEndPluginWorker
118
+
119
+ if worker_class is None:
120
+ worker_class = FastApiFrontEndPluginWorker
121
+
122
+ worker = worker_class(config)
123
+ app = worker.build_app()
124
+
125
+ async with LifespanManager(app):
126
+ async with AsyncClient(transport=ASGITransport(app=app), base_url="http://test") as client:
127
+ yield client
@@ -1,7 +1,12 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nvidia-nat-test
3
- Version: 1.3.0rc2
3
+ Version: 1.3.0rc3
4
4
  Summary: Testing utilities for 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
5
10
  Keywords: ai,rag,agents
6
11
  Classifier: Programming Language :: Python
7
12
  Classifier: Programming Language :: Python :: 3.11
@@ -9,9 +14,12 @@ Classifier: Programming Language :: Python :: 3.12
9
14
  Classifier: Programming Language :: Python :: 3.13
10
15
  Requires-Python: <3.14,>=3.11
11
16
  Description-Content-Type: text/markdown
12
- Requires-Dist: nvidia-nat==v1.3.0-rc2
17
+ License-File: LICENSE-3rd-party.txt
18
+ License-File: LICENSE.md
19
+ Requires-Dist: nvidia-nat==v1.3.0-rc3
13
20
  Requires-Dist: langchain-community~=0.3
14
21
  Requires-Dist: pytest~=8.3
22
+ Dynamic: license-file
15
23
 
16
24
  <!--
17
25
  SPDX-FileCopyrightText: Copyright (c) 2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
@@ -0,0 +1,18 @@
1
+ nat/meta/pypi.md,sha256=LLKJHg5oN1-M9Pqfk3Bmphkk4O2TFsyiixuK5T0Y-gw,1100
2
+ nat/test/__init__.py,sha256=_RnTJnsUucHvla_nYKqD4O4g8Bz0tcuDRzWk1bEhcy0,875
3
+ nat/test/embedder.py,sha256=ClDyK1kna4hCBSlz71gK1B-ZjlwcBHTDQRekoNM81Bs,1809
4
+ nat/test/functions.py,sha256=ZxXVzfaLBGOpR5qtmMrKU7q-M9-vVGGj3Xi5mrw4vHY,3557
5
+ nat/test/llm.py,sha256=f6bz6arAQjhjuOKFrLfu_U1LbiyFzQmpM-q8b-WKSrU,9550
6
+ nat/test/memory.py,sha256=xki_A2yiMhEZuQk60K7t04QRqf32nQqnfzD5Iv7fkvw,1456
7
+ nat/test/object_store_tests.py,sha256=PyJioOtoSzILPq6LuD-sOZ_89PIcgXWZweoHBQpK2zQ,4281
8
+ nat/test/plugin.py,sha256=b9DsqeRDYrBA00egilznvNpr_lQmdnkUQilsWX07mTA,11688
9
+ nat/test/register.py,sha256=o1BEA5fyxyFyCxXhQ6ArmtuNpgRyTEfvw6HdBgECPLI,897
10
+ nat/test/tool_test_runner.py,sha256=SxavwXHkvCQDl_PUiiiqgvGfexKJJTeBdI5i1qk6AzI,21712
11
+ nat/test/utils.py,sha256=wXa9uH7-_HH7eg0bKpBrlVhffYrc2-F2MYc5ZBwSbAQ,4593
12
+ nvidia_nat_test-1.3.0rc3.dist-info/licenses/LICENSE-3rd-party.txt,sha256=fOk5jMmCX9YoKWyYzTtfgl-SUy477audFC5hNY4oP7Q,284609
13
+ nvidia_nat_test-1.3.0rc3.dist-info/licenses/LICENSE.md,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
14
+ nvidia_nat_test-1.3.0rc3.dist-info/METADATA,sha256=979x2Z-SPR_2tGpXkeP_18fR0IQlievQ07chPgacaJQ,1914
15
+ nvidia_nat_test-1.3.0rc3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
16
+ nvidia_nat_test-1.3.0rc3.dist-info/entry_points.txt,sha256=7dOP9XB6iMDqvav3gYx9VWUwA8RrFzhbAa8nGeC8e4Y,99
17
+ nvidia_nat_test-1.3.0rc3.dist-info/top_level.txt,sha256=8-CJ2cP6-f0ZReXe5Hzqp-5pvzzHz-5Ds5H2bGqh1-U,4
18
+ nvidia_nat_test-1.3.0rc3.dist-info/RECORD,,