nvidia-nat 1.4.0a20251112__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 +563 -1
- nat/builder/child_builder.py +385 -0
- nat/builder/component_utils.py +34 -4
- nat/builder/context.py +34 -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 +3 -1
- nat/builder/front_end.py +1 -1
- nat/builder/function.py +113 -5
- 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 +5 -3
- nat/builder/workflow_builder.py +619 -378
- 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 +233 -5
- nat/cli/type_registry.py +237 -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 +9 -1
- nat/data_models/component_ref.py +45 -1
- nat/data_models/config.py +78 -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 +15 -2
- 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 +37 -0
- 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 +26 -0
- 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 +226 -81
- 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 +23 -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 +318 -59
- 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 +35 -0
- nat/middleware/cache/__init__.py +14 -0
- nat/middleware/cache/cache_middleware.py +253 -0
- 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 +370 -0
- 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 +298 -0
- 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 +22 -0
- 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 +32 -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 +12 -4
- nat/retriever/milvus/retriever.py +103 -41
- 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 +13 -6
- nat/runtime/session.py +458 -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 +2 -2
- 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.0a20251112.dist-info → nvidia_nat-1.4.0a20260113.dist-info}/METADATA +46 -15
- 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 -151
- nat/front_ends/mcp/mcp_front_end_plugin_worker.py +0 -362
- 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.0a20251112.dist-info/RECORD +0 -481
- nvidia_nat-1.4.0a20251112.dist-info/entry_points.txt +0 -22
- {nvidia_nat-1.4.0a20251112.dist-info → nvidia_nat-1.4.0a20260113.dist-info}/WHEEL +0 -0
- {nvidia_nat-1.4.0a20251112.dist-info → nvidia_nat-1.4.0a20260113.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
- {nvidia_nat-1.4.0a20251112.dist-info → nvidia_nat-1.4.0a20260113.dist-info}/licenses/LICENSE.md +0 -0
- {nvidia_nat-1.4.0a20251112.dist-info → nvidia_nat-1.4.0a20260113.dist-info}/top_level.txt +0 -0
nat/cli/__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");
|
|
@@ -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/cli/cli_utils/validation.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");
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
16
|
from pathlib import Path
|
|
17
|
+
from urllib.parse import urlparse
|
|
17
18
|
|
|
18
19
|
import click
|
|
19
20
|
import yaml
|
|
@@ -21,6 +22,36 @@ import yaml
|
|
|
21
22
|
from nat.data_models.config import Config
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
def validate_url(_ctx: click.Context, _param: click.Parameter, value: str) -> str:
|
|
26
|
+
"""Validate URL format for CLI options.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
_ctx: Click context (unused, required by Click callback interface)
|
|
30
|
+
_param: Click parameter (unused, required by Click callback interface)
|
|
31
|
+
value: URL string to validate
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
The validated URL string
|
|
35
|
+
|
|
36
|
+
Raises:
|
|
37
|
+
click.BadParameter: If URL is invalid or uses unsupported scheme
|
|
38
|
+
"""
|
|
39
|
+
if not value:
|
|
40
|
+
return value
|
|
41
|
+
|
|
42
|
+
try:
|
|
43
|
+
result = urlparse(value)
|
|
44
|
+
if result.scheme not in ('http', 'https'):
|
|
45
|
+
raise click.BadParameter('URL must use http:// or https:// scheme')
|
|
46
|
+
if not result.netloc:
|
|
47
|
+
raise click.BadParameter('URL must include a hostname')
|
|
48
|
+
return value
|
|
49
|
+
except click.BadParameter:
|
|
50
|
+
raise
|
|
51
|
+
except Exception as e:
|
|
52
|
+
raise click.BadParameter(f'Invalid URL format: {e}')
|
|
53
|
+
|
|
54
|
+
|
|
24
55
|
def validate_config(config_file: Path) -> Config:
|
|
25
56
|
"""Validate configuration file and return parsed config"""
|
|
26
57
|
try:
|
|
@@ -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) 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");
|
nat/cli/commands/evaluate.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");
|
|
@@ -18,7 +18,9 @@ import logging
|
|
|
18
18
|
from pathlib import Path
|
|
19
19
|
|
|
20
20
|
import click
|
|
21
|
+
from tabulate import tabulate
|
|
21
22
|
|
|
23
|
+
from nat.eval.config import EvaluationRunOutput
|
|
22
24
|
from nat.eval.evaluate import EvaluationRun
|
|
23
25
|
from nat.eval.evaluate import EvaluationRunConfig
|
|
24
26
|
|
|
@@ -83,16 +85,83 @@ logger = logging.getLogger(__name__)
|
|
|
83
85
|
multiple=True,
|
|
84
86
|
help="Override config values using dot notation (e.g., --override llms.nim_llm.temperature 0.7)",
|
|
85
87
|
)
|
|
88
|
+
@click.option(
|
|
89
|
+
"--user_id",
|
|
90
|
+
type=str,
|
|
91
|
+
default=None,
|
|
92
|
+
help="User ID to use for workflow session.",
|
|
93
|
+
)
|
|
86
94
|
@click.pass_context
|
|
87
95
|
def eval_command(ctx, **kwargs) -> None:
|
|
88
96
|
""" Evaluate datasets with the specified mechanism"""
|
|
89
97
|
pass
|
|
90
98
|
|
|
91
99
|
|
|
100
|
+
def write_tabular_output(eval_run_output: EvaluationRunOutput):
|
|
101
|
+
"""Write evaluation results in a tabular format."""
|
|
102
|
+
|
|
103
|
+
# Print header with workflow status and runtime
|
|
104
|
+
workflow_status = "INTERRUPTED" if eval_run_output.workflow_interrupted else "COMPLETED"
|
|
105
|
+
total_runtime = eval_run_output.usage_stats.total_runtime if eval_run_output.usage_stats else 0.0
|
|
106
|
+
|
|
107
|
+
click.echo("")
|
|
108
|
+
click.echo(click.style("=== EVALUATION SUMMARY ===", fg="bright_blue", bold=True))
|
|
109
|
+
click.echo(f"Workflow Status: {workflow_status} (workflow_output.json)")
|
|
110
|
+
click.echo(f"Total Runtime: {total_runtime:.2f}s")
|
|
111
|
+
|
|
112
|
+
# Include profiler stats if available
|
|
113
|
+
if eval_run_output.profiler_results:
|
|
114
|
+
profiler_results = eval_run_output.profiler_results
|
|
115
|
+
if profiler_results.workflow_runtime_metrics:
|
|
116
|
+
wf_metrics = profiler_results.workflow_runtime_metrics
|
|
117
|
+
click.echo(f"Workflow Runtime (p95): {wf_metrics.p95:.2f}s")
|
|
118
|
+
if profiler_results.llm_latency_ci:
|
|
119
|
+
llm_metrics = profiler_results.llm_latency_ci
|
|
120
|
+
click.echo(f"LLM Latency (p95): {llm_metrics.p95:.2f}s")
|
|
121
|
+
|
|
122
|
+
# Build the evaluation results table
|
|
123
|
+
if not eval_run_output.evaluation_results:
|
|
124
|
+
return
|
|
125
|
+
|
|
126
|
+
click.echo("")
|
|
127
|
+
click.echo("Per evaluator results:")
|
|
128
|
+
|
|
129
|
+
table = []
|
|
130
|
+
for evaluator_name, eval_output in eval_run_output.evaluation_results:
|
|
131
|
+
row = []
|
|
132
|
+
|
|
133
|
+
# Add evaluator name and average score
|
|
134
|
+
row.append(evaluator_name)
|
|
135
|
+
|
|
136
|
+
# Format average score
|
|
137
|
+
if isinstance(eval_output.average_score, int | float):
|
|
138
|
+
row.append(f"{eval_output.average_score:.4f}")
|
|
139
|
+
else:
|
|
140
|
+
row.append(str(eval_output.average_score))
|
|
141
|
+
|
|
142
|
+
# Add output file if available
|
|
143
|
+
output_file = None
|
|
144
|
+
for file_path in eval_run_output.evaluator_output_files:
|
|
145
|
+
if file_path.stem.startswith(f"{evaluator_name}_") or file_path.stem == evaluator_name:
|
|
146
|
+
output_file = file_path.name
|
|
147
|
+
break
|
|
148
|
+
row.append(output_file if output_file else "N/A")
|
|
149
|
+
|
|
150
|
+
table.append(row)
|
|
151
|
+
|
|
152
|
+
# Build headers
|
|
153
|
+
headers = ["Evaluator", "Avg Score", "Output File"]
|
|
154
|
+
|
|
155
|
+
click.echo(tabulate(table, headers=headers, tablefmt="github"))
|
|
156
|
+
click.echo("")
|
|
157
|
+
|
|
158
|
+
|
|
92
159
|
async def run_and_evaluate(config: EvaluationRunConfig):
|
|
93
160
|
# Run evaluation
|
|
94
161
|
eval_runner = EvaluationRun(config=config)
|
|
95
|
-
await eval_runner.run_and_evaluate()
|
|
162
|
+
eval_run_output = await eval_runner.run_and_evaluate()
|
|
163
|
+
|
|
164
|
+
write_tabular_output(eval_run_output)
|
|
96
165
|
|
|
97
166
|
|
|
98
167
|
@eval_command.result_callback(replace=True)
|
|
@@ -108,6 +177,7 @@ def process_nat_eval(
|
|
|
108
177
|
endpoint_timeout: int,
|
|
109
178
|
reps: int,
|
|
110
179
|
override: tuple[tuple[str, str], ...],
|
|
180
|
+
user_id: str | None,
|
|
111
181
|
):
|
|
112
182
|
"""
|
|
113
183
|
Process the eval command and execute the evaluation. Here the config_file, if provided, is checked for its existence
|
|
@@ -125,15 +195,19 @@ def process_nat_eval(
|
|
|
125
195
|
"have a partially completed dataset.")
|
|
126
196
|
|
|
127
197
|
# Create the configuration object
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
198
|
+
# Only include user_id if explicitly provided via CLI, otherwise use the default
|
|
199
|
+
config_kwargs = {
|
|
200
|
+
"config_file": config_file,
|
|
201
|
+
"dataset": str(dataset) if dataset else None,
|
|
202
|
+
"result_json_path": result_json_path,
|
|
203
|
+
"skip_workflow": skip_workflow,
|
|
204
|
+
"skip_completed_entries": skip_completed_entries,
|
|
205
|
+
"endpoint": endpoint,
|
|
206
|
+
"endpoint_timeout": endpoint_timeout,
|
|
207
|
+
"reps": reps,
|
|
208
|
+
"override": override,
|
|
209
|
+
}
|
|
210
|
+
if user_id is not None:
|
|
211
|
+
config_kwargs["user_id"] = user_id
|
|
212
|
+
config = EvaluationRunConfig(**config_kwargs)
|
|
139
213
|
asyncio.run(run_and_evaluate(config))
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES.
|
|
2
|
+
# All rights reserved.
|
|
3
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
#
|
|
5
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
# you may not use this file except in compliance with the License.
|
|
7
|
+
# You may obtain a copy of the License at
|
|
8
|
+
#
|
|
9
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
#
|
|
11
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
# See the License for the specific language governing permissions and
|
|
15
|
+
# limitations under the License.
|
|
16
|
+
"""CLI command for running finetuning."""
|
|
17
|
+
|
|
18
|
+
import logging
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
import click
|
|
22
|
+
|
|
23
|
+
from nat.data_models.finetuning import FinetuneRunConfig
|
|
24
|
+
from nat.finetuning.finetuning_runtime import run_finetuning_sync
|
|
25
|
+
|
|
26
|
+
logger = logging.getLogger(__name__)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@click.command(name="finetune", help="Run finetuning on a workflow using collected trajectories.")
|
|
30
|
+
@click.option("--config_file",
|
|
31
|
+
required=True,
|
|
32
|
+
type=click.Path(exists=True, path_type=Path, resolve_path=True),
|
|
33
|
+
help="Path to the configuration file containing finetuning settings")
|
|
34
|
+
@click.option(
|
|
35
|
+
"--dataset",
|
|
36
|
+
type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
|
|
37
|
+
required=False,
|
|
38
|
+
help="A json file with questions and ground truth answers. This will override the dataset path in the config file.",
|
|
39
|
+
)
|
|
40
|
+
@click.option(
|
|
41
|
+
"--result_json_path",
|
|
42
|
+
type=str,
|
|
43
|
+
default="$",
|
|
44
|
+
help=("A JSON path to extract the result from the workflow. Use this when the workflow returns "
|
|
45
|
+
"multiple objects or a dictionary. For example, '$.output' will extract the 'output' field "
|
|
46
|
+
"from the result."),
|
|
47
|
+
)
|
|
48
|
+
@click.option(
|
|
49
|
+
"--endpoint",
|
|
50
|
+
type=str,
|
|
51
|
+
default=None,
|
|
52
|
+
help="Use endpoint for running the workflow. Example: http://localhost:8000/generate",
|
|
53
|
+
)
|
|
54
|
+
@click.option(
|
|
55
|
+
"--endpoint_timeout",
|
|
56
|
+
type=int,
|
|
57
|
+
default=300,
|
|
58
|
+
help="HTTP response timeout in seconds. Only relevant if endpoint is specified.",
|
|
59
|
+
)
|
|
60
|
+
@click.option("--override",
|
|
61
|
+
"-o",
|
|
62
|
+
multiple=True,
|
|
63
|
+
type=(str, str),
|
|
64
|
+
help="Override config values (e.g., -o finetuning.num_epochs 5)")
|
|
65
|
+
@click.option(
|
|
66
|
+
"--validation_dataset",
|
|
67
|
+
type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
|
|
68
|
+
required=False,
|
|
69
|
+
help="Validation dataset file path for periodic validation",
|
|
70
|
+
)
|
|
71
|
+
@click.option(
|
|
72
|
+
"--validation_interval",
|
|
73
|
+
type=int,
|
|
74
|
+
default=5,
|
|
75
|
+
help="Run validation every N epochs",
|
|
76
|
+
)
|
|
77
|
+
@click.option(
|
|
78
|
+
"--validation_config_file",
|
|
79
|
+
type=click.Path(exists=True, path_type=Path, resolve_path=True),
|
|
80
|
+
required=False,
|
|
81
|
+
help="Optional separate config file for validation runs",
|
|
82
|
+
)
|
|
83
|
+
@click.pass_context
|
|
84
|
+
def finetune_command(
|
|
85
|
+
processors, # pylint: disable=unused-argument
|
|
86
|
+
*,
|
|
87
|
+
config_file: Path,
|
|
88
|
+
dataset: Path,
|
|
89
|
+
result_json_path: str,
|
|
90
|
+
endpoint: str,
|
|
91
|
+
endpoint_timeout: int,
|
|
92
|
+
override: tuple[tuple[str, str], ...],
|
|
93
|
+
validation_dataset: Path,
|
|
94
|
+
validation_interval: int,
|
|
95
|
+
validation_config_file: Path,
|
|
96
|
+
):
|
|
97
|
+
"""
|
|
98
|
+
Run finetuning based on the configuration file.
|
|
99
|
+
|
|
100
|
+
This command will:
|
|
101
|
+
1. Load the configuration with finetuning settings
|
|
102
|
+
2. Initialize the finetuning runner
|
|
103
|
+
3. Run evaluation to collect trajectories
|
|
104
|
+
4. Submit trajectories for training
|
|
105
|
+
5. Monitor training progress
|
|
106
|
+
"""
|
|
107
|
+
logger.info("Starting finetuning with config: %s", config_file)
|
|
108
|
+
|
|
109
|
+
# Apply overrides if provided
|
|
110
|
+
if override:
|
|
111
|
+
logger.info("Applying config overrides: %s", override)
|
|
112
|
+
# TODO: Implement config override logic similar to other commands
|
|
113
|
+
|
|
114
|
+
try:
|
|
115
|
+
# Run the finetuning process
|
|
116
|
+
run_finetuning_sync(
|
|
117
|
+
FinetuneRunConfig(
|
|
118
|
+
config_file=config_file,
|
|
119
|
+
dataset=dataset,
|
|
120
|
+
result_json_path=result_json_path,
|
|
121
|
+
endpoint=endpoint,
|
|
122
|
+
endpoint_timeout=endpoint_timeout,
|
|
123
|
+
override=override,
|
|
124
|
+
validation_dataset=validation_dataset,
|
|
125
|
+
validation_interval=validation_interval,
|
|
126
|
+
validation_config_file=validation_config_file,
|
|
127
|
+
))
|
|
128
|
+
|
|
129
|
+
logger.info("Finetuning completed successfully")
|
|
130
|
+
except Exception as e:
|
|
131
|
+
logger.error("Finetuning failed: %s", e)
|
|
132
|
+
raise click.ClickException(str(e))
|
|
@@ -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/cli/commands/info/info.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");
|
|
@@ -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) 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/cli/commands/optimize.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");
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, 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.
|
|
15
|
+
"""Red teaming CLI command."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import asyncio
|
|
20
|
+
import logging
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
import click
|
|
24
|
+
|
|
25
|
+
logger = logging.getLogger(__name__)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@click.group(name=__name__, invoke_without_command=True, help="Run red teaming evaluation with multiple scenarios.")
|
|
29
|
+
@click.option(
|
|
30
|
+
"--red_team_config",
|
|
31
|
+
type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
|
|
32
|
+
required=False,
|
|
33
|
+
help="A YAML/JSON file containing red teaming configuration (evaluator, scenarios, etc.).",
|
|
34
|
+
)
|
|
35
|
+
@click.option(
|
|
36
|
+
"--config_file",
|
|
37
|
+
type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
|
|
38
|
+
required=False,
|
|
39
|
+
help="A JSON/YAML file that sets the parameters for the base workflow. "
|
|
40
|
+
"Overrides base_workflow in red_team_config if both are provided.",
|
|
41
|
+
)
|
|
42
|
+
@click.option(
|
|
43
|
+
"--dataset",
|
|
44
|
+
type=click.Path(exists=True, file_okay=True, dir_okay=False, path_type=Path),
|
|
45
|
+
required=False,
|
|
46
|
+
help="A JSON file with questions and ground truth answers. "
|
|
47
|
+
"Overrides the dataset path in the config file.",
|
|
48
|
+
)
|
|
49
|
+
@click.option(
|
|
50
|
+
"--result_json_path",
|
|
51
|
+
type=str,
|
|
52
|
+
default="$",
|
|
53
|
+
help="A JSON path to extract the result from the workflow. "
|
|
54
|
+
"For example, '$.output' extracts the 'output' field.",
|
|
55
|
+
)
|
|
56
|
+
@click.option(
|
|
57
|
+
"--endpoint",
|
|
58
|
+
type=str,
|
|
59
|
+
default=None,
|
|
60
|
+
help="Use endpoint for running the workflow. Example: http://localhost:8000/generate",
|
|
61
|
+
)
|
|
62
|
+
@click.option(
|
|
63
|
+
"--endpoint_timeout",
|
|
64
|
+
type=int,
|
|
65
|
+
default=300,
|
|
66
|
+
help="HTTP response timeout in seconds. Only relevant if endpoint is specified.",
|
|
67
|
+
)
|
|
68
|
+
@click.option(
|
|
69
|
+
"--reps",
|
|
70
|
+
type=int,
|
|
71
|
+
default=1,
|
|
72
|
+
help="Number of repetitions for the evaluation.",
|
|
73
|
+
)
|
|
74
|
+
@click.option(
|
|
75
|
+
"--override",
|
|
76
|
+
type=(str, str),
|
|
77
|
+
multiple=True,
|
|
78
|
+
help="Override config values for the base workflow config using dot notation "
|
|
79
|
+
"(e.g., --override llms.nim_llm.temperature 0.7)",
|
|
80
|
+
)
|
|
81
|
+
@click.pass_context
|
|
82
|
+
def red_team_command(ctx, **kwargs) -> None:
|
|
83
|
+
"""Run red teaming evaluation with multiple scenarios."""
|
|
84
|
+
pass
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@red_team_command.result_callback(replace=True)
|
|
88
|
+
def process_red_team_eval(
|
|
89
|
+
processors,
|
|
90
|
+
*,
|
|
91
|
+
red_team_config: Path | None,
|
|
92
|
+
config_file: Path | None,
|
|
93
|
+
dataset: Path | None,
|
|
94
|
+
result_json_path: str,
|
|
95
|
+
endpoint: str | None,
|
|
96
|
+
endpoint_timeout: int,
|
|
97
|
+
reps: int,
|
|
98
|
+
override: tuple[tuple[str, str], ...],
|
|
99
|
+
):
|
|
100
|
+
"""Process the red team eval command and execute the evaluation."""
|
|
101
|
+
from nat.eval.runners.red_teaming_runner import RedTeamingRunner
|
|
102
|
+
from nat.runtime.loader import load_config
|
|
103
|
+
|
|
104
|
+
from .red_teaming_utils import load_red_teaming_config
|
|
105
|
+
|
|
106
|
+
# Must have at least one of these
|
|
107
|
+
if red_team_config is None and config_file is None:
|
|
108
|
+
raise click.ClickException("Either --red_team_config or --config_file must be provided.")
|
|
109
|
+
|
|
110
|
+
# Load configs
|
|
111
|
+
rt_config = None
|
|
112
|
+
if red_team_config is not None:
|
|
113
|
+
rt_config = load_red_teaming_config(red_team_config)
|
|
114
|
+
base_workflow_path = config_file or rt_config.base_workflow
|
|
115
|
+
if base_workflow_path is None:
|
|
116
|
+
raise click.ClickException(
|
|
117
|
+
"No base workflow specified. Set 'base_workflow' in red_team_config or provide --config_file.")
|
|
118
|
+
base_workflow_config = load_config(base_workflow_path)
|
|
119
|
+
else:
|
|
120
|
+
assert config_file is not None
|
|
121
|
+
base_workflow_config = load_config(config_file)
|
|
122
|
+
|
|
123
|
+
# Create and run the runner
|
|
124
|
+
runner = RedTeamingRunner(
|
|
125
|
+
config=rt_config,
|
|
126
|
+
base_workflow_config=base_workflow_config,
|
|
127
|
+
dataset_path=str(dataset) if dataset else None,
|
|
128
|
+
result_json_path=result_json_path,
|
|
129
|
+
endpoint=endpoint,
|
|
130
|
+
endpoint_timeout=endpoint_timeout,
|
|
131
|
+
reps=reps,
|
|
132
|
+
overrides=override,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
try:
|
|
136
|
+
_ = asyncio.run(runner.run())
|
|
137
|
+
except ValueError as e:
|
|
138
|
+
raise click.ClickException(str(e)) from e
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, 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.
|
|
15
|
+
"""Utility functions for red team evaluation CLI."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import json
|
|
20
|
+
import logging
|
|
21
|
+
from pathlib import Path
|
|
22
|
+
|
|
23
|
+
import yaml
|
|
24
|
+
|
|
25
|
+
from nat.eval.runners.red_teaming_runner import RedTeamingRunnerConfig
|
|
26
|
+
|
|
27
|
+
logger = logging.getLogger(__name__)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def load_red_teaming_config(config_file: Path) -> RedTeamingRunnerConfig:
|
|
31
|
+
"""Load a RedTeamingRunnerConfig from a YAML or JSON file.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
config_file: Path to the configuration file (YAML or JSON)
|
|
35
|
+
|
|
36
|
+
Returns:
|
|
37
|
+
Parsed RedTeamingRunnerConfig object
|
|
38
|
+
|
|
39
|
+
Raises:
|
|
40
|
+
ValueError: If the file format is invalid or parsing fails
|
|
41
|
+
FileNotFoundError: If the file doesn't exist
|
|
42
|
+
"""
|
|
43
|
+
# Ensure plugins are discovered and registered before parsing the config.
|
|
44
|
+
# This triggers rebuild_annotations() which allows Pydantic to resolve
|
|
45
|
+
# discriminated unions (e.g., _type: nim -> NIMConfig).
|
|
46
|
+
from nat.runtime.loader import PluginTypes
|
|
47
|
+
from nat.runtime.loader import discover_and_register_plugins
|
|
48
|
+
discover_and_register_plugins(PluginTypes.CONFIG_OBJECT)
|
|
49
|
+
|
|
50
|
+
logger.info("Loading red teaming config from: %s", config_file)
|
|
51
|
+
|
|
52
|
+
if not config_file.exists():
|
|
53
|
+
raise FileNotFoundError(f"Red teaming config file not found: {config_file}")
|
|
54
|
+
|
|
55
|
+
with open(config_file, encoding='utf-8') as f:
|
|
56
|
+
if config_file.suffix in ('.yml', '.yaml'):
|
|
57
|
+
config_data = yaml.safe_load(f)
|
|
58
|
+
elif config_file.suffix == '.json':
|
|
59
|
+
config_data = json.load(f)
|
|
60
|
+
else:
|
|
61
|
+
raise ValueError(f"Unsupported file format: {config_file.suffix}. "
|
|
62
|
+
"Use .yml, .yaml, or .json")
|
|
63
|
+
|
|
64
|
+
if not isinstance(config_data, dict):
|
|
65
|
+
raise ValueError(f"Red teaming config file must contain a dictionary, got {type(config_data)}")
|
|
66
|
+
|
|
67
|
+
try:
|
|
68
|
+
config = RedTeamingRunnerConfig(**config_data)
|
|
69
|
+
except Exception as e:
|
|
70
|
+
raise ValueError(f"Failed to parse red teaming config: {e}") from e
|
|
71
|
+
|
|
72
|
+
logger.info("Loaded red teaming config with %d scenarios", len(config.scenarios))
|
|
73
|
+
return config
|
|
@@ -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) 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");
|