nvidia-nat 1.4.0a20251120__py3-none-any.whl → 1.4.0a20260113__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 +1 -1
- nat/{front_ends/mcp → agent/auto_memory_wrapper}/__init__.py +1 -1
- nat/agent/auto_memory_wrapper/agent.py +278 -0
- nat/agent/auto_memory_wrapper/register.py +227 -0
- nat/agent/auto_memory_wrapper/state.py +30 -0
- nat/agent/base.py +1 -1
- nat/agent/dual_node.py +1 -1
- nat/agent/prompt_optimizer/prompt.py +1 -1
- nat/agent/prompt_optimizer/register.py +1 -1
- nat/agent/react_agent/agent.py +16 -9
- nat/agent/react_agent/output_parser.py +2 -2
- nat/agent/react_agent/prompt.py +3 -2
- nat/agent/react_agent/register.py +2 -2
- nat/agent/react_agent/register_per_user_agent.py +104 -0
- nat/agent/reasoning_agent/reasoning_agent.py +1 -1
- nat/agent/register.py +3 -1
- nat/agent/responses_api_agent/__init__.py +1 -1
- nat/agent/responses_api_agent/register.py +1 -1
- nat/agent/rewoo_agent/agent.py +9 -4
- nat/agent/rewoo_agent/prompt.py +1 -1
- nat/agent/rewoo_agent/register.py +1 -1
- nat/agent/tool_calling_agent/agent.py +5 -4
- nat/agent/tool_calling_agent/register.py +1 -1
- nat/authentication/__init__.py +1 -1
- nat/authentication/api_key/__init__.py +1 -1
- nat/authentication/api_key/api_key_auth_provider.py +1 -1
- nat/authentication/api_key/api_key_auth_provider_config.py +22 -7
- nat/authentication/api_key/register.py +1 -1
- nat/authentication/credential_validator/__init__.py +1 -1
- nat/authentication/credential_validator/bearer_token_validator.py +1 -1
- nat/authentication/exceptions/__init__.py +1 -1
- nat/authentication/exceptions/api_key_exceptions.py +1 -1
- nat/authentication/http_basic_auth/http_basic_auth_provider.py +1 -1
- nat/authentication/http_basic_auth/register.py +1 -1
- nat/authentication/interfaces.py +1 -1
- nat/authentication/oauth2/__init__.py +1 -1
- nat/authentication/oauth2/oauth2_auth_code_flow_provider.py +1 -1
- nat/authentication/oauth2/oauth2_auth_code_flow_provider_config.py +1 -1
- nat/authentication/oauth2/oauth2_resource_server_config.py +1 -1
- nat/authentication/oauth2/register.py +1 -1
- nat/authentication/register.py +1 -1
- nat/builder/builder.py +511 -1
- nat/builder/child_builder.py +385 -0
- nat/builder/component_utils.py +28 -4
- nat/builder/context.py +17 -1
- nat/builder/embedder.py +1 -1
- nat/builder/eval_builder.py +19 -7
- nat/builder/evaluator.py +1 -1
- nat/builder/framework_enum.py +2 -1
- nat/builder/front_end.py +1 -1
- nat/builder/function.py +40 -3
- nat/builder/function_base.py +1 -1
- nat/builder/function_info.py +1 -1
- nat/builder/intermediate_step_manager.py +1 -1
- nat/builder/llm.py +1 -1
- nat/builder/per_user_workflow_builder.py +843 -0
- nat/builder/retriever.py +1 -1
- nat/builder/sync_builder.py +571 -0
- nat/builder/user_interaction_manager.py +1 -1
- nat/builder/workflow.py +1 -1
- nat/builder/workflow_builder.py +536 -424
- nat/cli/__init__.py +1 -1
- nat/cli/cli_utils/config_override.py +1 -1
- nat/cli/cli_utils/validation.py +32 -1
- nat/cli/commands/configure/channel/add.py +1 -1
- nat/cli/commands/configure/channel/channel.py +1 -1
- nat/cli/commands/configure/channel/remove.py +1 -1
- nat/cli/commands/configure/channel/update.py +1 -1
- nat/cli/commands/configure/configure.py +1 -1
- nat/cli/commands/evaluate.py +87 -13
- nat/cli/commands/finetune.py +132 -0
- nat/cli/commands/info/__init__.py +1 -1
- nat/cli/commands/info/info.py +1 -1
- nat/cli/commands/info/list_channels.py +1 -1
- nat/cli/commands/info/list_components.py +1 -1
- nat/cli/commands/object_store/__init__.py +1 -1
- nat/cli/commands/object_store/object_store.py +1 -1
- nat/cli/commands/optimize.py +1 -1
- nat/cli/commands/{mcp → red_teaming}/__init__.py +1 -1
- nat/cli/commands/red_teaming/red_teaming.py +138 -0
- nat/cli/commands/red_teaming/red_teaming_utils.py +73 -0
- nat/cli/commands/registry/__init__.py +1 -1
- nat/cli/commands/registry/publish.py +1 -1
- nat/cli/commands/registry/pull.py +1 -1
- nat/cli/commands/registry/registry.py +1 -1
- nat/cli/commands/registry/remove.py +1 -1
- nat/cli/commands/registry/search.py +1 -1
- nat/cli/commands/sizing/__init__.py +1 -1
- nat/cli/commands/sizing/calc.py +1 -1
- nat/cli/commands/sizing/sizing.py +1 -1
- nat/cli/commands/start.py +1 -1
- nat/cli/commands/uninstall.py +1 -1
- nat/cli/commands/validate.py +1 -1
- nat/cli/commands/workflow/__init__.py +1 -1
- nat/cli/commands/workflow/workflow.py +1 -1
- nat/cli/commands/workflow/workflow_commands.py +3 -2
- nat/cli/entrypoint.py +15 -37
- nat/cli/main.py +2 -2
- nat/cli/plugin_loader.py +69 -0
- nat/cli/register_workflow.py +183 -5
- nat/cli/type_registry.py +169 -3
- nat/control_flow/register.py +1 -1
- nat/control_flow/router_agent/agent.py +1 -1
- nat/control_flow/router_agent/prompt.py +1 -1
- nat/control_flow/router_agent/register.py +1 -1
- nat/control_flow/sequential_executor.py +28 -7
- nat/data_models/__init__.py +1 -1
- nat/data_models/agent.py +1 -1
- nat/data_models/api_server.py +38 -3
- nat/data_models/authentication.py +1 -1
- nat/data_models/common.py +1 -1
- nat/data_models/component.py +7 -1
- nat/data_models/component_ref.py +34 -1
- nat/data_models/config.py +62 -1
- nat/data_models/dataset_handler.py +15 -2
- nat/data_models/discovery_metadata.py +1 -1
- nat/data_models/embedder.py +1 -1
- nat/data_models/evaluate.py +6 -1
- nat/data_models/evaluator.py +1 -1
- nat/data_models/finetuning.py +260 -0
- nat/data_models/front_end.py +1 -1
- nat/data_models/function.py +1 -1
- nat/data_models/function_dependencies.py +1 -1
- nat/data_models/gated_field_mixin.py +1 -1
- nat/data_models/interactive.py +1 -1
- nat/data_models/intermediate_step.py +29 -2
- nat/data_models/invocation_node.py +1 -1
- nat/data_models/llm.py +1 -1
- nat/data_models/logging.py +1 -1
- nat/data_models/memory.py +1 -1
- nat/data_models/middleware.py +3 -1
- nat/data_models/object_store.py +1 -1
- nat/data_models/openai_mcp.py +1 -1
- nat/data_models/optimizable.py +1 -1
- nat/data_models/optimizer.py +1 -1
- nat/data_models/profiler.py +1 -1
- nat/data_models/registry_handler.py +1 -1
- nat/data_models/retriever.py +1 -1
- nat/data_models/retry_mixin.py +1 -1
- nat/data_models/runtime_enum.py +1 -1
- nat/data_models/span.py +1 -1
- nat/data_models/step_adaptor.py +1 -1
- nat/data_models/streaming.py +1 -1
- nat/data_models/swe_bench_model.py +1 -1
- nat/data_models/telemetry_exporter.py +1 -1
- nat/data_models/thinking_mixin.py +1 -1
- nat/data_models/ttc_strategy.py +1 -1
- nat/embedder/azure_openai_embedder.py +1 -1
- nat/embedder/nim_embedder.py +1 -1
- nat/embedder/openai_embedder.py +1 -1
- nat/embedder/register.py +1 -1
- nat/eval/__init__.py +1 -1
- nat/eval/config.py +8 -1
- nat/eval/dataset_handler/dataset_downloader.py +1 -1
- nat/eval/dataset_handler/dataset_filter.py +1 -1
- nat/eval/dataset_handler/dataset_handler.py +4 -2
- nat/eval/evaluate.py +217 -80
- nat/eval/evaluator/__init__.py +1 -1
- nat/eval/evaluator/base_evaluator.py +2 -2
- nat/eval/evaluator/evaluator_model.py +3 -2
- nat/eval/intermediate_step_adapter.py +1 -1
- nat/eval/llm_validator.py +336 -0
- nat/eval/rag_evaluator/evaluate.py +17 -10
- nat/eval/rag_evaluator/register.py +1 -1
- nat/eval/red_teaming_evaluator/__init__.py +14 -0
- nat/eval/red_teaming_evaluator/data_models.py +66 -0
- nat/eval/red_teaming_evaluator/evaluate.py +327 -0
- nat/eval/red_teaming_evaluator/filter_conditions.py +75 -0
- nat/eval/red_teaming_evaluator/register.py +55 -0
- nat/eval/register.py +2 -1
- nat/eval/remote_workflow.py +1 -1
- nat/eval/runners/__init__.py +1 -1
- nat/eval/runners/config.py +1 -1
- nat/eval/runners/multi_eval_runner.py +1 -1
- nat/eval/runners/red_teaming_runner/__init__.py +24 -0
- nat/eval/runners/red_teaming_runner/config.py +282 -0
- nat/eval/runners/red_teaming_runner/report_utils.py +707 -0
- nat/eval/runners/red_teaming_runner/runner.py +867 -0
- nat/eval/runtime_evaluator/__init__.py +1 -1
- nat/eval/runtime_evaluator/evaluate.py +1 -1
- nat/eval/runtime_evaluator/register.py +1 -1
- nat/eval/runtime_event_subscriber.py +1 -1
- nat/eval/swe_bench_evaluator/evaluate.py +1 -1
- nat/eval/swe_bench_evaluator/register.py +1 -1
- nat/eval/trajectory_evaluator/evaluate.py +2 -2
- nat/eval/trajectory_evaluator/register.py +1 -1
- nat/eval/tunable_rag_evaluator/evaluate.py +5 -5
- nat/eval/tunable_rag_evaluator/register.py +1 -1
- nat/eval/usage_stats.py +1 -1
- nat/eval/utils/eval_trace_ctx.py +1 -1
- nat/eval/utils/output_uploader.py +1 -1
- nat/eval/utils/tqdm_position_registry.py +1 -1
- nat/eval/utils/weave_eval.py +1 -1
- nat/experimental/decorators/experimental_warning_decorator.py +1 -1
- nat/experimental/test_time_compute/editing/iterative_plan_refinement_editor.py +1 -1
- nat/experimental/test_time_compute/editing/llm_as_a_judge_editor.py +1 -1
- nat/experimental/test_time_compute/editing/motivation_aware_summarization.py +1 -1
- nat/experimental/test_time_compute/functions/execute_score_select_function.py +1 -1
- nat/experimental/test_time_compute/functions/multi_llm_judge_function.py +88 -0
- nat/experimental/test_time_compute/functions/plan_select_execute_function.py +1 -1
- 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/editor_config.py +1 -1
- nat/experimental/test_time_compute/models/scoring_config.py +1 -1
- nat/experimental/test_time_compute/models/search_config.py +20 -2
- nat/experimental/test_time_compute/models/selection_config.py +33 -2
- nat/experimental/test_time_compute/models/stage_enums.py +1 -1
- nat/experimental/test_time_compute/models/strategy_base.py +1 -1
- nat/experimental/test_time_compute/models/tool_use_config.py +1 -1
- nat/experimental/test_time_compute/models/ttc_item.py +1 -1
- nat/experimental/test_time_compute/register.py +4 -1
- nat/experimental/test_time_compute/scoring/llm_based_agent_scorer.py +1 -1
- nat/experimental/test_time_compute/scoring/llm_based_plan_scorer.py +1 -1
- nat/experimental/test_time_compute/scoring/motivation_aware_scorer.py +1 -1
- nat/experimental/test_time_compute/search/multi_llm_generation.py +115 -0
- nat/experimental/test_time_compute/search/multi_llm_planner.py +1 -1
- nat/experimental/test_time_compute/search/multi_query_retrieval_search.py +1 -1
- nat/experimental/test_time_compute/search/single_shot_multi_plan_planner.py +1 -1
- nat/experimental/test_time_compute/selection/best_of_n_selector.py +1 -1
- nat/experimental/test_time_compute/selection/llm_based_agent_output_selector.py +1 -1
- nat/experimental/test_time_compute/selection/llm_based_output_merging_selector.py +1 -1
- nat/experimental/test_time_compute/selection/llm_based_plan_selector.py +1 -1
- nat/experimental/test_time_compute/selection/llm_judge_selection.py +127 -0
- nat/experimental/test_time_compute/selection/threshold_selector.py +1 -1
- nat/finetuning/__init__.py +24 -0
- nat/finetuning/finetuning_runtime.py +143 -0
- nat/finetuning/interfaces/__init__.py +24 -0
- nat/finetuning/interfaces/finetuning_runner.py +261 -0
- nat/finetuning/interfaces/trainer_adapter.py +103 -0
- nat/finetuning/interfaces/trajectory_builder.py +115 -0
- nat/finetuning/utils/__init__.py +15 -0
- nat/finetuning/utils/parsers/__init__.py +15 -0
- nat/finetuning/utils/parsers/adk_parser.py +141 -0
- nat/finetuning/utils/parsers/base_parser.py +238 -0
- nat/finetuning/utils/parsers/common.py +91 -0
- nat/finetuning/utils/parsers/langchain_parser.py +267 -0
- nat/finetuning/utils/parsers/llama_index_parser.py +218 -0
- nat/front_ends/__init__.py +1 -1
- nat/front_ends/console/__init__.py +1 -1
- nat/front_ends/console/authentication_flow_handler.py +1 -1
- nat/front_ends/console/console_front_end_config.py +4 -1
- nat/front_ends/console/console_front_end_plugin.py +5 -4
- nat/front_ends/console/register.py +1 -1
- nat/front_ends/cron/__init__.py +1 -1
- nat/front_ends/fastapi/__init__.py +1 -1
- nat/front_ends/fastapi/async_job.py +128 -0
- nat/front_ends/fastapi/auth_flow_handlers/http_flow_handler.py +1 -1
- nat/front_ends/fastapi/auth_flow_handlers/websocket_flow_handler.py +13 -9
- nat/front_ends/fastapi/dask_client_mixin.py +1 -1
- nat/front_ends/fastapi/fastapi_front_end_config.py +1 -1
- nat/front_ends/fastapi/fastapi_front_end_controller.py +1 -1
- nat/front_ends/fastapi/fastapi_front_end_plugin.py +25 -30
- nat/front_ends/fastapi/fastapi_front_end_plugin_worker.py +195 -60
- nat/front_ends/fastapi/html_snippets/__init__.py +1 -1
- nat/front_ends/fastapi/html_snippets/auth_code_grant_success.py +1 -1
- nat/front_ends/fastapi/intermediate_steps_subscriber.py +12 -1
- nat/front_ends/fastapi/job_store.py +23 -11
- nat/front_ends/fastapi/main.py +1 -1
- nat/front_ends/fastapi/message_handler.py +27 -4
- nat/front_ends/fastapi/message_validator.py +54 -2
- nat/front_ends/fastapi/register.py +1 -1
- nat/front_ends/fastapi/response_helpers.py +16 -15
- nat/front_ends/fastapi/step_adaptor.py +1 -1
- nat/front_ends/fastapi/utils.py +1 -1
- nat/front_ends/register.py +1 -2
- nat/front_ends/simple_base/__init__.py +1 -1
- nat/front_ends/simple_base/simple_front_end_plugin_base.py +6 -4
- nat/llm/aws_bedrock_llm.py +1 -1
- nat/llm/azure_openai_llm.py +10 -1
- nat/llm/dynamo_llm.py +363 -0
- nat/llm/huggingface_llm.py +177 -0
- nat/llm/litellm_llm.py +1 -1
- nat/llm/nim_llm.py +1 -1
- nat/llm/openai_llm.py +1 -1
- nat/llm/register.py +3 -1
- nat/llm/utils/__init__.py +1 -1
- nat/llm/utils/env_config_value.py +1 -1
- nat/llm/utils/error.py +1 -1
- nat/llm/utils/thinking.py +1 -1
- nat/memory/__init__.py +1 -1
- nat/memory/interfaces.py +1 -1
- nat/memory/models.py +1 -1
- nat/meta/pypi.md +1 -1
- nat/middleware/__init__.py +5 -5
- nat/middleware/cache/__init__.py +14 -0
- nat/middleware/{cache_middleware.py → cache/cache_middleware.py} +39 -42
- nat/middleware/cache/cache_middleware_config.py +44 -0
- nat/middleware/cache/register.py +33 -0
- nat/middleware/defense/__init__.py +14 -0
- nat/middleware/defense/defense_middleware.py +362 -0
- nat/middleware/defense/defense_middleware_content_guard.py +455 -0
- nat/middleware/defense/defense_middleware_data_models.py +91 -0
- nat/middleware/defense/defense_middleware_output_verifier.py +440 -0
- nat/middleware/defense/defense_middleware_pii.py +356 -0
- nat/middleware/defense/register.py +82 -0
- nat/middleware/dynamic/__init__.py +14 -0
- nat/middleware/dynamic/dynamic_function_middleware.py +962 -0
- nat/middleware/dynamic/dynamic_middleware_config.py +132 -0
- nat/middleware/dynamic/register.py +34 -0
- nat/middleware/function_middleware.py +236 -52
- nat/middleware/logging/__init__.py +14 -0
- nat/middleware/logging/logging_middleware.py +67 -0
- nat/middleware/logging/logging_middleware_config.py +28 -0
- nat/middleware/logging/register.py +33 -0
- nat/middleware/middleware.py +142 -28
- nat/middleware/red_teaming/__init__.py +14 -0
- nat/middleware/red_teaming/red_teaming_middleware.py +344 -0
- nat/middleware/red_teaming/red_teaming_middleware_config.py +112 -0
- nat/middleware/red_teaming/register.py +47 -0
- nat/middleware/register.py +7 -20
- nat/middleware/utils/__init__.py +14 -0
- nat/middleware/utils/workflow_inventory.py +155 -0
- nat/object_store/__init__.py +1 -1
- nat/object_store/in_memory_object_store.py +1 -1
- nat/object_store/interfaces.py +1 -1
- nat/object_store/models.py +1 -1
- nat/object_store/register.py +1 -1
- nat/observability/__init__.py +1 -1
- nat/observability/exporter/__init__.py +1 -1
- nat/observability/exporter/base_exporter.py +1 -1
- nat/observability/exporter/exporter.py +1 -1
- nat/observability/exporter/file_exporter.py +1 -1
- nat/observability/exporter/processing_exporter.py +1 -1
- nat/observability/exporter/raw_exporter.py +1 -1
- nat/observability/exporter/span_exporter.py +7 -1
- nat/observability/exporter_manager.py +1 -1
- nat/observability/mixin/__init__.py +1 -1
- nat/observability/mixin/batch_config_mixin.py +1 -1
- nat/observability/mixin/collector_config_mixin.py +1 -1
- nat/observability/mixin/file_mixin.py +1 -1
- nat/observability/mixin/file_mode.py +1 -1
- nat/observability/mixin/redaction_config_mixin.py +1 -1
- nat/observability/mixin/resource_conflict_mixin.py +1 -1
- nat/observability/mixin/serialize_mixin.py +1 -1
- nat/observability/mixin/tagging_config_mixin.py +1 -1
- nat/observability/mixin/type_introspection_mixin.py +1 -1
- nat/observability/processor/__init__.py +1 -1
- nat/observability/processor/batching_processor.py +1 -1
- nat/observability/processor/callback_processor.py +1 -1
- nat/observability/processor/falsy_batch_filter_processor.py +1 -1
- nat/observability/processor/intermediate_step_serializer.py +1 -1
- nat/observability/processor/processor.py +1 -1
- nat/observability/processor/processor_factory.py +1 -1
- nat/observability/processor/redaction/__init__.py +1 -1
- nat/observability/processor/redaction/contextual_redaction_processor.py +1 -1
- nat/observability/processor/redaction/contextual_span_redaction_processor.py +1 -1
- nat/observability/processor/redaction/redaction_processor.py +1 -1
- nat/observability/processor/redaction/span_header_redaction_processor.py +1 -1
- nat/observability/processor/span_tagging_processor.py +1 -1
- nat/observability/register.py +1 -1
- nat/observability/utils/__init__.py +1 -1
- nat/observability/utils/dict_utils.py +1 -1
- nat/observability/utils/time_utils.py +1 -1
- nat/profiler/calc/__init__.py +1 -1
- nat/profiler/calc/calc_runner.py +3 -3
- nat/profiler/calc/calculations.py +1 -1
- nat/profiler/calc/data_models.py +1 -1
- nat/profiler/calc/plot.py +30 -3
- nat/profiler/callbacks/agno_callback_handler.py +1 -1
- nat/profiler/callbacks/base_callback_class.py +1 -1
- nat/profiler/callbacks/langchain_callback_handler.py +33 -3
- nat/profiler/callbacks/llama_index_callback_handler.py +13 -10
- nat/profiler/callbacks/semantic_kernel_callback_handler.py +1 -1
- nat/profiler/callbacks/token_usage_base_model.py +1 -1
- nat/profiler/data_frame_row.py +1 -1
- nat/profiler/data_models.py +1 -1
- nat/profiler/decorators/framework_wrapper.py +16 -1
- nat/profiler/decorators/function_tracking.py +1 -1
- nat/profiler/forecasting/config.py +1 -1
- nat/profiler/forecasting/model_trainer.py +1 -1
- nat/profiler/forecasting/models/__init__.py +1 -1
- nat/profiler/forecasting/models/forecasting_base_model.py +1 -1
- nat/profiler/forecasting/models/linear_model.py +1 -1
- nat/profiler/forecasting/models/random_forest_regressor.py +1 -1
- nat/profiler/inference_metrics_model.py +1 -1
- nat/profiler/inference_optimization/bottleneck_analysis/nested_stack_analysis.py +1 -1
- nat/profiler/inference_optimization/bottleneck_analysis/simple_stack_analysis.py +1 -1
- nat/profiler/inference_optimization/data_models.py +1 -1
- nat/profiler/inference_optimization/experimental/concurrency_spike_analysis.py +1 -1
- nat/profiler/inference_optimization/experimental/prefix_span_analysis.py +1 -1
- nat/profiler/inference_optimization/llm_metrics.py +1 -1
- nat/profiler/inference_optimization/prompt_caching.py +1 -1
- nat/profiler/inference_optimization/token_uniqueness.py +1 -1
- nat/profiler/inference_optimization/workflow_runtimes.py +1 -1
- nat/profiler/intermediate_property_adapter.py +1 -1
- nat/profiler/parameter_optimization/optimizable_utils.py +1 -1
- nat/profiler/parameter_optimization/optimizer_runtime.py +1 -1
- nat/profiler/parameter_optimization/parameter_optimizer.py +1 -1
- nat/profiler/parameter_optimization/parameter_selection.py +1 -1
- nat/profiler/parameter_optimization/pareto_visualizer.py +1 -1
- nat/profiler/parameter_optimization/prompt_optimizer.py +1 -1
- nat/profiler/parameter_optimization/update_helpers.py +1 -1
- nat/profiler/profile_runner.py +1 -1
- nat/profiler/utils.py +1 -1
- nat/registry_handlers/local/local_handler.py +1 -1
- nat/registry_handlers/local/register_local.py +1 -1
- nat/registry_handlers/metadata_factory.py +1 -1
- nat/registry_handlers/package_utils.py +1 -1
- nat/registry_handlers/pypi/pypi_handler.py +1 -1
- nat/registry_handlers/pypi/register_pypi.py +1 -1
- nat/registry_handlers/register.py +1 -1
- nat/registry_handlers/registry_handler_base.py +1 -1
- nat/registry_handlers/rest/register_rest.py +1 -1
- nat/registry_handlers/rest/rest_handler.py +1 -1
- nat/registry_handlers/schemas/headers.py +1 -1
- nat/registry_handlers/schemas/package.py +1 -1
- nat/registry_handlers/schemas/publish.py +1 -1
- nat/registry_handlers/schemas/pull.py +1 -1
- nat/registry_handlers/schemas/remove.py +1 -1
- nat/registry_handlers/schemas/search.py +1 -1
- nat/registry_handlers/schemas/status.py +1 -1
- nat/retriever/interface.py +1 -1
- nat/retriever/milvus/__init__.py +1 -1
- nat/retriever/milvus/register.py +1 -1
- nat/retriever/milvus/retriever.py +1 -1
- nat/retriever/models.py +1 -1
- nat/retriever/nemo_retriever/__init__.py +1 -1
- nat/retriever/nemo_retriever/register.py +1 -1
- nat/retriever/nemo_retriever/retriever.py +5 -5
- nat/retriever/register.py +1 -1
- nat/runtime/__init__.py +1 -1
- nat/runtime/loader.py +10 -3
- nat/runtime/metrics.py +180 -0
- nat/runtime/runner.py +1 -5
- nat/runtime/session.py +451 -32
- nat/runtime/user_metadata.py +1 -1
- nat/settings/global_settings.py +1 -1
- nat/tool/chat_completion.py +1 -1
- nat/tool/code_execution/README.md +1 -1
- nat/tool/code_execution/code_sandbox.py +1 -1
- nat/tool/code_execution/local_sandbox/Dockerfile.sandbox +1 -1
- nat/tool/code_execution/local_sandbox/__init__.py +1 -1
- nat/tool/code_execution/local_sandbox/local_sandbox_server.py +1 -1
- nat/tool/code_execution/local_sandbox/start_local_sandbox.sh +1 -1
- nat/tool/code_execution/register.py +1 -1
- nat/tool/code_execution/utils.py +1 -1
- nat/tool/datetime_tools.py +1 -1
- nat/tool/document_search.py +1 -1
- nat/tool/github_tools.py +1 -1
- nat/tool/memory_tools/add_memory_tool.py +1 -1
- nat/tool/memory_tools/delete_memory_tool.py +1 -1
- nat/tool/memory_tools/get_memory_tool.py +1 -1
- nat/tool/nvidia_rag.py +2 -2
- nat/tool/register.py +1 -1
- nat/tool/retriever.py +1 -1
- nat/tool/server_tools.py +1 -1
- nat/utils/__init__.py +8 -5
- nat/utils/callable_utils.py +1 -1
- nat/utils/data_models/schema_validator.py +1 -1
- nat/utils/debugging_utils.py +1 -1
- nat/utils/decorators.py +1 -1
- nat/utils/dump_distro_mapping.py +1 -1
- nat/utils/exception_handlers/automatic_retries.py +3 -3
- nat/utils/exception_handlers/schemas.py +1 -1
- nat/utils/io/model_processing.py +1 -1
- nat/utils/io/supress_logs.py +33 -0
- nat/utils/io/yaml_tools.py +1 -1
- nat/utils/log_levels.py +1 -1
- nat/utils/log_utils.py +13 -1
- nat/utils/metadata_utils.py +1 -1
- nat/utils/optional_imports.py +1 -1
- nat/utils/producer_consumer_queue.py +1 -1
- nat/utils/reactive/base/observable_base.py +1 -1
- nat/utils/reactive/base/observer_base.py +1 -1
- nat/utils/reactive/base/subject_base.py +1 -1
- nat/utils/reactive/observable.py +1 -1
- nat/utils/reactive/observer.py +1 -1
- nat/utils/reactive/subject.py +1 -1
- nat/utils/reactive/subscription.py +1 -1
- nat/utils/responses_api.py +1 -1
- nat/utils/settings/global_settings.py +1 -1
- nat/utils/string_utils.py +1 -1
- nat/utils/type_converter.py +18 -5
- nat/utils/type_utils.py +1 -1
- nat/utils/url_utils.py +1 -1
- {nvidia_nat-1.4.0a20251120.dist-info → nvidia_nat-1.4.0a20260113.dist-info}/METADATA +39 -14
- nvidia_nat-1.4.0a20260113.dist-info/RECORD +547 -0
- nvidia_nat-1.4.0a20260113.dist-info/entry_points.txt +38 -0
- nat/cli/commands/mcp/mcp.py +0 -986
- nat/front_ends/mcp/introspection_token_verifier.py +0 -73
- nat/front_ends/mcp/mcp_front_end_config.py +0 -109
- nat/front_ends/mcp/mcp_front_end_plugin.py +0 -155
- nat/front_ends/mcp/mcp_front_end_plugin_worker.py +0 -388
- nat/front_ends/mcp/memory_profiler.py +0 -320
- nat/front_ends/mcp/register.py +0 -27
- nat/front_ends/mcp/tool_converter.py +0 -321
- nvidia_nat-1.4.0a20251120.dist-info/RECORD +0 -488
- nvidia_nat-1.4.0a20251120.dist-info/entry_points.txt +0 -23
- {nvidia_nat-1.4.0a20251120.dist-info → nvidia_nat-1.4.0a20260113.dist-info}/WHEEL +0 -0
- {nvidia_nat-1.4.0a20251120.dist-info → nvidia_nat-1.4.0a20260113.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
- {nvidia_nat-1.4.0a20251120.dist-info → nvidia_nat-1.4.0a20260113.dist-info}/licenses/LICENSE.md +0 -0
- {nvidia_nat-1.4.0a20251120.dist-info → nvidia_nat-1.4.0a20260113.dist-info}/top_level.txt +0 -0
nat/cli/type_registry.py
CHANGED
|
@@ -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");
|
|
@@ -22,6 +22,7 @@ from contextlib import contextmanager
|
|
|
22
22
|
from copy import deepcopy
|
|
23
23
|
from functools import cached_property
|
|
24
24
|
from logging import Handler
|
|
25
|
+
from typing import Self
|
|
25
26
|
|
|
26
27
|
from pydantic import BaseModel
|
|
27
28
|
from pydantic import ConfigDict
|
|
@@ -29,6 +30,7 @@ from pydantic import Field
|
|
|
29
30
|
from pydantic import Tag
|
|
30
31
|
from pydantic import computed_field
|
|
31
32
|
from pydantic import field_validator
|
|
33
|
+
from pydantic import model_validator
|
|
32
34
|
|
|
33
35
|
from nat.authentication.interfaces import AuthProviderBase
|
|
34
36
|
from nat.builder.builder import Builder
|
|
@@ -52,6 +54,12 @@ from nat.data_models.embedder import EmbedderBaseConfig
|
|
|
52
54
|
from nat.data_models.embedder import EmbedderBaseConfigT
|
|
53
55
|
from nat.data_models.evaluator import EvaluatorBaseConfig
|
|
54
56
|
from nat.data_models.evaluator import EvaluatorBaseConfigT
|
|
57
|
+
from nat.data_models.finetuning import TrainerAdapterConfig
|
|
58
|
+
from nat.data_models.finetuning import TrainerAdapterConfigT
|
|
59
|
+
from nat.data_models.finetuning import TrainerConfig
|
|
60
|
+
from nat.data_models.finetuning import TrainerConfigT
|
|
61
|
+
from nat.data_models.finetuning import TrajectoryBuilderConfig
|
|
62
|
+
from nat.data_models.finetuning import TrajectoryBuilderConfigT
|
|
55
63
|
from nat.data_models.front_end import FrontEndBaseConfig
|
|
56
64
|
from nat.data_models.front_end import FrontEndConfigT
|
|
57
65
|
from nat.data_models.function import FunctionBaseConfig
|
|
@@ -77,6 +85,9 @@ from nat.data_models.telemetry_exporter import TelemetryExporterConfigT
|
|
|
77
85
|
from nat.data_models.ttc_strategy import TTCStrategyBaseConfig
|
|
78
86
|
from nat.data_models.ttc_strategy import TTCStrategyBaseConfigT
|
|
79
87
|
from nat.experimental.test_time_compute.models.strategy_base import StrategyBase
|
|
88
|
+
from nat.finetuning.interfaces.finetuning_runner import Trainer
|
|
89
|
+
from nat.finetuning.interfaces.trainer_adapter import TrainerAdapter
|
|
90
|
+
from nat.finetuning.interfaces.trajectory_builder import TrajectoryBuilder
|
|
80
91
|
from nat.memory.interfaces import MemoryEditor
|
|
81
92
|
from nat.middleware.middleware import Middleware
|
|
82
93
|
from nat.object_store.interfaces import ObjectStore
|
|
@@ -89,6 +100,9 @@ AuthProviderBuildCallableT = Callable[[AuthProviderBaseConfigT, Builder], AsyncI
|
|
|
89
100
|
EmbedderClientBuildCallableT = Callable[[EmbedderBaseConfigT, Builder], AsyncIterator[typing.Any]]
|
|
90
101
|
EmbedderProviderBuildCallableT = Callable[[EmbedderBaseConfigT, Builder], AsyncIterator[EmbedderProviderInfo]]
|
|
91
102
|
EvaluatorBuildCallableT = Callable[[EvaluatorBaseConfigT, EvalBuilder], AsyncIterator[EvaluatorInfo]]
|
|
103
|
+
TrainerBuildCallableT = Callable[[TrainerConfigT, Builder], AsyncIterator[Trainer]]
|
|
104
|
+
TrainerAdapterBuildCallableT = Callable[[TrainerAdapterConfigT, Builder], AsyncIterator[TrainerAdapter]]
|
|
105
|
+
TrajectoryBuilderBuildCallableT = Callable[[TrajectoryBuilderConfigT, Builder], AsyncIterator[TrajectoryBuilder]]
|
|
92
106
|
FrontEndBuildCallableT = Callable[[FrontEndConfigT, Config], AsyncIterator[FrontEndBase]]
|
|
93
107
|
FunctionBuildCallableT = Callable[[FunctionConfigT, Builder], AsyncIterator[FunctionInfo | Callable | FunctionBase]]
|
|
94
108
|
FunctionGroupBuildCallableT = Callable[[FunctionGroupConfigT, Builder], AsyncIterator[FunctionGroup]]
|
|
@@ -111,12 +125,17 @@ EmbedderClientRegisteredCallableT = Callable[[EmbedderBaseConfigT, Builder], Abs
|
|
|
111
125
|
EmbedderProviderRegisteredCallableT = Callable[[EmbedderBaseConfigT, Builder],
|
|
112
126
|
AbstractAsyncContextManager[EmbedderProviderInfo]]
|
|
113
127
|
EvaluatorRegisteredCallableT = Callable[[EvaluatorBaseConfigT, EvalBuilder], AbstractAsyncContextManager[EvaluatorInfo]]
|
|
128
|
+
TrainerRegisteredCallableT = Callable[[TrainerConfigT, Builder], AbstractAsyncContextManager[Trainer]]
|
|
129
|
+
TrainerAdapterRegisteredCallableT = Callable[[TrainerAdapterConfigT, Builder],
|
|
130
|
+
AbstractAsyncContextManager[TrainerAdapter]]
|
|
131
|
+
TrajectoryBuilderRegisteredCallableT = Callable[[TrajectoryBuilderConfigT, Builder],
|
|
132
|
+
AbstractAsyncContextManager[TrajectoryBuilder]]
|
|
114
133
|
FrontEndRegisteredCallableT = Callable[[FrontEndConfigT, Config], AbstractAsyncContextManager[FrontEndBase]]
|
|
115
134
|
FunctionRegisteredCallableT = Callable[[FunctionConfigT, Builder],
|
|
116
135
|
AbstractAsyncContextManager[FunctionInfo | Callable | FunctionBase]]
|
|
117
136
|
FunctionGroupRegisteredCallableT = Callable[[FunctionGroupConfigT, Builder], AbstractAsyncContextManager[FunctionGroup]]
|
|
118
137
|
MiddlewareRegisteredCallableT = Callable[[MiddlewareBaseConfigT, Builder], AbstractAsyncContextManager[Middleware]]
|
|
119
|
-
|
|
138
|
+
TTCStrategyRegisteredCallableT = Callable[[TTCStrategyBaseConfigT, Builder], AbstractAsyncContextManager[StrategyBase]]
|
|
120
139
|
LLMClientRegisteredCallableT = Callable[[LLMBaseConfigT, Builder], AbstractAsyncContextManager[typing.Any]]
|
|
121
140
|
LLMProviderRegisteredCallableT = Callable[[LLMBaseConfigT, Builder], AbstractAsyncContextManager[LLMProviderInfo]]
|
|
122
141
|
LoggingMethodRegisteredCallableT = Callable[[LoggingMethodConfigT, Builder], AbstractAsyncContextManager[typing.Any]]
|
|
@@ -138,6 +157,12 @@ class RegisteredInfo(BaseModel, typing.Generic[TypedBaseModelT]):
|
|
|
138
157
|
config_type: type[TypedBaseModelT]
|
|
139
158
|
discovery_metadata: DiscoveryMetadata = DiscoveryMetadata()
|
|
140
159
|
|
|
160
|
+
is_per_user: bool = Field(default=False,
|
|
161
|
+
description="Whether the component is per-user. Default to False. If True, "
|
|
162
|
+
"each user will have their own separate instance of the component. The per-user "
|
|
163
|
+
"component instance will be lazily built on user's first invocation. If False, the "
|
|
164
|
+
"component instance will be shared across all users.")
|
|
165
|
+
|
|
141
166
|
@computed_field
|
|
142
167
|
@cached_property
|
|
143
168
|
def module_name(self) -> str:
|
|
@@ -169,6 +194,32 @@ class RegisteredLoggingMethod(RegisteredInfo[LoggingBaseConfig]):
|
|
|
169
194
|
build_fn: LoggingMethodRegisteredCallableT = Field(repr=False)
|
|
170
195
|
|
|
171
196
|
|
|
197
|
+
class RegisteredTrainerInfo(RegisteredInfo[TrainerConfig]):
|
|
198
|
+
"""
|
|
199
|
+
Represents a registered Trainer. Trainers are responsible for fine-tuning LLMs.
|
|
200
|
+
"""
|
|
201
|
+
|
|
202
|
+
build_fn: TrainerRegisteredCallableT = Field(repr=False)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class RegisteredTrainerAdapterInfo(RegisteredInfo[TrainerAdapterConfig]):
|
|
206
|
+
"""
|
|
207
|
+
Represents a registered Trainer Adapter. Trainer Adapters are responsible for adapting the training process to
|
|
208
|
+
different frameworks.
|
|
209
|
+
"""
|
|
210
|
+
|
|
211
|
+
build_fn: TrainerAdapterRegisteredCallableT = Field(repr=False)
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
class RegisteredTrajectoryBuilderInfo(RegisteredInfo[TrajectoryBuilderConfig]):
|
|
215
|
+
"""
|
|
216
|
+
Represents a registered Trajectory Builder. Trajectory Builders are responsible for building trajectories for
|
|
217
|
+
fine-tuning.
|
|
218
|
+
"""
|
|
219
|
+
|
|
220
|
+
build_fn: TrajectoryBuilderRegisteredCallableT = Field(repr=False)
|
|
221
|
+
|
|
222
|
+
|
|
172
223
|
class RegisteredFrontEndInfo(RegisteredInfo[FrontEndBaseConfig]):
|
|
173
224
|
"""
|
|
174
225
|
Represents a registered front end. Front ends are the entry points to the workflow and are responsible for
|
|
@@ -189,6 +240,38 @@ class RegisteredFunctionInfo(RegisteredInfo[FunctionBaseConfig]):
|
|
|
189
240
|
build_fn: FunctionRegisteredCallableT = Field(repr=False)
|
|
190
241
|
framework_wrappers: list[str] = Field(default_factory=list)
|
|
191
242
|
|
|
243
|
+
# Declared schemas for per-user functions which are lazy-loaded. Must be provided if is_per_user is True.
|
|
244
|
+
per_user_function_input_schema: type[BaseModel] | type[None] | None = Field(
|
|
245
|
+
default=None,
|
|
246
|
+
description="Declared input schema for per-user functions. Must be provided if is_per_user "
|
|
247
|
+
"is True. This is for enabling OpenAPI documentation generation without a concrete function instance.")
|
|
248
|
+
per_user_function_single_output_schema: type[BaseModel] | type[None] | None = Field(
|
|
249
|
+
default=None,
|
|
250
|
+
description="Declared single output schema for per-user functions. Must be provided if is_per_user "
|
|
251
|
+
"is True. This is for enabling OpenAPI documentation generation without a concrete function instance.")
|
|
252
|
+
per_user_function_streaming_output_schema: type[BaseModel] | type[None] | None = Field(
|
|
253
|
+
default=None,
|
|
254
|
+
description="Declared streaming output schema for per-user functions. Must be provided if is_per_user "
|
|
255
|
+
"is True. This is for enabling OpenAPI documentation generation without a concrete function instance.")
|
|
256
|
+
|
|
257
|
+
@model_validator(mode="after")
|
|
258
|
+
def validate_per_user_function_schema_declaration(self) -> Self:
|
|
259
|
+
"""
|
|
260
|
+
Validate if the schemas are explicitly declared when is_per_user is True
|
|
261
|
+
"""
|
|
262
|
+
if self.is_per_user:
|
|
263
|
+
|
|
264
|
+
if self.per_user_function_input_schema is None:
|
|
265
|
+
raise ValueError("per_user_function_input_schema must be provided if is_per_user is True")
|
|
266
|
+
|
|
267
|
+
if self.per_user_function_single_output_schema is None and \
|
|
268
|
+
self.per_user_function_streaming_output_schema is None:
|
|
269
|
+
raise ValueError(
|
|
270
|
+
"per_user_function_single_output_schema or per_user_function_streaming_output_schema must be "
|
|
271
|
+
"provided if is_per_user is True")
|
|
272
|
+
|
|
273
|
+
return self
|
|
274
|
+
|
|
192
275
|
|
|
193
276
|
class RegisteredFunctionGroupInfo(RegisteredInfo[FunctionGroupBaseConfig]):
|
|
194
277
|
"""
|
|
@@ -284,7 +367,7 @@ class RegisteredTTCStrategyInfo(RegisteredInfo[TTCStrategyBaseConfig]):
|
|
|
284
367
|
Represents a registered TTC strategy.
|
|
285
368
|
"""
|
|
286
369
|
|
|
287
|
-
build_fn:
|
|
370
|
+
build_fn: TTCStrategyRegisteredCallableT = Field(repr=False)
|
|
288
371
|
|
|
289
372
|
|
|
290
373
|
class RegisteredToolWrapper(BaseModel):
|
|
@@ -393,6 +476,12 @@ class TypeRegistry:
|
|
|
393
476
|
# TTC Strategies
|
|
394
477
|
self._registered_ttc_strategies: dict[type[TTCStrategyBaseConfig], RegisteredTTCStrategyInfo] = {}
|
|
395
478
|
|
|
479
|
+
# Registered training things
|
|
480
|
+
self._registered_trainer_infos: dict[type[TrainerConfig], RegisteredTrainerInfo] = {}
|
|
481
|
+
self._registered_trainer_adapter_infos: dict[type[TrainerAdapterConfig], RegisteredTrainerAdapterInfo] = {}
|
|
482
|
+
self._registered_trajectory_builder_infos: dict[type[TrajectoryBuilderConfig],
|
|
483
|
+
RegisteredTrajectoryBuilderInfo] = {}
|
|
484
|
+
|
|
396
485
|
# Packages
|
|
397
486
|
self._registered_packages: dict[str, RegisteredPackage] = {}
|
|
398
487
|
|
|
@@ -471,6 +560,65 @@ class TypeRegistry:
|
|
|
471
560
|
|
|
472
561
|
return list(self._registered_logging_methods.values())
|
|
473
562
|
|
|
563
|
+
def register_trainer(self, registration: RegisteredTrainerInfo):
|
|
564
|
+
|
|
565
|
+
if (registration.config_type in self._registered_trainer_infos):
|
|
566
|
+
raise ValueError(f"A trainer with the same config type `{registration.config_type}` has already "
|
|
567
|
+
"been registered.")
|
|
568
|
+
|
|
569
|
+
self._registered_trainer_infos[registration.config_type] = registration
|
|
570
|
+
|
|
571
|
+
self._registration_changed()
|
|
572
|
+
|
|
573
|
+
def register_trainer_adapter(self, registration: RegisteredTrainerAdapterInfo):
|
|
574
|
+
if (registration.config_type in self._registered_trainer_adapter_infos):
|
|
575
|
+
raise ValueError(f"A trainer adapter with the same config type `{registration.config_type}` has already "
|
|
576
|
+
"been registered.")
|
|
577
|
+
|
|
578
|
+
self._registered_trainer_adapter_infos[registration.config_type] = registration
|
|
579
|
+
|
|
580
|
+
self._registration_changed()
|
|
581
|
+
|
|
582
|
+
def register_trajectory_builder(self, registration: RegisteredTrajectoryBuilderInfo):
|
|
583
|
+
if (registration.config_type in self._registered_trajectory_builder_infos):
|
|
584
|
+
raise ValueError(f"A trajectory builder with the same config type `{registration.config_type}` has already "
|
|
585
|
+
"been registered.")
|
|
586
|
+
|
|
587
|
+
self._registered_trajectory_builder_infos[registration.config_type] = registration
|
|
588
|
+
|
|
589
|
+
self._registration_changed()
|
|
590
|
+
|
|
591
|
+
def get_trainer(self, config_type: type[TrainerConfig]) -> RegisteredTrainerInfo:
|
|
592
|
+
|
|
593
|
+
try:
|
|
594
|
+
return self._registered_trainer_infos[config_type]
|
|
595
|
+
except KeyError as err:
|
|
596
|
+
raise KeyError(f"Could not find a registered trainer for config `{config_type}`. "
|
|
597
|
+
f"Registered configs: {set(self._registered_trainer_infos.keys())}") from err
|
|
598
|
+
|
|
599
|
+
def get_trainer_adapter(self, config_type: type[TrainerAdapterConfig]) -> RegisteredTrainerAdapterInfo:
|
|
600
|
+
try:
|
|
601
|
+
return self._registered_trainer_adapter_infos[config_type]
|
|
602
|
+
except KeyError as err:
|
|
603
|
+
raise KeyError(f"Could not find a registered trainer adapter for config `{config_type}`. "
|
|
604
|
+
f"Registered configs: {set(self._registered_trainer_adapter_infos.keys())}") from err
|
|
605
|
+
|
|
606
|
+
def get_trajectory_builder(self, config_type: type[TrajectoryBuilderConfig]) -> RegisteredTrajectoryBuilderInfo:
|
|
607
|
+
try:
|
|
608
|
+
return self._registered_trajectory_builder_infos[config_type]
|
|
609
|
+
except KeyError as err:
|
|
610
|
+
raise KeyError(f"Could not find a registered trajectory builder for config `{config_type}`. "
|
|
611
|
+
f"Registered configs: {set(self._registered_trajectory_builder_infos.keys())}") from err
|
|
612
|
+
|
|
613
|
+
def get_registered_trainers(self) -> list[RegisteredInfo[TrainerConfig]]:
|
|
614
|
+
return list(self._registered_trainer_infos.values())
|
|
615
|
+
|
|
616
|
+
def get_registered_trainer_adapters(self) -> list[RegisteredInfo[TrainerAdapterConfig]]:
|
|
617
|
+
return list(self._registered_trainer_adapter_infos.values())
|
|
618
|
+
|
|
619
|
+
def get_registered_trajectory_builders(self) -> list[RegisteredInfo[TrajectoryBuilderConfig]]:
|
|
620
|
+
return list(self._registered_trajectory_builder_infos.values())
|
|
621
|
+
|
|
474
622
|
def register_front_end(self, registration: RegisteredFrontEndInfo):
|
|
475
623
|
|
|
476
624
|
if (registration.config_type in self._registered_front_end_infos):
|
|
@@ -977,6 +1125,15 @@ class TypeRegistry:
|
|
|
977
1125
|
if component_type == ComponentEnum.MIDDLEWARE:
|
|
978
1126
|
return self._registered_middleware
|
|
979
1127
|
|
|
1128
|
+
if component_type == ComponentEnum.TRAINER:
|
|
1129
|
+
return self._registered_trainer_infos
|
|
1130
|
+
|
|
1131
|
+
if component_type == ComponentEnum.TRAJECTORY_BUILDER:
|
|
1132
|
+
return self._registered_trajectory_builder_infos
|
|
1133
|
+
|
|
1134
|
+
if component_type == ComponentEnum.TRAINER_ADAPTER:
|
|
1135
|
+
return self._registered_trainer_adapter_infos
|
|
1136
|
+
|
|
980
1137
|
raise ValueError(f"Supplied an unsupported component type {component_type}")
|
|
981
1138
|
|
|
982
1139
|
def get_registered_types_by_component_type(self, component_type: ComponentEnum) -> list[str]:
|
|
@@ -1106,6 +1263,15 @@ class TypeRegistry:
|
|
|
1106
1263
|
if issubclass(cls, MiddlewareBaseConfig):
|
|
1107
1264
|
return self._do_compute_annotation(cls, self.get_registered_middleware())
|
|
1108
1265
|
|
|
1266
|
+
if issubclass(cls, TrainerConfig):
|
|
1267
|
+
return self._do_compute_annotation(cls, self.get_registered_trainers())
|
|
1268
|
+
|
|
1269
|
+
if issubclass(cls, TrainerAdapterConfig):
|
|
1270
|
+
return self._do_compute_annotation(cls, self.get_registered_trainer_adapters())
|
|
1271
|
+
|
|
1272
|
+
if issubclass(cls, TrajectoryBuilderConfig):
|
|
1273
|
+
return self._do_compute_annotation(cls, self.get_registered_trajectory_builders())
|
|
1274
|
+
|
|
1109
1275
|
raise ValueError(f"Supplied an unsupported component type {cls}")
|
|
1110
1276
|
|
|
1111
1277
|
|
nat/control_flow/register.py
CHANGED
|
@@ -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");
|
|
@@ -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");
|
|
@@ -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");
|
|
@@ -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");
|
|
@@ -32,6 +32,14 @@ from nat.utils.type_utils import DecomposedType
|
|
|
32
32
|
logger = logging.getLogger(__name__)
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
class SequentialExecutorExit(Exception):
|
|
36
|
+
"""Raised when a tool wants to exit the sequential executor chain early with a custom message."""
|
|
37
|
+
|
|
38
|
+
def __init__(self, message: str):
|
|
39
|
+
self.message = message
|
|
40
|
+
super().__init__(message)
|
|
41
|
+
|
|
42
|
+
|
|
35
43
|
class ToolExecutionConfig(BaseModel):
|
|
36
44
|
"""Configuration for individual tool execution within sequential execution."""
|
|
37
45
|
|
|
@@ -41,6 +49,7 @@ class ToolExecutionConfig(BaseModel):
|
|
|
41
49
|
class SequentialExecutorConfig(FunctionBaseConfig, name="sequential_executor"):
|
|
42
50
|
"""Configuration for sequential execution of a list of functions."""
|
|
43
51
|
|
|
52
|
+
description: str = Field(default="Sequential Executor Workflow", description="Description of this functions use.")
|
|
44
53
|
tool_list: list[FunctionRef] = Field(default_factory=list,
|
|
45
54
|
description="A list of functions to execute sequentially.")
|
|
46
55
|
tool_execution_config: dict[str, ToolExecutionConfig] = Field(default_factory=dict,
|
|
@@ -54,6 +63,11 @@ class SequentialExecutorConfig(FunctionBaseConfig, name="sequential_executor"):
|
|
|
54
63
|
"which means the output type of the previous function is compatible with the input type of the next function."
|
|
55
64
|
"If set to True, any incompatibility will raise an exception. If set to false, the incompatibility will only"
|
|
56
65
|
"generate a warning message and the sequential execution will continue.")
|
|
66
|
+
return_error_on_exception: bool = Field(
|
|
67
|
+
default=False,
|
|
68
|
+
description="If set to True, when an uncaught exception occurs during tool execution, the sequential executor "
|
|
69
|
+
"will exit early and return an error message as the workflow output instead of raising the exception. "
|
|
70
|
+
"If set to False (default), exceptions are re-raised.")
|
|
57
71
|
|
|
58
72
|
|
|
59
73
|
def _get_function_output_type(function: Function, tool_execution_config: dict[str, ToolExecutionConfig]) -> type:
|
|
@@ -126,11 +140,11 @@ async def sequential_execution(config: SequentialExecutorConfig, builder: Builde
|
|
|
126
140
|
raise ValueError(f"Error with the sequential executor tool list: {e}")
|
|
127
141
|
|
|
128
142
|
# The type annotation of _sequential_function_execution is dynamically set according to the tool list
|
|
129
|
-
async def _sequential_function_execution(
|
|
143
|
+
async def _sequential_function_execution(input_message):
|
|
130
144
|
logger.debug(f"Executing sequential executor with tool list: {config.tool_list}")
|
|
131
145
|
|
|
132
146
|
tool_list: list[FunctionRef] = config.tool_list
|
|
133
|
-
tool_input =
|
|
147
|
+
tool_input = input_message
|
|
134
148
|
tool_response = None
|
|
135
149
|
|
|
136
150
|
for tool_name in tool_list:
|
|
@@ -148,7 +162,16 @@ async def sequential_execution(config: SequentialExecutorConfig, builder: Builde
|
|
|
148
162
|
tool_response = await tool.ainvoke(tool_input)
|
|
149
163
|
else:
|
|
150
164
|
tool_response = await tool.ainvoke(tool_input)
|
|
165
|
+
except SequentialExecutorExit as e:
|
|
166
|
+
# Tool explicitly requested early exit - always return the message
|
|
167
|
+
logger.info(f"Tool {tool_name} requested early exit: {e.message}")
|
|
168
|
+
return e.message
|
|
151
169
|
except Exception as e:
|
|
170
|
+
if config.return_error_on_exception:
|
|
171
|
+
# Return error message as workflow output instead of raising exception
|
|
172
|
+
logger.exception(f"Error with tool {tool_name}, returning error message")
|
|
173
|
+
error_message = f"Error in {tool_name}: {type(e).__name__}: {str(e)}"
|
|
174
|
+
return error_message
|
|
152
175
|
logger.error(f"Error with tool {tool_name}: {e}")
|
|
153
176
|
raise
|
|
154
177
|
|
|
@@ -158,9 +181,7 @@ async def sequential_execution(config: SequentialExecutorConfig, builder: Builde
|
|
|
158
181
|
return tool_response
|
|
159
182
|
|
|
160
183
|
# Dynamically set the annotations for the function
|
|
161
|
-
_sequential_function_execution.__annotations__ = {"
|
|
184
|
+
_sequential_function_execution.__annotations__ = {"input_message": input_type, "return": output_type}
|
|
162
185
|
logger.debug(f"Sequential executor function annotations: {_sequential_function_execution.__annotations__}")
|
|
163
186
|
|
|
164
|
-
yield FunctionInfo.from_fn(_sequential_function_execution,
|
|
165
|
-
description="Executes a list of functions sequentially."
|
|
166
|
-
"The input of the next tool is the response of the previous tool.")
|
|
187
|
+
yield FunctionInfo.from_fn(_sequential_function_execution, description=config.description)
|
nat/data_models/__init__.py
CHANGED
|
@@ -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");
|
nat/data_models/agent.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/data_models/api_server.py
CHANGED
|
@@ -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");
|
|
@@ -24,7 +24,6 @@ from pydantic import BaseModel
|
|
|
24
24
|
from pydantic import ConfigDict
|
|
25
25
|
from pydantic import Discriminator
|
|
26
26
|
from pydantic import Field
|
|
27
|
-
from pydantic import HttpUrl
|
|
28
27
|
from pydantic import conlist
|
|
29
28
|
from pydantic import field_serializer
|
|
30
29
|
from pydantic import field_validator
|
|
@@ -90,7 +89,8 @@ class AudioContent(BaseModel):
|
|
|
90
89
|
|
|
91
90
|
|
|
92
91
|
class ImageUrl(BaseModel):
|
|
93
|
-
url:
|
|
92
|
+
url: str = Field(default="http://default.com",
|
|
93
|
+
description="Either a URL of the image or the base64 encoded image data.")
|
|
94
94
|
|
|
95
95
|
|
|
96
96
|
class ImageContent(BaseModel):
|
|
@@ -494,6 +494,18 @@ class ResponseIntermediateStep(ResponseBaseModelIntermediate):
|
|
|
494
494
|
payload: str
|
|
495
495
|
|
|
496
496
|
|
|
497
|
+
class ResponseObservabilityTrace(BaseModel, ResponseSerializable):
|
|
498
|
+
"""
|
|
499
|
+
ResponseObservabilityTrace is a data model that represents an observability trace event
|
|
500
|
+
sent once when the trace ID becomes available
|
|
501
|
+
"""
|
|
502
|
+
|
|
503
|
+
observability_trace_id: str
|
|
504
|
+
|
|
505
|
+
def get_stream_data(self) -> str:
|
|
506
|
+
return f"observability_trace: {self.model_dump_json()}\n\n"
|
|
507
|
+
|
|
508
|
+
|
|
497
509
|
class ResponsePayloadOutput(BaseModel, ResponseSerializable):
|
|
498
510
|
|
|
499
511
|
payload: typing.Any
|
|
@@ -525,6 +537,7 @@ class WebSocketMessageType(str, Enum):
|
|
|
525
537
|
INTERMEDIATE_STEP_MESSAGE = "system_intermediate_message"
|
|
526
538
|
SYSTEM_INTERACTION_MESSAGE = "system_interaction_message"
|
|
527
539
|
USER_INTERACTION_MESSAGE = "user_interaction_message"
|
|
540
|
+
OBSERVABILITY_TRACE_MESSAGE = "observability_trace_message"
|
|
528
541
|
ERROR_MESSAGE = "error_message"
|
|
529
542
|
|
|
530
543
|
|
|
@@ -700,6 +713,28 @@ class WebSocketSystemInteractionMessage(BaseModel):
|
|
|
700
713
|
timestamp: str = str(datetime.datetime.now(datetime.UTC))
|
|
701
714
|
|
|
702
715
|
|
|
716
|
+
class ObservabilityTraceContent(BaseModel):
|
|
717
|
+
model_config = ConfigDict(extra="forbid")
|
|
718
|
+
observability_trace_id: str
|
|
719
|
+
|
|
720
|
+
|
|
721
|
+
class WebSocketObservabilityTraceMessage(BaseModel):
|
|
722
|
+
"""
|
|
723
|
+
WebSocket message for observability trace ID.
|
|
724
|
+
Sent once after the workflow completes to correlate the request with observability traces.
|
|
725
|
+
"""
|
|
726
|
+
# Allow extra fields in the model_config to support derived models
|
|
727
|
+
model_config = ConfigDict(extra="allow")
|
|
728
|
+
|
|
729
|
+
type: typing.Literal[
|
|
730
|
+
WebSocketMessageType.OBSERVABILITY_TRACE_MESSAGE] = WebSocketMessageType.OBSERVABILITY_TRACE_MESSAGE
|
|
731
|
+
id: str = "default"
|
|
732
|
+
parent_id: str = "default"
|
|
733
|
+
conversation_id: str | None = None
|
|
734
|
+
content: ObservabilityTraceContent
|
|
735
|
+
timestamp: str = str(datetime.datetime.now(datetime.UTC))
|
|
736
|
+
|
|
737
|
+
|
|
703
738
|
# ======== GenerateResponse Converters ========
|
|
704
739
|
|
|
705
740
|
|
|
@@ -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");
|
nat/data_models/common.py
CHANGED
|
@@ -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");
|
nat/data_models/component.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");
|
|
@@ -41,6 +41,9 @@ class ComponentEnum(StrEnum):
|
|
|
41
41
|
RETRIEVER_PROVIDER = "retriever_provider"
|
|
42
42
|
TOOL_WRAPPER = "tool_wrapper"
|
|
43
43
|
TRACING = "tracing"
|
|
44
|
+
TRAINER = "trainer"
|
|
45
|
+
TRAJECTORY_BUILDER = "trajectory_builder"
|
|
46
|
+
TRAINER_ADAPTER = "trainer_adapter"
|
|
44
47
|
UNDEFINED = "undefined"
|
|
45
48
|
|
|
46
49
|
|
|
@@ -56,6 +59,9 @@ class ComponentGroup(StrEnum):
|
|
|
56
59
|
MEMORY = "memory"
|
|
57
60
|
OBJECT_STORES = "object_stores"
|
|
58
61
|
RETRIEVERS = "retrievers"
|
|
62
|
+
TRAINERS = "trainers"
|
|
63
|
+
TRAINER_ADAPTERS = "trainer_adapters"
|
|
64
|
+
TRAJECTORY_BUILDERS = "trajectory_builders"
|
|
59
65
|
|
|
60
66
|
|
|
61
67
|
# Compatibility aliases with previous releases
|
nat/data_models/component_ref.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");
|
|
@@ -188,3 +188,36 @@ class MiddlewareRef(ComponentRef):
|
|
|
188
188
|
@override
|
|
189
189
|
def component_group(self):
|
|
190
190
|
return ComponentGroup.MIDDLEWARE
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
class TrainerRef(ComponentRef):
|
|
194
|
+
"""
|
|
195
|
+
A reference to a trainer in a NAT configuration object.
|
|
196
|
+
"""
|
|
197
|
+
|
|
198
|
+
@property
|
|
199
|
+
@override
|
|
200
|
+
def component_group(self):
|
|
201
|
+
return ComponentGroup.TRAINERS
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class TrajectoryBuilderRef(ComponentRef):
|
|
205
|
+
"""
|
|
206
|
+
A reference to a trajectory builder in a NAT configuration object.
|
|
207
|
+
"""
|
|
208
|
+
|
|
209
|
+
@property
|
|
210
|
+
@override
|
|
211
|
+
def component_group(self):
|
|
212
|
+
return ComponentGroup.TRAJECTORY_BUILDERS
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
class TrainerAdapterRef(ComponentRef):
|
|
216
|
+
"""
|
|
217
|
+
A reference to a trainer adapter in a NAT configuration object.
|
|
218
|
+
"""
|
|
219
|
+
|
|
220
|
+
@property
|
|
221
|
+
@override
|
|
222
|
+
def component_group(self):
|
|
223
|
+
return ComponentGroup.TRAINER_ADAPTERS
|