nvidia-nat 1.3a20250819__py3-none-any.whl → 1.3.0a20250823__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.
- aiq/__init__.py +66 -0
- nat/agent/base.py +16 -0
- nat/agent/react_agent/agent.py +38 -13
- nat/agent/react_agent/prompt.py +4 -1
- nat/agent/react_agent/register.py +1 -1
- nat/agent/register.py +0 -1
- nat/agent/rewoo_agent/agent.py +6 -3
- nat/agent/rewoo_agent/prompt.py +3 -0
- nat/agent/rewoo_agent/register.py +4 -3
- nat/agent/tool_calling_agent/agent.py +92 -22
- nat/agent/tool_calling_agent/register.py +9 -13
- nat/authentication/api_key/api_key_auth_provider.py +1 -1
- nat/authentication/register.py +0 -1
- nat/builder/builder.py +1 -1
- nat/builder/context.py +9 -1
- nat/builder/function_base.py +3 -3
- nat/builder/function_info.py +5 -7
- nat/builder/user_interaction_manager.py +2 -2
- nat/builder/workflow.py +3 -0
- nat/builder/workflow_builder.py +0 -1
- nat/cli/commands/evaluate.py +1 -1
- nat/cli/commands/info/list_components.py +7 -8
- nat/cli/commands/info/list_mcp.py +3 -4
- nat/cli/commands/registry/search.py +14 -16
- nat/cli/commands/start.py +0 -1
- nat/cli/commands/workflow/templates/pyproject.toml.j2 +3 -0
- nat/cli/commands/workflow/templates/register.py.j2 +0 -1
- nat/cli/commands/workflow/workflow_commands.py +0 -1
- nat/cli/type_registry.py +7 -9
- nat/data_models/config.py +1 -1
- nat/data_models/evaluate.py +1 -1
- nat/data_models/function_dependencies.py +6 -6
- nat/data_models/intermediate_step.py +3 -3
- nat/data_models/model_gated_field_mixin.py +125 -0
- nat/data_models/swe_bench_model.py +1 -1
- nat/data_models/temperature_mixin.py +36 -0
- nat/data_models/top_p_mixin.py +36 -0
- nat/embedder/azure_openai_embedder.py +46 -0
- nat/embedder/openai_embedder.py +1 -2
- nat/embedder/register.py +1 -1
- nat/eval/config.py +2 -0
- nat/eval/dataset_handler/dataset_handler.py +5 -6
- nat/eval/evaluate.py +64 -20
- nat/eval/rag_evaluator/register.py +2 -2
- nat/eval/register.py +0 -1
- nat/eval/tunable_rag_evaluator/evaluate.py +0 -3
- nat/eval/utils/eval_trace_ctx.py +89 -0
- nat/eval/utils/weave_eval.py +14 -7
- nat/experimental/test_time_compute/models/strategy_base.py +3 -2
- nat/experimental/test_time_compute/register.py +0 -1
- nat/experimental/test_time_compute/selection/llm_based_output_merging_selector.py +0 -2
- nat/front_ends/fastapi/fastapi_front_end_plugin_worker.py +48 -49
- nat/front_ends/fastapi/message_handler.py +13 -14
- nat/front_ends/fastapi/message_validator.py +4 -4
- nat/front_ends/fastapi/step_adaptor.py +1 -1
- nat/front_ends/register.py +0 -1
- nat/llm/aws_bedrock_llm.py +3 -3
- nat/llm/azure_openai_llm.py +49 -0
- nat/llm/nim_llm.py +4 -4
- nat/llm/openai_llm.py +4 -4
- nat/llm/register.py +1 -1
- nat/llm/utils/env_config_value.py +2 -3
- nat/meta/pypi.md +9 -9
- nat/object_store/models.py +2 -0
- nat/object_store/register.py +0 -1
- nat/observability/exporter/base_exporter.py +1 -1
- nat/observability/exporter/file_exporter.py +1 -1
- nat/observability/register.py +3 -3
- nat/profiler/callbacks/langchain_callback_handler.py +9 -2
- nat/profiler/callbacks/semantic_kernel_callback_handler.py +1 -1
- nat/profiler/data_frame_row.py +1 -1
- nat/profiler/decorators/framework_wrapper.py +1 -4
- nat/profiler/forecasting/models/forecasting_base_model.py +3 -1
- nat/profiler/inference_optimization/bottleneck_analysis/simple_stack_analysis.py +1 -1
- nat/profiler/inference_optimization/data_models.py +3 -3
- nat/profiler/inference_optimization/experimental/prefix_span_analysis.py +7 -8
- nat/profiler/inference_optimization/token_uniqueness.py +1 -1
- nat/profiler/profile_runner.py +13 -8
- nat/registry_handlers/package_utils.py +0 -1
- nat/registry_handlers/pypi/pypi_handler.py +20 -23
- nat/registry_handlers/register.py +3 -4
- nat/registry_handlers/rest/rest_handler.py +8 -9
- nat/retriever/register.py +0 -1
- nat/runtime/session.py +23 -8
- nat/settings/global_settings.py +13 -2
- nat/tool/code_execution/local_sandbox/local_sandbox_server.py +1 -1
- nat/tool/datetime_tools.py +49 -9
- nat/tool/document_search.py +1 -1
- nat/tool/mcp/mcp_tool.py +1 -1
- nat/tool/register.py +0 -1
- nat/utils/data_models/schema_validator.py +2 -2
- nat/utils/exception_handlers/automatic_retries.py +0 -2
- nat/utils/exception_handlers/schemas.py +1 -1
- nat/utils/reactive/base/observable_base.py +2 -2
- nat/utils/reactive/base/observer_base.py +1 -1
- nat/utils/reactive/observable.py +2 -2
- nat/utils/reactive/observer.py +2 -2
- nat/utils/reactive/subscription.py +1 -1
- nat/utils/settings/global_settings.py +4 -6
- nat/utils/type_utils.py +4 -4
- {nvidia_nat-1.3a20250819.dist-info → nvidia_nat-1.3.0a20250823.dist-info}/METADATA +17 -15
- {nvidia_nat-1.3a20250819.dist-info → nvidia_nat-1.3.0a20250823.dist-info}/RECORD +107 -100
- nvidia_nat-1.3.0a20250823.dist-info/licenses/LICENSE-3rd-party.txt +5478 -0
- {nvidia_nat-1.3a20250819.dist-info → nvidia_nat-1.3.0a20250823.dist-info}/top_level.txt +1 -0
- nvidia_nat-1.3a20250819.dist-info/licenses/LICENSE-3rd-party.txt +0 -3686
- {nvidia_nat-1.3a20250819.dist-info → nvidia_nat-1.3.0a20250823.dist-info}/WHEEL +0 -0
- {nvidia_nat-1.3a20250819.dist-info → nvidia_nat-1.3.0a20250823.dist-info}/entry_points.txt +0 -0
- {nvidia_nat-1.3a20250819.dist-info → nvidia_nat-1.3.0a20250823.dist-info}/licenses/LICENSE.md +0 -0
nat/runtime/session.py
CHANGED
|
@@ -21,7 +21,9 @@ from collections.abc import Callable
|
|
|
21
21
|
from contextlib import asynccontextmanager
|
|
22
22
|
from contextlib import nullcontext
|
|
23
23
|
|
|
24
|
+
from fastapi import WebSocket
|
|
24
25
|
from starlette.requests import HTTPConnection
|
|
26
|
+
from starlette.requests import Request
|
|
25
27
|
|
|
26
28
|
from nat.builder.context import Context
|
|
27
29
|
from nat.builder.context import ContextState
|
|
@@ -89,7 +91,8 @@ class SessionManager:
|
|
|
89
91
|
@asynccontextmanager
|
|
90
92
|
async def session(self,
|
|
91
93
|
user_manager=None,
|
|
92
|
-
|
|
94
|
+
http_connection: HTTPConnection | None = None,
|
|
95
|
+
user_message_id: str | None = None,
|
|
93
96
|
conversation_id: str | None = None,
|
|
94
97
|
user_input_callback: Callable[[InteractionPrompt], Awaitable[HumanResponse]] = None,
|
|
95
98
|
user_authentication_callback: Callable[[AuthProviderBaseConfig, AuthFlowType],
|
|
@@ -107,10 +110,11 @@ class SessionManager:
|
|
|
107
110
|
if user_authentication_callback is not None:
|
|
108
111
|
token_user_authentication = self._context_state.user_auth_callback.set(user_authentication_callback)
|
|
109
112
|
|
|
110
|
-
if
|
|
111
|
-
self.
|
|
113
|
+
if isinstance(http_connection, WebSocket):
|
|
114
|
+
self.set_metadata_from_websocket(user_message_id, conversation_id)
|
|
112
115
|
|
|
113
|
-
|
|
116
|
+
if isinstance(http_connection, Request):
|
|
117
|
+
self.set_metadata_from_http_request(http_connection)
|
|
114
118
|
|
|
115
119
|
try:
|
|
116
120
|
yield self
|
|
@@ -135,14 +139,11 @@ class SessionManager:
|
|
|
135
139
|
async with self._workflow.run(message) as runner:
|
|
136
140
|
yield runner
|
|
137
141
|
|
|
138
|
-
def set_metadata_from_http_request(self, request:
|
|
142
|
+
def set_metadata_from_http_request(self, request: Request) -> None:
|
|
139
143
|
"""
|
|
140
144
|
Extracts and sets user metadata request attributes from a HTTP request.
|
|
141
145
|
If request is None, no attributes are set.
|
|
142
146
|
"""
|
|
143
|
-
if request is None:
|
|
144
|
-
return
|
|
145
|
-
|
|
146
147
|
self._context.metadata._request.method = getattr(request, "method", None)
|
|
147
148
|
self._context.metadata._request.url_path = request.url.path
|
|
148
149
|
self._context.metadata._request.url_port = request.url.port
|
|
@@ -157,6 +158,20 @@ class SessionManager:
|
|
|
157
158
|
if request.headers.get("conversation-id"):
|
|
158
159
|
self._context_state.conversation_id.set(request.headers["conversation-id"])
|
|
159
160
|
|
|
161
|
+
if request.headers.get("user-message-id"):
|
|
162
|
+
self._context_state.user_message_id.set(request.headers["user-message-id"])
|
|
163
|
+
|
|
164
|
+
def set_metadata_from_websocket(self, user_message_id: str | None, conversation_id: str | None) -> None:
|
|
165
|
+
"""
|
|
166
|
+
Extracts and sets user metadata for Websocket connections.
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
if conversation_id is not None:
|
|
170
|
+
self._context_state.conversation_id.set(conversation_id)
|
|
171
|
+
|
|
172
|
+
if user_message_id is not None:
|
|
173
|
+
self._context_state.user_message_id.set(user_message_id)
|
|
174
|
+
|
|
160
175
|
|
|
161
176
|
# Compatibility aliases with previous releases
|
|
162
177
|
AIQSessionManager = SessionManager
|
nat/settings/global_settings.py
CHANGED
|
@@ -47,6 +47,12 @@ class Settings(HashableBaseModel):
|
|
|
47
47
|
# Registry Handeler Configuration
|
|
48
48
|
channels: dict[str, RegistryHandlerBaseConfig] = {}
|
|
49
49
|
|
|
50
|
+
# Timezone fallback behavior
|
|
51
|
+
# Options:
|
|
52
|
+
# - "utc": default to UTC
|
|
53
|
+
# - "system": use the system's local timezone
|
|
54
|
+
fallback_timezone: typing.Literal["system", "utc"] = "utc"
|
|
55
|
+
|
|
50
56
|
_configuration_directory: typing.ClassVar[str]
|
|
51
57
|
_settings_changed_hooks: typing.ClassVar[list[Callable[[], None]]] = []
|
|
52
58
|
_settings_changed_hooks_active: bool = True
|
|
@@ -118,7 +124,6 @@ class Settings(HashableBaseModel):
|
|
|
118
124
|
if (short_names[key.local_name] == 1):
|
|
119
125
|
type_list.append((key.local_name, key.config_type))
|
|
120
126
|
|
|
121
|
-
# pylint: disable=consider-alternative-union-syntax
|
|
122
127
|
return typing.Union[tuple(typing.Annotated[x_type, Tag(x_id)] for x_id, x_type in type_list)]
|
|
123
128
|
|
|
124
129
|
RegistryHandlerAnnotation = dict[
|
|
@@ -165,7 +170,11 @@ class Settings(HashableBaseModel):
|
|
|
165
170
|
loaded_config = {}
|
|
166
171
|
else:
|
|
167
172
|
with open(file_path, mode="r", encoding="utf-8") as f:
|
|
168
|
-
|
|
173
|
+
try:
|
|
174
|
+
loaded_config = json.load(f)
|
|
175
|
+
except Exception as e:
|
|
176
|
+
logger.exception("Error loading configuration file %s: %s", file_path, e)
|
|
177
|
+
loaded_config = {}
|
|
169
178
|
|
|
170
179
|
settings = Settings(**loaded_config)
|
|
171
180
|
settings.set_configuration_directory(configuration_directory)
|
|
@@ -214,6 +223,8 @@ class Settings(HashableBaseModel):
|
|
|
214
223
|
match field:
|
|
215
224
|
case "channels":
|
|
216
225
|
self.channels = validated_data.channels
|
|
226
|
+
case "fallback_timezone":
|
|
227
|
+
self.fallback_timezone = validated_data.fallback_timezone
|
|
217
228
|
case _:
|
|
218
229
|
raise ValueError(f"Encountered invalid model field: {field}")
|
|
219
230
|
|
|
@@ -127,7 +127,7 @@ def execute_code_subprocess(generated_code: str, queue):
|
|
|
127
127
|
stderr_capture = StringIO()
|
|
128
128
|
try:
|
|
129
129
|
with contextlib.redirect_stdout(stdout_capture), contextlib.redirect_stderr(stderr_capture):
|
|
130
|
-
exec(generated_code, {})
|
|
130
|
+
exec(generated_code, {})
|
|
131
131
|
logger.debug("execute_code_subprocess finished, PID: %s", os.getpid())
|
|
132
132
|
queue.put(CodeExecutionResult(stdout=stdout_capture.getvalue(), stderr=stderr_capture.getvalue()))
|
|
133
133
|
except Exception as e:
|
nat/tool/datetime_tools.py
CHANGED
|
@@ -13,30 +13,70 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
import datetime
|
|
17
|
+
import zoneinfo
|
|
18
|
+
|
|
19
|
+
from starlette.datastructures import Headers
|
|
20
|
+
|
|
16
21
|
from nat.builder.builder import Builder
|
|
17
22
|
from nat.builder.function_info import FunctionInfo
|
|
18
23
|
from nat.cli.register_workflow import register_function
|
|
19
24
|
from nat.data_models.function import FunctionBaseConfig
|
|
25
|
+
from nat.settings.global_settings import GlobalSettings
|
|
20
26
|
|
|
21
27
|
|
|
22
28
|
class CurrentTimeToolConfig(FunctionBaseConfig, name="current_datetime"):
|
|
23
29
|
"""
|
|
24
|
-
Simple tool which returns the current date and time in human readable format.
|
|
30
|
+
Simple tool which returns the current date and time in human readable format with timezone information. By default,
|
|
31
|
+
the timezone is in Etc/UTC. If the user provides a timezone in the header, we will use it. Timezone will be
|
|
32
|
+
provided in IANA zone name format. For example, "America/New_York" or "Etc/UTC".
|
|
25
33
|
"""
|
|
26
34
|
pass
|
|
27
35
|
|
|
28
36
|
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
def _get_timezone_obj(headers: Headers | None) -> zoneinfo.ZoneInfo | datetime.tzinfo:
|
|
38
|
+
# Default to UTC
|
|
39
|
+
timezone_obj = zoneinfo.ZoneInfo("Etc/UTC")
|
|
40
|
+
|
|
41
|
+
if headers:
|
|
42
|
+
# If user has provided a timezone in the header, we will prioritize on using it
|
|
43
|
+
timezone_header = headers.get("x-timezone")
|
|
44
|
+
if timezone_header:
|
|
45
|
+
try:
|
|
46
|
+
timezone_obj = zoneinfo.ZoneInfo(timezone_header)
|
|
47
|
+
except Exception:
|
|
48
|
+
pass
|
|
49
|
+
else:
|
|
50
|
+
# Only if a timezone is not in the header, we will determine default timezone based on global settings
|
|
51
|
+
fallback_tz = GlobalSettings.get().fallback_timezone
|
|
52
|
+
|
|
53
|
+
if fallback_tz == "system":
|
|
54
|
+
# Use the system's local timezone. Avoid requiring external deps.
|
|
55
|
+
timezone_obj = datetime.datetime.now().astimezone().tzinfo or zoneinfo.ZoneInfo("Etc/UTC")
|
|
56
|
+
|
|
57
|
+
return timezone_obj
|
|
31
58
|
|
|
32
|
-
|
|
59
|
+
|
|
60
|
+
@register_function(config_type=CurrentTimeToolConfig)
|
|
61
|
+
async def current_datetime(_config: CurrentTimeToolConfig, _builder: Builder):
|
|
33
62
|
|
|
34
63
|
async def _get_current_time(unused: str) -> str:
|
|
35
64
|
|
|
36
|
-
|
|
37
|
-
|
|
65
|
+
del unused # Unused parameter to avoid linting error
|
|
66
|
+
|
|
67
|
+
from nat.builder.context import Context
|
|
68
|
+
nat_context = Context.get()
|
|
69
|
+
|
|
70
|
+
headers: Headers | None = nat_context.metadata.headers
|
|
71
|
+
|
|
72
|
+
timezone_obj = _get_timezone_obj(headers)
|
|
73
|
+
|
|
74
|
+
now = datetime.datetime.now(timezone_obj)
|
|
75
|
+
now_machine_readable = now.strftime(("%Y-%m-%d %H:%M:%S %z"))
|
|
38
76
|
|
|
39
|
-
|
|
77
|
+
# Returns the current time in machine readable format with timezone offset.
|
|
78
|
+
return f"The current time of day is {now_machine_readable}"
|
|
40
79
|
|
|
41
|
-
yield FunctionInfo.from_fn(
|
|
42
|
-
|
|
80
|
+
yield FunctionInfo.from_fn(
|
|
81
|
+
_get_current_time,
|
|
82
|
+
description="Returns the current date and time in human readable format with timezone information.")
|
nat/tool/document_search.py
CHANGED
|
@@ -53,7 +53,7 @@ async def document_search(config: MilvusDocumentSearchToolConfig, builder: Build
|
|
|
53
53
|
from langchain_core.messages import HumanMessage
|
|
54
54
|
from langchain_core.messages import SystemMessage
|
|
55
55
|
from langchain_core.pydantic_v1 import BaseModel
|
|
56
|
-
from langchain_core.pydantic_v1 import Field
|
|
56
|
+
from langchain_core.pydantic_v1 import Field
|
|
57
57
|
|
|
58
58
|
# define collection store
|
|
59
59
|
# create a list of tuples using enumerate()
|
nat/tool/mcp/mcp_tool.py
CHANGED
|
@@ -48,7 +48,7 @@ class MCPToolConfig(FunctionBaseConfig, name="mcp_tool_wrapper"):
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
@register_function(config_type=MCPToolConfig)
|
|
51
|
-
async def mcp_tool(config: MCPToolConfig, builder: Builder):
|
|
51
|
+
async def mcp_tool(config: MCPToolConfig, builder: Builder):
|
|
52
52
|
"""
|
|
53
53
|
Generate a NAT Function that wraps a tool provided by the MCP server.
|
|
54
54
|
"""
|
nat/tool/register.py
CHANGED
|
@@ -21,7 +21,7 @@ from ..exception_handlers.schemas import yaml_exception_handler
|
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
@schema_exception_handler
|
|
24
|
-
def validate_schema(metadata, Schema):
|
|
24
|
+
def validate_schema(metadata, Schema):
|
|
25
25
|
|
|
26
26
|
try:
|
|
27
27
|
return Schema(**metadata)
|
|
@@ -31,7 +31,7 @@ def validate_schema(metadata, Schema): # pylint: disable=invalid-name
|
|
|
31
31
|
|
|
32
32
|
|
|
33
33
|
@yaml_exception_handler
|
|
34
|
-
def validate_yaml(ctx, param, value):
|
|
34
|
+
def validate_yaml(ctx, param, value):
|
|
35
35
|
"""
|
|
36
36
|
Validate that the file is a valid YAML file
|
|
37
37
|
|
|
@@ -26,8 +26,6 @@ from collections.abc import Sequence
|
|
|
26
26
|
from typing import Any
|
|
27
27
|
from typing import TypeVar
|
|
28
28
|
|
|
29
|
-
# pylint: disable=inconsistent-return-statements
|
|
30
|
-
|
|
31
29
|
T = TypeVar("T")
|
|
32
30
|
Exc = tuple[type[BaseException], ...] # exception classes
|
|
33
31
|
CodePattern = int | str | range # for retry_codes argument
|
|
@@ -21,7 +21,7 @@ from pydantic import ValidationError
|
|
|
21
21
|
logger = logging.getLogger(__name__)
|
|
22
22
|
|
|
23
23
|
|
|
24
|
-
def schema_exception_handler(func, **kwargs):
|
|
24
|
+
def schema_exception_handler(func, **kwargs):
|
|
25
25
|
"""
|
|
26
26
|
A decorator that handles `ValidationError` exceptions for schema validation functions.
|
|
27
27
|
|
|
@@ -25,8 +25,8 @@ from nat.utils.reactive.subscription import Subscription
|
|
|
25
25
|
|
|
26
26
|
# Covariant type param: An Observable producing type X can also produce
|
|
27
27
|
# a subtype of X.
|
|
28
|
-
_T_out_co = TypeVar("_T_out_co", covariant=True)
|
|
29
|
-
_T = TypeVar("_T")
|
|
28
|
+
_T_out_co = TypeVar("_T_out_co", covariant=True)
|
|
29
|
+
_T = TypeVar("_T")
|
|
30
30
|
|
|
31
31
|
OnNext = Callable[[_T], None]
|
|
32
32
|
OnError = Callable[[Exception], None]
|
|
@@ -20,7 +20,7 @@ from typing import TypeVar
|
|
|
20
20
|
|
|
21
21
|
# Contravariant type param: An Observer that can accept type X can also
|
|
22
22
|
# accept any supertype of X.
|
|
23
|
-
_T_in_contra = TypeVar("_T_in_contra", contravariant=True)
|
|
23
|
+
_T_in_contra = TypeVar("_T_in_contra", contravariant=True)
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
class ObserverBase(Generic[_T_in_contra], ABC):
|
nat/utils/reactive/observable.py
CHANGED
|
@@ -24,8 +24,8 @@ from nat.utils.type_utils import override
|
|
|
24
24
|
|
|
25
25
|
# Covariant type param: An Observable producing type X can also produce
|
|
26
26
|
# a subtype of X.
|
|
27
|
-
_T_out_co = TypeVar("_T_out_co", covariant=True)
|
|
28
|
-
_T = TypeVar("_T")
|
|
27
|
+
_T_out_co = TypeVar("_T_out_co", covariant=True)
|
|
28
|
+
_T = TypeVar("_T")
|
|
29
29
|
|
|
30
30
|
OnNext = Callable[[_T], None]
|
|
31
31
|
OnError = Callable[[Exception], None]
|
nat/utils/reactive/observer.py
CHANGED
|
@@ -23,8 +23,8 @@ logger = logging.getLogger(__name__)
|
|
|
23
23
|
|
|
24
24
|
# Contravariant type param: An Observer that can accept type X can also
|
|
25
25
|
# accept any supertype of X.
|
|
26
|
-
_T_in_contra = TypeVar("_T_in_contra", contravariant=True)
|
|
27
|
-
_T = TypeVar("_T")
|
|
26
|
+
_T_in_contra = TypeVar("_T_in_contra", contravariant=True)
|
|
27
|
+
_T = TypeVar("_T")
|
|
28
28
|
|
|
29
29
|
OnNext = Callable[[_T], None]
|
|
30
30
|
OnError = Callable[[Exception], None]
|
|
@@ -21,7 +21,7 @@ from typing import TypeVar
|
|
|
21
21
|
if typing.TYPE_CHECKING:
|
|
22
22
|
from nat.utils.reactive.base.subject_base import SubjectBase
|
|
23
23
|
|
|
24
|
-
_T = TypeVar("_T")
|
|
24
|
+
_T = TypeVar("_T")
|
|
25
25
|
|
|
26
26
|
OnNext = Callable[[_T], None]
|
|
27
27
|
OnError = Callable[[Exception], None]
|
|
@@ -47,7 +47,7 @@ def configure_registry_channel(config_type: RegistryHandlerBaseConfig, channel_n
|
|
|
47
47
|
user_input = input(f"{human_prompt}: ")
|
|
48
48
|
model_fields = {}
|
|
49
49
|
model_fields[field] = (info.annotation, ...)
|
|
50
|
-
DynamicFieldModel = create_model("DynamicFieldModel", **model_fields)
|
|
50
|
+
DynamicFieldModel = create_model("DynamicFieldModel", **model_fields)
|
|
51
51
|
dynamic_inputs = {field: user_input}
|
|
52
52
|
|
|
53
53
|
try:
|
|
@@ -76,8 +76,7 @@ def add_channel_interative(channel_type: str) -> None:
|
|
|
76
76
|
registry = GlobalTypeRegistry.get()
|
|
77
77
|
|
|
78
78
|
try:
|
|
79
|
-
ChannelConfigType = registry.get_registered_channel_info_by_channel_type(
|
|
80
|
-
channel_type=channel_type).config_type
|
|
79
|
+
ChannelConfigType = registry.get_registered_channel_info_by_channel_type(channel_type=channel_type).config_type
|
|
81
80
|
except Exception as e:
|
|
82
81
|
logger.exception("Invalid channel type: %s", e, exc_info=True)
|
|
83
82
|
return
|
|
@@ -92,8 +91,7 @@ def add_channel_interative(channel_type: str) -> None:
|
|
|
92
91
|
settings.channels[channel_name] = {}
|
|
93
92
|
break
|
|
94
93
|
|
|
95
|
-
ChannelConfigType = registry.get_registered_channel_info_by_channel_type(
|
|
96
|
-
channel_type=channel_type).config_type
|
|
94
|
+
ChannelConfigType = registry.get_registered_channel_info_by_channel_type(channel_type=channel_type).config_type
|
|
97
95
|
|
|
98
96
|
configure_registry_channel(config_type=ChannelConfigType, channel_name=channel_name)
|
|
99
97
|
|
|
@@ -181,7 +179,7 @@ def match_valid_channel(channel_name: str) -> None:
|
|
|
181
179
|
|
|
182
180
|
channals_settings = settings.channels
|
|
183
181
|
channel_settings = channals_settings.get(channel_name)
|
|
184
|
-
ChannelConfigType = registry.get_registered_channel_info_by_channel_type(
|
|
182
|
+
ChannelConfigType = registry.get_registered_channel_info_by_channel_type(
|
|
185
183
|
channel_type=channel_settings.static_type()).config_type
|
|
186
184
|
|
|
187
185
|
configure_registry_channel(config_type=ChannelConfigType, channel_name=channel_name)
|
nat/utils/type_utils.py
CHANGED
|
@@ -50,7 +50,7 @@ def is_valid_json(string):
|
|
|
50
50
|
# In Python >= 3.12, it uses the built-in typing.override decorator
|
|
51
51
|
# In Python < 3.12, it acts as a no-op decorator
|
|
52
52
|
if sys.version_info >= (3, 12):
|
|
53
|
-
from typing import override
|
|
53
|
+
from typing import override
|
|
54
54
|
else:
|
|
55
55
|
|
|
56
56
|
def override(func):
|
|
@@ -181,7 +181,7 @@ class DecomposedType:
|
|
|
181
181
|
True if the current type is a union type, False otherwise.
|
|
182
182
|
"""
|
|
183
183
|
|
|
184
|
-
return self.origin in (typing.Union, types.UnionType)
|
|
184
|
+
return self.origin in (typing.Union, types.UnionType)
|
|
185
185
|
|
|
186
186
|
@property
|
|
187
187
|
@lru_cache
|
|
@@ -197,7 +197,7 @@ class DecomposedType:
|
|
|
197
197
|
"""
|
|
198
198
|
|
|
199
199
|
return self.origin in (
|
|
200
|
-
typing.AsyncGenerator,
|
|
200
|
+
typing.AsyncGenerator,
|
|
201
201
|
collections.abc.AsyncGenerator,
|
|
202
202
|
types.AsyncGeneratorType,
|
|
203
203
|
)
|
|
@@ -250,7 +250,7 @@ class DecomposedType:
|
|
|
250
250
|
remaining_args = tuple(arg for arg in self.args if arg is not types.NoneType)
|
|
251
251
|
|
|
252
252
|
if (len(remaining_args) > 1):
|
|
253
|
-
return DecomposedType(typing.Union[remaining_args])
|
|
253
|
+
return DecomposedType(typing.Union[remaining_args])
|
|
254
254
|
if (len(remaining_args) == 1):
|
|
255
255
|
return DecomposedType(remaining_args[0])
|
|
256
256
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: nvidia-nat
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.3.0a20250823
|
|
4
4
|
Summary: NVIDIA NeMo Agent toolkit
|
|
5
5
|
Author: NVIDIA Corporation
|
|
6
6
|
Maintainer: NVIDIA Corporation
|
|
@@ -237,12 +237,14 @@ Requires-Dist: rich~=13.9
|
|
|
237
237
|
Requires-Dist: tabulate~=0.9
|
|
238
238
|
Requires-Dist: uvicorn[standard]~=0.32.0
|
|
239
239
|
Requires-Dist: wikipedia~=1.4
|
|
240
|
+
Provides-Extra: all
|
|
241
|
+
Requires-Dist: nvidia-nat-all; extra == "all"
|
|
240
242
|
Provides-Extra: agno
|
|
241
243
|
Requires-Dist: nvidia-nat-agno; extra == "agno"
|
|
242
244
|
Provides-Extra: crewai
|
|
243
245
|
Requires-Dist: nvidia-nat-crewai; extra == "crewai"
|
|
244
246
|
Provides-Extra: ingestion
|
|
245
|
-
Requires-Dist:
|
|
247
|
+
Requires-Dist: nvidia-nat-ingestion; extra == "ingestion"
|
|
246
248
|
Provides-Extra: langchain
|
|
247
249
|
Requires-Dist: nvidia-nat-langchain; extra == "langchain"
|
|
248
250
|
Provides-Extra: llama-index
|
|
@@ -253,6 +255,8 @@ Provides-Extra: opentelemetry
|
|
|
253
255
|
Requires-Dist: nvidia-nat-opentelemetry; extra == "opentelemetry"
|
|
254
256
|
Provides-Extra: phoenix
|
|
255
257
|
Requires-Dist: nvidia-nat-phoenix; extra == "phoenix"
|
|
258
|
+
Provides-Extra: profiling
|
|
259
|
+
Requires-Dist: nvidia-nat-profiling; extra == "profiling"
|
|
256
260
|
Provides-Extra: ragaai
|
|
257
261
|
Requires-Dist: nvidia-nat-ragaai; extra == "ragaai"
|
|
258
262
|
Provides-Extra: mysql
|
|
@@ -278,10 +282,12 @@ Requires-Dist: nat_alert_triage_agent; extra == "examples"
|
|
|
278
282
|
Requires-Dist: nat_automated_description_generation; extra == "examples"
|
|
279
283
|
Requires-Dist: nat_email_phishing_analyzer; extra == "examples"
|
|
280
284
|
Requires-Dist: nat_multi_frameworks; extra == "examples"
|
|
285
|
+
Requires-Dist: nat_first_search_agent; extra == "examples"
|
|
281
286
|
Requires-Dist: nat_plot_charts; extra == "examples"
|
|
282
287
|
Requires-Dist: nat_por_to_jiratickets; extra == "examples"
|
|
283
288
|
Requires-Dist: nat_profiler_agent; extra == "examples"
|
|
284
289
|
Requires-Dist: nat_redact_pii; extra == "examples"
|
|
290
|
+
Requires-Dist: nat_retail_sales_agent; extra == "examples"
|
|
285
291
|
Requires-Dist: nat_semantic_kernel_demo; extra == "examples"
|
|
286
292
|
Requires-Dist: nat_simple_auth; extra == "examples"
|
|
287
293
|
Requires-Dist: nat_simple_web_query; extra == "examples"
|
|
@@ -295,10 +301,6 @@ Requires-Dist: nat_simple_calculator_hitl; extra == "examples"
|
|
|
295
301
|
Requires-Dist: nat_simple_rag; extra == "examples"
|
|
296
302
|
Requires-Dist: nat_swe_bench; extra == "examples"
|
|
297
303
|
Requires-Dist: nat_user_report; extra == "examples"
|
|
298
|
-
Provides-Extra: profiling
|
|
299
|
-
Requires-Dist: matplotlib~=3.9; extra == "profiling"
|
|
300
|
-
Requires-Dist: prefixspan~=0.5.2; extra == "profiling"
|
|
301
|
-
Requires-Dist: scikit-learn~=1.6; extra == "profiling"
|
|
302
304
|
Provides-Extra: gunicorn
|
|
303
305
|
Requires-Dist: gunicorn~=23.0; extra == "gunicorn"
|
|
304
306
|
Dynamic: license-file
|
|
@@ -328,19 +330,19 @@ NeMo Agent toolkit is a flexible library designed to seamlessly integrate your e
|
|
|
328
330
|
|
|
329
331
|
## Key Features
|
|
330
332
|
|
|
331
|
-
- [**Framework Agnostic:**](https://docs.nvidia.com/nemo/agent-toolkit/1.
|
|
332
|
-
- [**Reusability:**](https://docs.nvidia.com/nemo/agent-toolkit/1.
|
|
333
|
-
- [**Rapid Development:**](https://docs.nvidia.com/nemo/agent-toolkit/1.
|
|
334
|
-
- [**Profiling:**](https://docs.nvidia.com/nemo/agent-toolkit/1.
|
|
335
|
-
- [**Observability:**](https://docs.nvidia.com/nemo/agent-toolkit/1.
|
|
336
|
-
- [**Evaluation System:**](https://docs.nvidia.com/nemo/agent-toolkit/1.
|
|
337
|
-
- [**User Interface:**](https://docs.nvidia.com/nemo/agent-toolkit/1.
|
|
338
|
-
- [**MCP Compatibility**](https://docs.nvidia.com/nemo/agent-toolkit/1.
|
|
333
|
+
- [**Framework Agnostic:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/extend/plugins.html) Works with any agentic framework, so you can use your current technology stack without replatforming.
|
|
334
|
+
- [**Reusability:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/extend/sharing-components.html) Every agent, tool, or workflow can be combined and repurposed, allowing developers to leverage existing work in new scenarios.
|
|
335
|
+
- [**Rapid Development:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/tutorials/index.html) Start with a pre-built agent, tool, or workflow, and customize it to your needs.
|
|
336
|
+
- [**Profiling:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/profiler.html) Profile entire workflows down to the tool and agent level, track input/output tokens and timings, and identify bottlenecks.
|
|
337
|
+
- [**Observability:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/observe/observe-workflow-with-phoenix.html) Monitor and debug your workflows with any OpenTelemetry-compatible observability tool, with examples using [Phoenix](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/observe/observe-workflow-with-phoenix.html) and [W&B Weave](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/observe/observe-workflow-with-weave.html).
|
|
338
|
+
- [**Evaluation System:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/evaluate.html) Validate and maintain accuracy of agentic workflows with built-in evaluation tools.
|
|
339
|
+
- [**User Interface:**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/quick-start/launching-ui.html) Use the NeMo Agent toolkit UI chat interface to interact with your agents, visualize output, and debug workflows.
|
|
340
|
+
- [**MCP Compatibility**](https://docs.nvidia.com/nemo/agent-toolkit/1.3/workflows/mcp/mcp-client.html) Compatible with Model Context Protocol (MCP), allowing tools served by MCP Servers to be used as NeMo Agent toolkit functions.
|
|
339
341
|
|
|
340
342
|
With NeMo Agent toolkit, you can move quickly, experiment freely, and ensure reliability across all your agent-driven projects.
|
|
341
343
|
|
|
342
344
|
## Links
|
|
343
|
-
* [Documentation](https://docs.nvidia.com/nemo/agent-toolkit/1.
|
|
345
|
+
* [Documentation](https://docs.nvidia.com/nemo/agent-toolkit/1.3/index.html): Explore the full documentation for NeMo Agent toolkit.
|
|
344
346
|
|
|
345
347
|
## First time user?
|
|
346
348
|
If this is your first time using NeMo Agent toolkit, it is recommended to install the latest version from the [source repository](https://github.com/NVIDIA/NeMo-Agent-Toolkit?tab=readme-ov-file#quick-start) on GitHub. This package is intended for users who are familiar with NeMo Agent toolkit applications and need to add NeMo Agent toolkit as a dependency to their project.
|