nvidia-nat 1.3.0a20250923__py3-none-any.whl → 1.3.0a20250925__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/agent/react_agent/agent.py +5 -4
- nat/agent/react_agent/register.py +12 -1
- nat/agent/reasoning_agent/reasoning_agent.py +2 -2
- nat/agent/rewoo_agent/register.py +12 -1
- nat/agent/tool_calling_agent/register.py +28 -8
- nat/builder/builder.py +33 -24
- nat/builder/component_utils.py +1 -1
- nat/builder/eval_builder.py +14 -9
- nat/builder/framework_enum.py +1 -0
- nat/builder/function.py +108 -52
- nat/builder/workflow_builder.py +89 -79
- nat/cli/commands/info/info.py +16 -6
- nat/cli/commands/mcp/__init__.py +14 -0
- nat/cli/commands/mcp/mcp.py +786 -0
- nat/cli/entrypoint.py +2 -1
- nat/control_flow/router_agent/register.py +1 -1
- nat/control_flow/sequential_executor.py +6 -7
- nat/eval/evaluate.py +2 -1
- nat/eval/trajectory_evaluator/register.py +1 -1
- nat/experimental/decorators/experimental_warning_decorator.py +26 -5
- nat/experimental/test_time_compute/functions/plan_select_execute_function.py +2 -2
- nat/experimental/test_time_compute/functions/ttc_tool_orchestration_function.py +1 -1
- nat/experimental/test_time_compute/functions/ttc_tool_wrapper_function.py +1 -1
- nat/experimental/test_time_compute/models/strategy_base.py +2 -2
- nat/front_ends/console/console_front_end_plugin.py +4 -3
- nat/front_ends/fastapi/fastapi_front_end_plugin_worker.py +3 -3
- nat/front_ends/mcp/mcp_front_end_plugin_worker.py +4 -4
- nat/front_ends/simple_base/simple_front_end_plugin_base.py +3 -1
- nat/llm/litellm_llm.py +69 -0
- nat/llm/register.py +4 -0
- nat/profiler/decorators/framework_wrapper.py +52 -3
- nat/profiler/decorators/function_tracking.py +33 -1
- nat/profiler/parameter_optimization/prompt_optimizer.py +2 -2
- nat/runtime/loader.py +1 -1
- nat/utils/type_converter.py +4 -3
- nat/utils/type_utils.py +1 -1
- {nvidia_nat-1.3.0a20250923.dist-info → nvidia_nat-1.3.0a20250925.dist-info}/METADATA +6 -3
- {nvidia_nat-1.3.0a20250923.dist-info → nvidia_nat-1.3.0a20250925.dist-info}/RECORD +43 -41
- nat/cli/commands/info/list_mcp.py +0 -461
- {nvidia_nat-1.3.0a20250923.dist-info → nvidia_nat-1.3.0a20250925.dist-info}/WHEEL +0 -0
- {nvidia_nat-1.3.0a20250923.dist-info → nvidia_nat-1.3.0a20250925.dist-info}/entry_points.txt +0 -0
- {nvidia_nat-1.3.0a20250923.dist-info → nvidia_nat-1.3.0a20250925.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
- {nvidia_nat-1.3.0a20250923.dist-info → nvidia_nat-1.3.0a20250925.dist-info}/licenses/LICENSE.md +0 -0
- {nvidia_nat-1.3.0a20250923.dist-info → nvidia_nat-1.3.0a20250925.dist-info}/top_level.txt +0 -0
nat/builder/workflow_builder.py
CHANGED
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
import asyncio
|
|
16
17
|
import dataclasses
|
|
17
18
|
import inspect
|
|
18
19
|
import logging
|
|
@@ -22,6 +23,7 @@ from collections.abc import Sequence
|
|
|
22
23
|
from contextlib import AbstractAsyncContextManager
|
|
23
24
|
from contextlib import AsyncExitStack
|
|
24
25
|
from contextlib import asynccontextmanager
|
|
26
|
+
from typing import cast
|
|
25
27
|
|
|
26
28
|
from nat.authentication.interfaces import AuthProviderBase
|
|
27
29
|
from nat.builder.builder import Builder
|
|
@@ -73,6 +75,7 @@ from nat.object_store.interfaces import ObjectStore
|
|
|
73
75
|
from nat.observability.exporter.base_exporter import BaseExporter
|
|
74
76
|
from nat.profiler.decorators.framework_wrapper import chain_wrapped_build_fn
|
|
75
77
|
from nat.profiler.utils import detect_llm_frameworks_in_build_fn
|
|
78
|
+
from nat.retriever.interface import Retriever
|
|
76
79
|
from nat.utils.type_utils import override
|
|
77
80
|
|
|
78
81
|
logger = logging.getLogger(__name__)
|
|
@@ -214,7 +217,7 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
214
217
|
|
|
215
218
|
await self._exit_stack.__aexit__(*exc_details)
|
|
216
219
|
|
|
217
|
-
def build(self, entry_function: str | None = None) -> Workflow:
|
|
220
|
+
async def build(self, entry_function: str | None = None) -> Workflow:
|
|
218
221
|
"""
|
|
219
222
|
Creates an instance of a workflow object using the added components and the desired entry function.
|
|
220
223
|
|
|
@@ -250,7 +253,7 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
250
253
|
function_group_instances = dict()
|
|
251
254
|
|
|
252
255
|
for k, v in self._function_groups.items():
|
|
253
|
-
included_functions.update(v.instance.get_included_functions().keys())
|
|
256
|
+
included_functions.update((await v.instance.get_included_functions()).keys())
|
|
254
257
|
function_group_configs[k] = v.config
|
|
255
258
|
function_group_instances[k] = v.instance
|
|
256
259
|
|
|
@@ -293,7 +296,7 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
293
296
|
if (entry_function is None):
|
|
294
297
|
entry_fn_obj = self.get_workflow()
|
|
295
298
|
else:
|
|
296
|
-
entry_fn_obj = self.get_function(entry_function)
|
|
299
|
+
entry_fn_obj = await self.get_function(entry_function)
|
|
297
300
|
|
|
298
301
|
workflow = Workflow.from_entry_fn(config=config,
|
|
299
302
|
entry_fn=entry_fn_obj,
|
|
@@ -448,18 +451,19 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
448
451
|
|
|
449
452
|
# If the function group exposes functions, add them to the global function registry
|
|
450
453
|
# If the function group exposes functions, record and add them to the registry
|
|
451
|
-
|
|
454
|
+
included_functions = await build_result.instance.get_included_functions()
|
|
455
|
+
for k in included_functions:
|
|
452
456
|
if k in self._functions:
|
|
453
457
|
raise ValueError(f"Exposed function `{k}` from group `{name}` conflicts with an existing function")
|
|
454
458
|
self._functions.update({
|
|
455
459
|
k: ConfiguredFunction(config=v.config, instance=v)
|
|
456
|
-
for k, v in
|
|
460
|
+
for k, v in included_functions.items()
|
|
457
461
|
})
|
|
458
462
|
|
|
459
463
|
return build_result.instance
|
|
460
464
|
|
|
461
465
|
@override
|
|
462
|
-
def get_function(self, name: str | FunctionRef) -> Function:
|
|
466
|
+
async def get_function(self, name: str | FunctionRef) -> Function:
|
|
463
467
|
if isinstance(name, FunctionRef):
|
|
464
468
|
name = str(name)
|
|
465
469
|
if name not in self._functions:
|
|
@@ -468,7 +472,7 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
468
472
|
return self._functions[name].instance
|
|
469
473
|
|
|
470
474
|
@override
|
|
471
|
-
def get_function_group(self, name: str | FunctionGroupRef) -> FunctionGroup:
|
|
475
|
+
async def get_function_group(self, name: str | FunctionGroupRef) -> FunctionGroup:
|
|
472
476
|
if isinstance(name, FunctionGroupRef):
|
|
473
477
|
name = str(name)
|
|
474
478
|
if name not in self._function_groups:
|
|
@@ -534,43 +538,41 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
534
538
|
return self.function_group_dependencies[fn_name]
|
|
535
539
|
|
|
536
540
|
@override
|
|
537
|
-
def get_tools(self,
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
541
|
+
async def get_tools(self,
|
|
542
|
+
tool_names: Sequence[str | FunctionRef | FunctionGroupRef],
|
|
543
|
+
wrapper_type: LLMFrameworkEnum | str) -> list[typing.Any]:
|
|
544
|
+
|
|
545
|
+
unique = set(tool_names)
|
|
546
|
+
if len(unique) != len(tool_names):
|
|
547
|
+
raise ValueError("Tool names must be unique")
|
|
548
|
+
|
|
549
|
+
async def _get_tools(n: str | FunctionRef | FunctionGroupRef):
|
|
550
|
+
tools = []
|
|
543
551
|
is_function_group_ref = isinstance(n, FunctionGroupRef)
|
|
544
552
|
if isinstance(n, FunctionRef) or is_function_group_ref:
|
|
545
553
|
n = str(n)
|
|
546
|
-
if n in seen:
|
|
547
|
-
raise ValueError(f"Function or Function Group `{n}` already seen")
|
|
548
|
-
seen.add(n)
|
|
549
554
|
if n not in self._function_groups:
|
|
550
|
-
# the passed tool name is probably a function
|
|
555
|
+
# the passed tool name is probably a function, but first check if it's a function group
|
|
551
556
|
if is_function_group_ref:
|
|
552
557
|
raise ValueError(f"Function group `{n}` not found in the list of function groups")
|
|
553
|
-
tools.append(self.get_tool(n, wrapper_type))
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
@override
|
|
573
|
-
def get_tool(self, fn_name: str | FunctionRef, wrapper_type: LLMFrameworkEnum | str):
|
|
558
|
+
tools.append(await self.get_tool(n, wrapper_type))
|
|
559
|
+
else:
|
|
560
|
+
tool_wrapper_reg = self._registry.get_tool_wrapper(llm_framework=wrapper_type)
|
|
561
|
+
current_function_group = self._function_groups[n]
|
|
562
|
+
for fn_name, fn_instance in (await current_function_group.instance.get_accessible_functions()).items():
|
|
563
|
+
try:
|
|
564
|
+
tools.append(tool_wrapper_reg.build_fn(fn_name, fn_instance, self))
|
|
565
|
+
except Exception:
|
|
566
|
+
logger.error("Error fetching tool `%s`", fn_name, exc_info=True)
|
|
567
|
+
raise
|
|
568
|
+
return tools
|
|
569
|
+
|
|
570
|
+
tool_lists = await asyncio.gather(*[_get_tools(n) for n in tool_names])
|
|
571
|
+
# Flatten the list of lists into a single list
|
|
572
|
+
return [tool for tools in tool_lists for tool in tools]
|
|
573
|
+
|
|
574
|
+
@override
|
|
575
|
+
async def get_tool(self, fn_name: str | FunctionRef, wrapper_type: LLMFrameworkEnum | str) -> typing.Any:
|
|
574
576
|
if isinstance(fn_name, FunctionRef):
|
|
575
577
|
fn_name = str(fn_name)
|
|
576
578
|
if fn_name not in self._functions:
|
|
@@ -587,7 +589,7 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
587
589
|
raise
|
|
588
590
|
|
|
589
591
|
@override
|
|
590
|
-
async def add_llm(self, name: str | LLMRef, config: LLMBaseConfig):
|
|
592
|
+
async def add_llm(self, name: str | LLMRef, config: LLMBaseConfig) -> None:
|
|
591
593
|
|
|
592
594
|
if (name in self._llms):
|
|
593
595
|
raise ValueError(f"LLM `{name}` already exists in the list of LLMs")
|
|
@@ -603,7 +605,7 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
603
605
|
raise
|
|
604
606
|
|
|
605
607
|
@override
|
|
606
|
-
async def get_llm(self, llm_name: str | LLMRef, wrapper_type: LLMFrameworkEnum | str):
|
|
608
|
+
async def get_llm(self, llm_name: str | LLMRef, wrapper_type: LLMFrameworkEnum | str) -> typing.Any:
|
|
607
609
|
|
|
608
610
|
if (llm_name not in self._llms):
|
|
609
611
|
raise ValueError(f"LLM `{llm_name}` not found")
|
|
@@ -703,7 +705,7 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
703
705
|
return self._auth_providers[auth_provider_name].instance
|
|
704
706
|
|
|
705
707
|
@override
|
|
706
|
-
async def add_embedder(self, name: str | EmbedderRef, config: EmbedderBaseConfig):
|
|
708
|
+
async def add_embedder(self, name: str | EmbedderRef, config: EmbedderBaseConfig) -> None:
|
|
707
709
|
|
|
708
710
|
if (name in self._embedders):
|
|
709
711
|
raise ValueError(f"Embedder `{name}` already exists in the list of embedders")
|
|
@@ -763,7 +765,7 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
763
765
|
return info_obj
|
|
764
766
|
|
|
765
767
|
@override
|
|
766
|
-
def get_memory_client(self, memory_name: str | MemoryRef) -> MemoryEditor:
|
|
768
|
+
async def get_memory_client(self, memory_name: str | MemoryRef) -> MemoryEditor:
|
|
767
769
|
"""
|
|
768
770
|
Return the instantiated memory client for the given name.
|
|
769
771
|
"""
|
|
@@ -809,7 +811,7 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
809
811
|
return self._object_stores[object_store_name].config
|
|
810
812
|
|
|
811
813
|
@override
|
|
812
|
-
async def add_retriever(self, name: str | RetrieverRef, config: RetrieverBaseConfig):
|
|
814
|
+
async def add_retriever(self, name: str | RetrieverRef, config: RetrieverBaseConfig) -> None:
|
|
813
815
|
|
|
814
816
|
if (name in self._retrievers):
|
|
815
817
|
raise ValueError(f"Retriever '{name}' already exists in the list of retrievers")
|
|
@@ -825,8 +827,6 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
825
827
|
logger.error("Error adding retriever `%s` with config `%s`: %s", name, config, e)
|
|
826
828
|
raise
|
|
827
829
|
|
|
828
|
-
# return info_obj
|
|
829
|
-
|
|
830
830
|
@override
|
|
831
831
|
async def get_retriever(self,
|
|
832
832
|
retriever_name: str | RetrieverRef,
|
|
@@ -859,9 +859,9 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
859
859
|
|
|
860
860
|
return self._retrievers[retriever_name].config
|
|
861
861
|
|
|
862
|
-
@experimental(feature_name="TTC")
|
|
863
862
|
@override
|
|
864
|
-
|
|
863
|
+
@experimental(feature_name="TTC")
|
|
864
|
+
async def add_ttc_strategy(self, name: str | TTCStrategyRef, config: TTCStrategyBaseConfig) -> None:
|
|
865
865
|
if (name in self._ttc_strategies):
|
|
866
866
|
raise ValueError(f"TTC strategy '{name}' already exists in the list of TTC strategies")
|
|
867
867
|
|
|
@@ -1048,32 +1048,40 @@ class WorkflowBuilder(Builder, AbstractAsyncContextManager):
|
|
|
1048
1048
|
|
|
1049
1049
|
# Instantiate a the llm
|
|
1050
1050
|
if component_instance.component_group == ComponentGroup.LLMS:
|
|
1051
|
-
await self.add_llm(component_instance.name, component_instance.config)
|
|
1051
|
+
await self.add_llm(component_instance.name, cast(LLMBaseConfig, component_instance.config))
|
|
1052
1052
|
# Instantiate a the embedder
|
|
1053
1053
|
elif component_instance.component_group == ComponentGroup.EMBEDDERS:
|
|
1054
|
-
await self.add_embedder(component_instance.name,
|
|
1054
|
+
await self.add_embedder(component_instance.name,
|
|
1055
|
+
cast(EmbedderBaseConfig, component_instance.config))
|
|
1055
1056
|
# Instantiate a memory client
|
|
1056
1057
|
elif component_instance.component_group == ComponentGroup.MEMORY:
|
|
1057
|
-
await self.add_memory_client(component_instance.name,
|
|
1058
|
+
await self.add_memory_client(component_instance.name,
|
|
1059
|
+
cast(MemoryBaseConfig, component_instance.config))
|
|
1058
1060
|
# Instantiate a object store client
|
|
1059
1061
|
elif component_instance.component_group == ComponentGroup.OBJECT_STORES:
|
|
1060
|
-
await self.add_object_store(component_instance.name,
|
|
1062
|
+
await self.add_object_store(component_instance.name,
|
|
1063
|
+
cast(ObjectStoreBaseConfig, component_instance.config))
|
|
1061
1064
|
# Instantiate a retriever client
|
|
1062
1065
|
elif component_instance.component_group == ComponentGroup.RETRIEVERS:
|
|
1063
|
-
await self.add_retriever(component_instance.name,
|
|
1066
|
+
await self.add_retriever(component_instance.name,
|
|
1067
|
+
cast(RetrieverBaseConfig, component_instance.config))
|
|
1064
1068
|
# Instantiate a function group
|
|
1065
1069
|
elif component_instance.component_group == ComponentGroup.FUNCTION_GROUPS:
|
|
1066
|
-
await self.add_function_group(component_instance.name,
|
|
1070
|
+
await self.add_function_group(component_instance.name,
|
|
1071
|
+
cast(FunctionGroupBaseConfig, component_instance.config))
|
|
1067
1072
|
# Instantiate a function
|
|
1068
1073
|
elif component_instance.component_group == ComponentGroup.FUNCTIONS:
|
|
1069
1074
|
# If the function is the root, set it as the workflow later
|
|
1070
1075
|
if (not component_instance.is_root):
|
|
1071
|
-
await self.add_function(component_instance.name,
|
|
1076
|
+
await self.add_function(component_instance.name,
|
|
1077
|
+
cast(FunctionBaseConfig, component_instance.config))
|
|
1072
1078
|
elif component_instance.component_group == ComponentGroup.TTC_STRATEGIES:
|
|
1073
|
-
await self.add_ttc_strategy(component_instance.name,
|
|
1079
|
+
await self.add_ttc_strategy(component_instance.name,
|
|
1080
|
+
cast(TTCStrategyBaseConfig, component_instance.config))
|
|
1074
1081
|
|
|
1075
1082
|
elif component_instance.component_group == ComponentGroup.AUTHENTICATION:
|
|
1076
|
-
await self.add_auth_provider(component_instance.name,
|
|
1083
|
+
await self.add_auth_provider(component_instance.name,
|
|
1084
|
+
cast(AuthProviderBaseConfig, component_instance.config))
|
|
1077
1085
|
else:
|
|
1078
1086
|
raise ValueError(f"Unknown component group {component_instance.component_group}")
|
|
1079
1087
|
|
|
@@ -1127,18 +1135,18 @@ class ChildBuilder(Builder):
|
|
|
1127
1135
|
return await self._workflow_builder.add_function_group(name, config)
|
|
1128
1136
|
|
|
1129
1137
|
@override
|
|
1130
|
-
def get_function(self, name: str) -> Function:
|
|
1138
|
+
async def get_function(self, name: str) -> Function:
|
|
1131
1139
|
# If a function tries to get another function, we assume it uses it
|
|
1132
|
-
fn = self._workflow_builder.get_function(name)
|
|
1140
|
+
fn = await self._workflow_builder.get_function(name)
|
|
1133
1141
|
|
|
1134
1142
|
self._dependencies.add_function(name)
|
|
1135
1143
|
|
|
1136
1144
|
return fn
|
|
1137
1145
|
|
|
1138
1146
|
@override
|
|
1139
|
-
def get_function_group(self, name: str) -> FunctionGroup:
|
|
1147
|
+
async def get_function_group(self, name: str) -> FunctionGroup:
|
|
1140
1148
|
# If a function tries to get a function group, we assume it uses it
|
|
1141
|
-
function_group = self._workflow_builder.get_function_group(name)
|
|
1149
|
+
function_group = await self._workflow_builder.get_function_group(name)
|
|
1142
1150
|
|
|
1143
1151
|
self._dependencies.add_function_group(name)
|
|
1144
1152
|
|
|
@@ -1165,10 +1173,10 @@ class ChildBuilder(Builder):
|
|
|
1165
1173
|
return self._workflow_builder.get_workflow_config()
|
|
1166
1174
|
|
|
1167
1175
|
@override
|
|
1168
|
-
def get_tools(self,
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
tools = self._workflow_builder.get_tools(tool_names, wrapper_type)
|
|
1176
|
+
async def get_tools(self,
|
|
1177
|
+
tool_names: Sequence[str | FunctionRef | FunctionGroupRef],
|
|
1178
|
+
wrapper_type: LLMFrameworkEnum | str) -> list[typing.Any]:
|
|
1179
|
+
tools = await self._workflow_builder.get_tools(tool_names, wrapper_type)
|
|
1172
1180
|
for tool_name in tool_names:
|
|
1173
1181
|
if tool_name in self._workflow_builder._function_groups:
|
|
1174
1182
|
self._dependencies.add_function_group(tool_name)
|
|
@@ -1177,20 +1185,21 @@ class ChildBuilder(Builder):
|
|
|
1177
1185
|
return tools
|
|
1178
1186
|
|
|
1179
1187
|
@override
|
|
1180
|
-
def get_tool(self, fn_name: str | FunctionRef, wrapper_type: LLMFrameworkEnum | str):
|
|
1188
|
+
async def get_tool(self, fn_name: str | FunctionRef, wrapper_type: LLMFrameworkEnum | str):
|
|
1181
1189
|
# If a function tries to get another function as a tool, we assume it uses it
|
|
1182
|
-
fn = self._workflow_builder.get_tool(fn_name, wrapper_type)
|
|
1190
|
+
fn = await self._workflow_builder.get_tool(fn_name, wrapper_type)
|
|
1183
1191
|
|
|
1184
1192
|
self._dependencies.add_function(fn_name)
|
|
1185
1193
|
|
|
1186
1194
|
return fn
|
|
1187
1195
|
|
|
1188
1196
|
@override
|
|
1189
|
-
async def add_llm(self, name: str, config: LLMBaseConfig):
|
|
1197
|
+
async def add_llm(self, name: str, config: LLMBaseConfig) -> None:
|
|
1190
1198
|
return await self._workflow_builder.add_llm(name, config)
|
|
1191
1199
|
|
|
1200
|
+
@experimental(feature_name="Authentication")
|
|
1192
1201
|
@override
|
|
1193
|
-
async def add_auth_provider(self, name: str, config: AuthProviderBaseConfig):
|
|
1202
|
+
async def add_auth_provider(self, name: str, config: AuthProviderBaseConfig) -> AuthProviderBase:
|
|
1194
1203
|
return await self._workflow_builder.add_auth_provider(name, config)
|
|
1195
1204
|
|
|
1196
1205
|
@override
|
|
@@ -1198,7 +1207,7 @@ class ChildBuilder(Builder):
|
|
|
1198
1207
|
return await self._workflow_builder.get_auth_provider(auth_provider_name)
|
|
1199
1208
|
|
|
1200
1209
|
@override
|
|
1201
|
-
async def get_llm(self, llm_name: str, wrapper_type: LLMFrameworkEnum | str):
|
|
1210
|
+
async def get_llm(self, llm_name: str, wrapper_type: LLMFrameworkEnum | str) -> typing.Any:
|
|
1202
1211
|
llm = await self._workflow_builder.get_llm(llm_name, wrapper_type)
|
|
1203
1212
|
|
|
1204
1213
|
self._dependencies.add_llm(llm_name)
|
|
@@ -1210,11 +1219,11 @@ class ChildBuilder(Builder):
|
|
|
1210
1219
|
return self._workflow_builder.get_llm_config(llm_name)
|
|
1211
1220
|
|
|
1212
1221
|
@override
|
|
1213
|
-
async def add_embedder(self, name: str, config: EmbedderBaseConfig):
|
|
1214
|
-
|
|
1222
|
+
async def add_embedder(self, name: str, config: EmbedderBaseConfig) -> None:
|
|
1223
|
+
await self._workflow_builder.add_embedder(name, config)
|
|
1215
1224
|
|
|
1216
1225
|
@override
|
|
1217
|
-
async def get_embedder(self, embedder_name: str, wrapper_type: LLMFrameworkEnum | str):
|
|
1226
|
+
async def get_embedder(self, embedder_name: str, wrapper_type: LLMFrameworkEnum | str) -> typing.Any:
|
|
1218
1227
|
embedder = await self._workflow_builder.get_embedder(embedder_name, wrapper_type)
|
|
1219
1228
|
|
|
1220
1229
|
self._dependencies.add_embedder(embedder_name)
|
|
@@ -1230,11 +1239,11 @@ class ChildBuilder(Builder):
|
|
|
1230
1239
|
return await self._workflow_builder.add_memory_client(name, config)
|
|
1231
1240
|
|
|
1232
1241
|
@override
|
|
1233
|
-
def get_memory_client(self, memory_name: str) -> MemoryEditor:
|
|
1242
|
+
async def get_memory_client(self, memory_name: str) -> MemoryEditor:
|
|
1234
1243
|
"""
|
|
1235
1244
|
Return the instantiated memory client for the given name.
|
|
1236
1245
|
"""
|
|
1237
|
-
memory_client = self._workflow_builder.get_memory_client(memory_name)
|
|
1246
|
+
memory_client = await self._workflow_builder.get_memory_client(memory_name)
|
|
1238
1247
|
|
|
1239
1248
|
self._dependencies.add_memory_client(memory_name)
|
|
1240
1249
|
|
|
@@ -1264,8 +1273,9 @@ class ChildBuilder(Builder):
|
|
|
1264
1273
|
return self._workflow_builder.get_object_store_config(object_store_name)
|
|
1265
1274
|
|
|
1266
1275
|
@override
|
|
1267
|
-
|
|
1268
|
-
|
|
1276
|
+
@experimental(feature_name="TTC")
|
|
1277
|
+
async def add_ttc_strategy(self, name: str, config: TTCStrategyBaseConfig) -> None:
|
|
1278
|
+
await self._workflow_builder.add_ttc_strategy(name, config)
|
|
1269
1279
|
|
|
1270
1280
|
@override
|
|
1271
1281
|
async def get_ttc_strategy(self,
|
|
@@ -1286,11 +1296,11 @@ class ChildBuilder(Builder):
|
|
|
1286
1296
|
stage_type=stage_type)
|
|
1287
1297
|
|
|
1288
1298
|
@override
|
|
1289
|
-
async def add_retriever(self, name: str, config: RetrieverBaseConfig):
|
|
1290
|
-
|
|
1299
|
+
async def add_retriever(self, name: str, config: RetrieverBaseConfig) -> None:
|
|
1300
|
+
await self._workflow_builder.add_retriever(name, config)
|
|
1291
1301
|
|
|
1292
1302
|
@override
|
|
1293
|
-
async def get_retriever(self, retriever_name: str, wrapper_type: LLMFrameworkEnum | str | None = None):
|
|
1303
|
+
async def get_retriever(self, retriever_name: str, wrapper_type: LLMFrameworkEnum | str | None = None) -> Retriever:
|
|
1294
1304
|
if not wrapper_type:
|
|
1295
1305
|
return await self._workflow_builder.get_retriever(retriever_name=retriever_name)
|
|
1296
1306
|
return await self._workflow_builder.get_retriever(retriever_name=retriever_name, wrapper_type=wrapper_type)
|
nat/cli/commands/info/info.py
CHANGED
|
@@ -13,15 +13,10 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
-
import logging
|
|
17
|
-
|
|
18
16
|
import click
|
|
19
17
|
|
|
20
18
|
from nat.cli.commands.info.list_channels import list_channels
|
|
21
19
|
from nat.cli.commands.info.list_components import list_components
|
|
22
|
-
from nat.cli.commands.info.list_mcp import list_mcp
|
|
23
|
-
|
|
24
|
-
logger = logging.getLogger(__name__)
|
|
25
20
|
|
|
26
21
|
|
|
27
22
|
@click.group(name=__name__, invoke_without_command=False, help="Provide information about the local NAT environment.")
|
|
@@ -34,4 +29,19 @@ def info_command(**kwargs):
|
|
|
34
29
|
|
|
35
30
|
info_command.add_command(list_components, name="components")
|
|
36
31
|
info_command.add_command(list_channels, "channels")
|
|
37
|
-
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
@click.command(
|
|
35
|
+
name="mcp",
|
|
36
|
+
help="Removed. Use 'nat mcp client' instead.",
|
|
37
|
+
)
|
|
38
|
+
def info_mcp_deprecated():
|
|
39
|
+
"""
|
|
40
|
+
Removing support for the old 'nat info mcp' command.
|
|
41
|
+
"""
|
|
42
|
+
raise click.UsageError("The 'nat info mcp' command has been removed. "
|
|
43
|
+
"Use the new 'nat mcp client' commands instead")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
# Register deprecated shim so `nat info mcp` shows guidance
|
|
47
|
+
info_command.add_command(info_mcp_deprecated, name="mcp")
|
|
@@ -0,0 +1,14 @@
|
|
|
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.
|