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/builder/retriever.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");
|
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: Copyright (c) 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
|
+
"""Synchronous wrapper for accessing Builder instances."""
|
|
16
|
+
|
|
17
|
+
import asyncio
|
|
18
|
+
import typing
|
|
19
|
+
from collections.abc import Sequence
|
|
20
|
+
|
|
21
|
+
from nat.authentication.interfaces import AuthProviderBase
|
|
22
|
+
from nat.builder.builder import Builder
|
|
23
|
+
from nat.builder.builder import UserManagerHolder
|
|
24
|
+
from nat.builder.framework_enum import LLMFrameworkEnum
|
|
25
|
+
from nat.builder.function import Function
|
|
26
|
+
from nat.builder.function import FunctionGroup
|
|
27
|
+
from nat.data_models.component_ref import AuthenticationRef
|
|
28
|
+
from nat.data_models.component_ref import EmbedderRef
|
|
29
|
+
from nat.data_models.component_ref import FunctionGroupRef
|
|
30
|
+
from nat.data_models.component_ref import FunctionRef
|
|
31
|
+
from nat.data_models.component_ref import LLMRef
|
|
32
|
+
from nat.data_models.component_ref import MemoryRef
|
|
33
|
+
from nat.data_models.component_ref import MiddlewareRef
|
|
34
|
+
from nat.data_models.component_ref import ObjectStoreRef
|
|
35
|
+
from nat.data_models.component_ref import RetrieverRef
|
|
36
|
+
from nat.data_models.component_ref import TrainerAdapterRef
|
|
37
|
+
from nat.data_models.component_ref import TrainerRef
|
|
38
|
+
from nat.data_models.component_ref import TrajectoryBuilderRef
|
|
39
|
+
from nat.data_models.component_ref import TTCStrategyRef
|
|
40
|
+
from nat.data_models.embedder import EmbedderBaseConfig
|
|
41
|
+
from nat.data_models.finetuning import TrainerAdapterConfig
|
|
42
|
+
from nat.data_models.finetuning import TrainerConfig
|
|
43
|
+
from nat.data_models.finetuning import TrajectoryBuilderConfig
|
|
44
|
+
from nat.data_models.function import FunctionBaseConfig
|
|
45
|
+
from nat.data_models.function import FunctionGroupBaseConfig
|
|
46
|
+
from nat.data_models.function_dependencies import FunctionDependencies
|
|
47
|
+
from nat.data_models.llm import LLMBaseConfig
|
|
48
|
+
from nat.data_models.memory import MemoryBaseConfig
|
|
49
|
+
from nat.data_models.middleware import MiddlewareBaseConfig
|
|
50
|
+
from nat.data_models.object_store import ObjectStoreBaseConfig
|
|
51
|
+
from nat.data_models.retriever import RetrieverBaseConfig
|
|
52
|
+
from nat.data_models.ttc_strategy import TTCStrategyBaseConfig
|
|
53
|
+
from nat.experimental.test_time_compute.models.stage_enums import PipelineTypeEnum
|
|
54
|
+
from nat.experimental.test_time_compute.models.stage_enums import StageTypeEnum
|
|
55
|
+
from nat.finetuning.interfaces.finetuning_runner import Trainer
|
|
56
|
+
from nat.finetuning.interfaces.trainer_adapter import TrainerAdapter
|
|
57
|
+
from nat.finetuning.interfaces.trajectory_builder import TrajectoryBuilder
|
|
58
|
+
from nat.memory.interfaces import MemoryEditor
|
|
59
|
+
from nat.middleware.middleware import Middleware
|
|
60
|
+
from nat.object_store.interfaces import ObjectStore
|
|
61
|
+
from nat.retriever.interface import Retriever
|
|
62
|
+
|
|
63
|
+
if typing.TYPE_CHECKING:
|
|
64
|
+
from nat.experimental.test_time_compute.models.strategy_base import StrategyBase
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class SyncBuilder:
|
|
68
|
+
"""Synchronous wrapper for the Builder class.
|
|
69
|
+
|
|
70
|
+
Provides synchronous access to Builder methods by wrapping async calls with run_until_complete.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
def __init__(self, builder: Builder) -> None:
|
|
74
|
+
self._builder = builder
|
|
75
|
+
|
|
76
|
+
try:
|
|
77
|
+
# Save the current loop. This should always be available given the creation pattern of the Builder class.
|
|
78
|
+
self._loop = asyncio.get_running_loop()
|
|
79
|
+
except RuntimeError as e:
|
|
80
|
+
raise ValueError("No event loop is running. If you are running the code in a synchronous context, "
|
|
81
|
+
"please use the async builder instead.") from e
|
|
82
|
+
|
|
83
|
+
@staticmethod
|
|
84
|
+
def current() -> "SyncBuilder":
|
|
85
|
+
"""Get the SyncBuilder object from the current context.
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
The SyncBuilder object wrapping the current Builder, or raises ValueError if not set.
|
|
89
|
+
"""
|
|
90
|
+
return SyncBuilder(Builder.current())
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def async_builder(self) -> Builder:
|
|
94
|
+
"""Get the async version of the builder.
|
|
95
|
+
|
|
96
|
+
Returns:
|
|
97
|
+
The Builder object (async).
|
|
98
|
+
"""
|
|
99
|
+
return self._builder
|
|
100
|
+
|
|
101
|
+
def get_function(self, name: str | FunctionRef) -> Function:
|
|
102
|
+
"""Get a function by name.
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
name: The name or reference of the function
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
The built function instance
|
|
109
|
+
"""
|
|
110
|
+
return self._loop.run_until_complete(self._builder.get_function(name))
|
|
111
|
+
|
|
112
|
+
def get_function_group(self, name: str | FunctionGroupRef) -> FunctionGroup:
|
|
113
|
+
"""Get a function group by name.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
name: The name or reference of the function group
|
|
117
|
+
|
|
118
|
+
Returns:
|
|
119
|
+
The built function group instance
|
|
120
|
+
"""
|
|
121
|
+
return self._loop.run_until_complete(self._builder.get_function_group(name))
|
|
122
|
+
|
|
123
|
+
def get_functions(self, function_names: Sequence[str | FunctionRef]) -> list[Function]:
|
|
124
|
+
"""Get multiple functions by name.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
function_names: The names or references of the functions
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
List of built function instances
|
|
131
|
+
"""
|
|
132
|
+
return self._loop.run_until_complete(self._builder.get_functions(function_names))
|
|
133
|
+
|
|
134
|
+
def get_function_groups(self, function_group_names: Sequence[str | FunctionGroupRef]) -> list[FunctionGroup]:
|
|
135
|
+
"""Get multiple function groups by name.
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
function_group_names: The names or references of the function groups
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
List of built function group instances
|
|
142
|
+
"""
|
|
143
|
+
return self._loop.run_until_complete(self._builder.get_function_groups(function_group_names))
|
|
144
|
+
|
|
145
|
+
def get_function_config(self, name: str | FunctionRef) -> FunctionBaseConfig:
|
|
146
|
+
"""Get the configuration for a function.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
name: The name or reference of the function
|
|
150
|
+
|
|
151
|
+
Returns:
|
|
152
|
+
The configuration for the function
|
|
153
|
+
"""
|
|
154
|
+
return self._builder.get_function_config(name)
|
|
155
|
+
|
|
156
|
+
def get_function_group_config(self, name: str | FunctionGroupRef) -> FunctionGroupBaseConfig:
|
|
157
|
+
"""Get the configuration for a function group.
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
name: The name or reference of the function group
|
|
161
|
+
|
|
162
|
+
Returns:
|
|
163
|
+
The configuration for the function group
|
|
164
|
+
"""
|
|
165
|
+
return self._builder.get_function_group_config(name)
|
|
166
|
+
|
|
167
|
+
def get_workflow(self) -> Function:
|
|
168
|
+
"""Get the workflow function.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
The workflow function instance
|
|
172
|
+
"""
|
|
173
|
+
return self._builder.get_workflow()
|
|
174
|
+
|
|
175
|
+
def get_workflow_config(self) -> FunctionBaseConfig:
|
|
176
|
+
"""Get the configuration for the workflow.
|
|
177
|
+
|
|
178
|
+
Returns:
|
|
179
|
+
The configuration for the workflow function
|
|
180
|
+
"""
|
|
181
|
+
return self._builder.get_workflow_config()
|
|
182
|
+
|
|
183
|
+
def get_tools(self,
|
|
184
|
+
tool_names: Sequence[str | FunctionRef | FunctionGroupRef],
|
|
185
|
+
wrapper_type: LLMFrameworkEnum | str) -> list[typing.Any]:
|
|
186
|
+
"""Get multiple tools by name wrapped in the specified framework type.
|
|
187
|
+
|
|
188
|
+
Args:
|
|
189
|
+
tool_names: The names or references of the tools (functions or function groups)
|
|
190
|
+
wrapper_type: The LLM framework type to wrap the tools in
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
List of tools wrapped in the specified framework type
|
|
194
|
+
"""
|
|
195
|
+
return self._loop.run_until_complete(self._builder.get_tools(tool_names, wrapper_type))
|
|
196
|
+
|
|
197
|
+
def get_tool(self, fn_name: str | FunctionRef, wrapper_type: LLMFrameworkEnum | str) -> typing.Any:
|
|
198
|
+
"""Get a tool by name wrapped in the specified framework type.
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
fn_name: The name or reference of the tool (function)
|
|
202
|
+
wrapper_type: The LLM framework type to wrap the tool in
|
|
203
|
+
|
|
204
|
+
Returns:
|
|
205
|
+
The tool wrapped in the specified framework type
|
|
206
|
+
"""
|
|
207
|
+
return self._loop.run_until_complete(self._builder.get_tool(fn_name, wrapper_type))
|
|
208
|
+
|
|
209
|
+
def get_llm(self, llm_name: str | LLMRef, wrapper_type: LLMFrameworkEnum | str) -> typing.Any:
|
|
210
|
+
"""Get an LLM by name wrapped in the specified framework type.
|
|
211
|
+
|
|
212
|
+
Args:
|
|
213
|
+
llm_name: The name or reference of the LLM
|
|
214
|
+
wrapper_type: The LLM framework type to wrap the LLM in
|
|
215
|
+
|
|
216
|
+
Returns:
|
|
217
|
+
The LLM wrapped in the specified framework type
|
|
218
|
+
"""
|
|
219
|
+
return self._loop.run_until_complete(self._builder.get_llm(llm_name, wrapper_type))
|
|
220
|
+
|
|
221
|
+
def get_llms(self, llm_names: Sequence[str | LLMRef], wrapper_type: LLMFrameworkEnum | str) -> list[typing.Any]:
|
|
222
|
+
"""Get multiple LLMs by name wrapped in the specified framework type.
|
|
223
|
+
|
|
224
|
+
Args:
|
|
225
|
+
llm_names: The names or references of the LLMs
|
|
226
|
+
wrapper_type: The LLM framework type to wrap the LLMs in
|
|
227
|
+
|
|
228
|
+
Returns:
|
|
229
|
+
List of LLMs wrapped in the specified framework type
|
|
230
|
+
"""
|
|
231
|
+
return self._loop.run_until_complete(self._builder.get_llms(llm_names, wrapper_type))
|
|
232
|
+
|
|
233
|
+
def get_llm_config(self, llm_name: str | LLMRef) -> LLMBaseConfig:
|
|
234
|
+
"""Get the configuration for an LLM.
|
|
235
|
+
|
|
236
|
+
Args:
|
|
237
|
+
llm_name: The name or reference of the LLM
|
|
238
|
+
|
|
239
|
+
Returns:
|
|
240
|
+
The configuration for the LLM
|
|
241
|
+
"""
|
|
242
|
+
return self._builder.get_llm_config(llm_name)
|
|
243
|
+
|
|
244
|
+
def get_auth_provider(self, auth_provider_name: str | AuthenticationRef) -> AuthProviderBase:
|
|
245
|
+
"""Get an authentication provider by name.
|
|
246
|
+
|
|
247
|
+
Args:
|
|
248
|
+
auth_provider_name: The name or reference of the authentication provider
|
|
249
|
+
|
|
250
|
+
Returns:
|
|
251
|
+
The authentication provider instance
|
|
252
|
+
"""
|
|
253
|
+
return self._loop.run_until_complete(self._builder.get_auth_provider(auth_provider_name))
|
|
254
|
+
|
|
255
|
+
def get_auth_providers(self, auth_provider_names: list[str | AuthenticationRef]) -> list[AuthProviderBase]:
|
|
256
|
+
"""Get multiple authentication providers by name.
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
auth_provider_names: The names or references of the authentication providers
|
|
260
|
+
|
|
261
|
+
Returns:
|
|
262
|
+
List of authentication provider instances
|
|
263
|
+
"""
|
|
264
|
+
return self._loop.run_until_complete(self._builder.get_auth_providers(auth_provider_names))
|
|
265
|
+
|
|
266
|
+
def get_object_store_clients(self, object_store_names: Sequence[str | ObjectStoreRef]) -> list[ObjectStore]:
|
|
267
|
+
"""
|
|
268
|
+
Return a list of all object store clients.
|
|
269
|
+
"""
|
|
270
|
+
return self._loop.run_until_complete(self._builder.get_object_store_clients(object_store_names))
|
|
271
|
+
|
|
272
|
+
def get_object_store_client(self, object_store_name: str | ObjectStoreRef) -> ObjectStore:
|
|
273
|
+
"""Get an object store client by name.
|
|
274
|
+
|
|
275
|
+
Args:
|
|
276
|
+
object_store_name: The name or reference of the object store
|
|
277
|
+
|
|
278
|
+
Returns:
|
|
279
|
+
The object store client instance
|
|
280
|
+
"""
|
|
281
|
+
return self._loop.run_until_complete(self._builder.get_object_store_client(object_store_name))
|
|
282
|
+
|
|
283
|
+
def get_object_store_config(self, object_store_name: str | ObjectStoreRef) -> ObjectStoreBaseConfig:
|
|
284
|
+
"""Get the configuration for an object store.
|
|
285
|
+
|
|
286
|
+
Args:
|
|
287
|
+
object_store_name: The name or reference of the object store
|
|
288
|
+
|
|
289
|
+
Returns:
|
|
290
|
+
The configuration for the object store
|
|
291
|
+
"""
|
|
292
|
+
return self._builder.get_object_store_config(object_store_name)
|
|
293
|
+
|
|
294
|
+
def get_embedders(self, embedder_names: Sequence[str | EmbedderRef],
|
|
295
|
+
wrapper_type: LLMFrameworkEnum | str) -> list[typing.Any]:
|
|
296
|
+
"""Get multiple embedders by name wrapped in the specified framework type.
|
|
297
|
+
|
|
298
|
+
Args:
|
|
299
|
+
embedder_names: The names or references of the embedders
|
|
300
|
+
wrapper_type: The LLM framework type to wrap the embedders in
|
|
301
|
+
|
|
302
|
+
Returns:
|
|
303
|
+
List of embedders wrapped in the specified framework type
|
|
304
|
+
"""
|
|
305
|
+
return self._loop.run_until_complete(self._builder.get_embedders(embedder_names, wrapper_type))
|
|
306
|
+
|
|
307
|
+
def get_embedder(self, embedder_name: str | EmbedderRef, wrapper_type: LLMFrameworkEnum | str) -> typing.Any:
|
|
308
|
+
"""Get an embedder by name wrapped in the specified framework type.
|
|
309
|
+
|
|
310
|
+
Args:
|
|
311
|
+
embedder_name: The name or reference of the embedder
|
|
312
|
+
wrapper_type: The LLM framework type to wrap the embedder in
|
|
313
|
+
|
|
314
|
+
Returns:
|
|
315
|
+
The embedder wrapped in the specified framework type
|
|
316
|
+
"""
|
|
317
|
+
return self._loop.run_until_complete(self._builder.get_embedder(embedder_name, wrapper_type))
|
|
318
|
+
|
|
319
|
+
def get_embedder_config(self, embedder_name: str | EmbedderRef) -> EmbedderBaseConfig:
|
|
320
|
+
"""Get the configuration for an embedder.
|
|
321
|
+
|
|
322
|
+
Args:
|
|
323
|
+
embedder_name: The name or reference of the embedder
|
|
324
|
+
|
|
325
|
+
Returns:
|
|
326
|
+
The configuration for the embedder
|
|
327
|
+
"""
|
|
328
|
+
return self._builder.get_embedder_config(embedder_name)
|
|
329
|
+
|
|
330
|
+
def get_memory_clients(self, memory_names: Sequence[str | MemoryRef]) -> list[MemoryEditor]:
|
|
331
|
+
"""
|
|
332
|
+
Return a list of memory clients for the specified names.
|
|
333
|
+
"""
|
|
334
|
+
return self._loop.run_until_complete(self._builder.get_memory_clients(memory_names))
|
|
335
|
+
|
|
336
|
+
def get_memory_client(self, memory_name: str | MemoryRef) -> MemoryEditor:
|
|
337
|
+
"""
|
|
338
|
+
Return the instantiated memory client for the given name.
|
|
339
|
+
"""
|
|
340
|
+
return self._loop.run_until_complete(self._builder.get_memory_client(memory_name))
|
|
341
|
+
|
|
342
|
+
def get_memory_client_config(self, memory_name: str | MemoryRef) -> MemoryBaseConfig:
|
|
343
|
+
"""Get the configuration for a memory client.
|
|
344
|
+
|
|
345
|
+
Args:
|
|
346
|
+
memory_name: The name or reference of the memory client
|
|
347
|
+
|
|
348
|
+
Returns:
|
|
349
|
+
The configuration for the memory client
|
|
350
|
+
"""
|
|
351
|
+
return self._builder.get_memory_client_config(memory_name)
|
|
352
|
+
|
|
353
|
+
def get_retrievers(self,
|
|
354
|
+
retriever_names: Sequence[str | RetrieverRef],
|
|
355
|
+
wrapper_type: LLMFrameworkEnum | str | None = None) -> list[Retriever]:
|
|
356
|
+
"""Get multiple retrievers by name.
|
|
357
|
+
|
|
358
|
+
Args:
|
|
359
|
+
retriever_names: The names or references of the retrievers
|
|
360
|
+
wrapper_type: Optional LLM framework type to wrap the retrievers in
|
|
361
|
+
|
|
362
|
+
Returns:
|
|
363
|
+
List of retriever instances
|
|
364
|
+
"""
|
|
365
|
+
return self._loop.run_until_complete(self._builder.get_retrievers(retriever_names, wrapper_type))
|
|
366
|
+
|
|
367
|
+
@typing.overload
|
|
368
|
+
def get_retriever(self, retriever_name: str | RetrieverRef, wrapper_type: LLMFrameworkEnum | str) -> typing.Any:
|
|
369
|
+
...
|
|
370
|
+
|
|
371
|
+
@typing.overload
|
|
372
|
+
def get_retriever(self, retriever_name: str | RetrieverRef, wrapper_type: None) -> Retriever:
|
|
373
|
+
...
|
|
374
|
+
|
|
375
|
+
@typing.overload
|
|
376
|
+
def get_retriever(self, retriever_name: str | RetrieverRef) -> Retriever:
|
|
377
|
+
...
|
|
378
|
+
|
|
379
|
+
def get_retriever(self,
|
|
380
|
+
retriever_name: str | RetrieverRef,
|
|
381
|
+
wrapper_type: LLMFrameworkEnum | str | None = None) -> typing.Any:
|
|
382
|
+
"""Get a retriever by name.
|
|
383
|
+
|
|
384
|
+
Args:
|
|
385
|
+
retriever_name: The name or reference of the retriever
|
|
386
|
+
wrapper_type: Optional LLM framework type to wrap the retriever in
|
|
387
|
+
|
|
388
|
+
Returns:
|
|
389
|
+
The retriever instance, optionally wrapped in the specified framework type
|
|
390
|
+
"""
|
|
391
|
+
return self._loop.run_until_complete(self._builder.get_retriever(retriever_name, wrapper_type))
|
|
392
|
+
|
|
393
|
+
def get_retriever_config(self, retriever_name: str | RetrieverRef) -> RetrieverBaseConfig:
|
|
394
|
+
"""Get the configuration for a retriever.
|
|
395
|
+
|
|
396
|
+
Args:
|
|
397
|
+
retriever_name: The name or reference of the retriever
|
|
398
|
+
|
|
399
|
+
Returns:
|
|
400
|
+
The configuration for the retriever
|
|
401
|
+
"""
|
|
402
|
+
return self._loop.run_until_complete(self._builder.get_retriever_config(retriever_name))
|
|
403
|
+
|
|
404
|
+
def get_trainer(self,
|
|
405
|
+
trainer_name: str | TrainerRef,
|
|
406
|
+
trajectory_builder: TrajectoryBuilder,
|
|
407
|
+
trainer_adapter: TrainerAdapter) -> Trainer:
|
|
408
|
+
"""Get a trainer by name with the specified trajectory builder and trainer adapter.
|
|
409
|
+
|
|
410
|
+
Args:
|
|
411
|
+
trainer_name: The name or reference of the trainer
|
|
412
|
+
trajectory_builder: The trajectory builder instance
|
|
413
|
+
trainer_adapter: The trainer adapter instance
|
|
414
|
+
|
|
415
|
+
Returns:
|
|
416
|
+
The trainer instance
|
|
417
|
+
"""
|
|
418
|
+
return self._loop.run_until_complete(
|
|
419
|
+
self._builder.get_trainer(trainer_name, trajectory_builder, trainer_adapter))
|
|
420
|
+
|
|
421
|
+
def get_trainer_adapter(self, trainer_adapter_name: str | TrainerAdapterRef) -> TrainerAdapter:
|
|
422
|
+
"""Get a trainer adapter by name.
|
|
423
|
+
|
|
424
|
+
Args:
|
|
425
|
+
trainer_adapter_name: The name or reference of the trainer adapter
|
|
426
|
+
|
|
427
|
+
Returns:
|
|
428
|
+
The trainer adapter instance
|
|
429
|
+
"""
|
|
430
|
+
return self._loop.run_until_complete(self._builder.get_trainer_adapter(trainer_adapter_name))
|
|
431
|
+
|
|
432
|
+
def get_trajectory_builder(self, trajectory_builder_name: str | TrajectoryBuilderRef) -> TrajectoryBuilder:
|
|
433
|
+
"""Get a trajectory builder by name.
|
|
434
|
+
|
|
435
|
+
Args:
|
|
436
|
+
trajectory_builder_name: The name or reference of the trajectory builder
|
|
437
|
+
|
|
438
|
+
Returns:
|
|
439
|
+
The trajectory builder instance
|
|
440
|
+
"""
|
|
441
|
+
return self._loop.run_until_complete(self._builder.get_trajectory_builder(trajectory_builder_name))
|
|
442
|
+
|
|
443
|
+
def get_trainer_config(self, trainer_name: str | TrainerRef) -> TrainerConfig:
|
|
444
|
+
"""Get the configuration for a trainer.
|
|
445
|
+
|
|
446
|
+
Args:
|
|
447
|
+
trainer_name: The name or reference of the trainer
|
|
448
|
+
|
|
449
|
+
Returns:
|
|
450
|
+
The configuration for the trainer
|
|
451
|
+
"""
|
|
452
|
+
return self._loop.run_until_complete(self._builder.get_trainer_config(trainer_name))
|
|
453
|
+
|
|
454
|
+
def get_trainer_adapter_config(self, trainer_adapter_name: str | TrainerAdapterRef) -> TrainerAdapterConfig:
|
|
455
|
+
"""Get the configuration for a trainer adapter.
|
|
456
|
+
|
|
457
|
+
Args:
|
|
458
|
+
trainer_adapter_name: The name or reference of the trainer adapter
|
|
459
|
+
|
|
460
|
+
Returns:
|
|
461
|
+
The configuration for the trainer adapter
|
|
462
|
+
"""
|
|
463
|
+
return self._loop.run_until_complete(self._builder.get_trainer_adapter_config(trainer_adapter_name))
|
|
464
|
+
|
|
465
|
+
def get_trajectory_builder_config(self,
|
|
466
|
+
trajectory_builder_name: str | TrajectoryBuilderRef) -> TrajectoryBuilderConfig:
|
|
467
|
+
"""Get the configuration for a trajectory builder.
|
|
468
|
+
|
|
469
|
+
Args:
|
|
470
|
+
trajectory_builder_name: The name or reference of the trajectory builder
|
|
471
|
+
|
|
472
|
+
Returns:
|
|
473
|
+
The configuration for the trajectory builder
|
|
474
|
+
"""
|
|
475
|
+
return self._loop.run_until_complete(self._builder.get_trajectory_builder_config(trajectory_builder_name))
|
|
476
|
+
|
|
477
|
+
def get_ttc_strategy(self,
|
|
478
|
+
strategy_name: str | TTCStrategyRef,
|
|
479
|
+
pipeline_type: PipelineTypeEnum,
|
|
480
|
+
stage_type: StageTypeEnum) -> "StrategyBase":
|
|
481
|
+
"""Get a test-time compute strategy by name.
|
|
482
|
+
|
|
483
|
+
Args:
|
|
484
|
+
strategy_name: The name or reference of the TTC strategy
|
|
485
|
+
pipeline_type: The pipeline type for the strategy
|
|
486
|
+
stage_type: The stage type for the strategy
|
|
487
|
+
|
|
488
|
+
Returns:
|
|
489
|
+
The TTC strategy instance
|
|
490
|
+
"""
|
|
491
|
+
return self._loop.run_until_complete(self._builder.get_ttc_strategy(strategy_name, pipeline_type, stage_type))
|
|
492
|
+
|
|
493
|
+
def get_ttc_strategy_config(self,
|
|
494
|
+
strategy_name: str | TTCStrategyRef,
|
|
495
|
+
pipeline_type: PipelineTypeEnum,
|
|
496
|
+
stage_type: StageTypeEnum) -> TTCStrategyBaseConfig:
|
|
497
|
+
"""Get the configuration for a test-time compute strategy.
|
|
498
|
+
|
|
499
|
+
Args:
|
|
500
|
+
strategy_name: The name or reference of the TTC strategy
|
|
501
|
+
pipeline_type: The pipeline type for the strategy
|
|
502
|
+
stage_type: The stage type for the strategy
|
|
503
|
+
|
|
504
|
+
Returns:
|
|
505
|
+
The configuration for the TTC strategy
|
|
506
|
+
"""
|
|
507
|
+
return self._loop.run_until_complete(
|
|
508
|
+
self._builder.get_ttc_strategy_config(strategy_name, pipeline_type, stage_type))
|
|
509
|
+
|
|
510
|
+
def get_user_manager(self) -> UserManagerHolder:
|
|
511
|
+
"""Get the user manager holder.
|
|
512
|
+
|
|
513
|
+
Returns:
|
|
514
|
+
The user manager holder instance
|
|
515
|
+
"""
|
|
516
|
+
return self._builder.get_user_manager()
|
|
517
|
+
|
|
518
|
+
def get_function_dependencies(self, fn_name: str) -> FunctionDependencies:
|
|
519
|
+
"""Get the dependencies for a function.
|
|
520
|
+
|
|
521
|
+
Args:
|
|
522
|
+
fn_name: The name of the function
|
|
523
|
+
|
|
524
|
+
Returns:
|
|
525
|
+
The function dependencies
|
|
526
|
+
"""
|
|
527
|
+
return self._builder.get_function_dependencies(fn_name)
|
|
528
|
+
|
|
529
|
+
def get_function_group_dependencies(self, fn_name: str) -> FunctionDependencies:
|
|
530
|
+
"""Get the dependencies for a function group.
|
|
531
|
+
|
|
532
|
+
Args:
|
|
533
|
+
fn_name: The name of the function group
|
|
534
|
+
|
|
535
|
+
Returns:
|
|
536
|
+
The function group dependencies
|
|
537
|
+
"""
|
|
538
|
+
return self._builder.get_function_group_dependencies(fn_name)
|
|
539
|
+
|
|
540
|
+
def get_middleware(self, middleware_name: str | MiddlewareRef) -> Middleware:
|
|
541
|
+
"""Get built middleware by name.
|
|
542
|
+
|
|
543
|
+
Args:
|
|
544
|
+
middleware_name: The name or reference of the middleware
|
|
545
|
+
|
|
546
|
+
Returns:
|
|
547
|
+
The built middleware instance
|
|
548
|
+
"""
|
|
549
|
+
return self._loop.run_until_complete(self._builder.get_middleware(middleware_name))
|
|
550
|
+
|
|
551
|
+
def get_middleware_config(self, middleware_name: str | MiddlewareRef) -> MiddlewareBaseConfig:
|
|
552
|
+
"""Get the configuration for middleware.
|
|
553
|
+
|
|
554
|
+
Args:
|
|
555
|
+
middleware_name: The name or reference of the middleware
|
|
556
|
+
|
|
557
|
+
Returns:
|
|
558
|
+
The configuration for the middleware
|
|
559
|
+
"""
|
|
560
|
+
return self._builder.get_middleware_config(middleware_name)
|
|
561
|
+
|
|
562
|
+
def get_middleware_list(self, middleware_names: Sequence[str | MiddlewareRef]) -> list[Middleware]:
|
|
563
|
+
"""Get multiple middleware by name.
|
|
564
|
+
|
|
565
|
+
Args:
|
|
566
|
+
middleware_names: The names or references of the middleware
|
|
567
|
+
|
|
568
|
+
Returns:
|
|
569
|
+
List of built middleware instances
|
|
570
|
+
"""
|
|
571
|
+
return self._loop.run_until_complete(self._builder.get_middleware_list(middleware_names))
|
|
@@ -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/builder/workflow.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");
|
|
@@ -28,6 +28,7 @@ from nat.builder.function_base import StreamingOutputT
|
|
|
28
28
|
from nat.builder.llm import LLMProviderInfo
|
|
29
29
|
from nat.builder.retriever import RetrieverProviderInfo
|
|
30
30
|
from nat.data_models.config import Config
|
|
31
|
+
from nat.data_models.runtime_enum import RuntimeTypeEnum
|
|
31
32
|
from nat.experimental.test_time_compute.models.strategy_base import StrategyBase
|
|
32
33
|
from nat.memory.interfaces import MemoryEditor
|
|
33
34
|
from nat.object_store.interfaces import ObjectStore
|
|
@@ -94,7 +95,7 @@ class Workflow(FunctionBase[InputT, StreamingOutputT, SingleOutputT]):
|
|
|
94
95
|
return self._exporter_manager.get()
|
|
95
96
|
|
|
96
97
|
@asynccontextmanager
|
|
97
|
-
async def run(self, message: InputT):
|
|
98
|
+
async def run(self, message: InputT, runtime_type: RuntimeTypeEnum = RuntimeTypeEnum.RUN_OR_SERVE):
|
|
98
99
|
"""
|
|
99
100
|
Called each time we start a new workflow run. We'll create
|
|
100
101
|
a new top-level workflow span here.
|
|
@@ -103,7 +104,8 @@ class Workflow(FunctionBase[InputT, StreamingOutputT, SingleOutputT]):
|
|
|
103
104
|
async with Runner(input_message=message,
|
|
104
105
|
entry_fn=self._entry_fn,
|
|
105
106
|
context_state=self._context_state,
|
|
106
|
-
exporter_manager=self.exporter_manager
|
|
107
|
+
exporter_manager=self.exporter_manager,
|
|
108
|
+
runtime_type=runtime_type) as runner:
|
|
107
109
|
|
|
108
110
|
# The caller can `yield runner` so they can do `runner.result()` or `runner.result_stream()`
|
|
109
111
|
yield runner
|