nvidia-nat 1.2.0rc5__py3-none-any.whl → 1.2.0rc7__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 → nat}/agent/react_agent/agent.py +12 -12
- {aiq → nat}/agent/react_agent/register.py +20 -20
- {aiq → nat}/agent/reasoning_agent/reasoning_agent.py +14 -14
- {aiq → nat}/agent/rewoo_agent/agent.py +7 -7
- {aiq → nat}/agent/rewoo_agent/prompt.py +11 -12
- {aiq → nat}/agent/rewoo_agent/register.py +47 -49
- {aiq → nat}/agent/tool_calling_agent/agent.py +4 -4
- {aiq → nat}/agent/tool_calling_agent/register.py +8 -8
- {aiq → nat}/authentication/api_key/api_key_auth_provider.py +6 -6
- {aiq → nat}/authentication/api_key/api_key_auth_provider_config.py +5 -5
- {aiq → nat}/authentication/api_key/register.py +4 -4
- {aiq → nat}/authentication/http_basic_auth/http_basic_auth_provider.py +10 -10
- {aiq → nat}/authentication/http_basic_auth/register.py +4 -4
- {aiq → nat}/authentication/interfaces.py +6 -6
- {aiq → nat}/authentication/oauth2/oauth2_auth_code_flow_provider.py +11 -11
- {aiq → nat}/authentication/oauth2/oauth2_auth_code_flow_provider_config.py +1 -1
- {aiq → nat}/authentication/oauth2/register.py +4 -4
- {aiq → nat}/authentication/register.py +3 -3
- {aiq → nat}/builder/builder.py +30 -30
- {aiq → nat}/builder/component_utils.py +23 -23
- {aiq → nat}/builder/context.py +35 -29
- {aiq → nat}/builder/embedder.py +1 -1
- {aiq → nat}/builder/eval_builder.py +13 -13
- {aiq → nat}/builder/evaluator.py +3 -3
- {aiq → nat}/builder/front_end.py +11 -11
- {aiq → nat}/builder/function.py +8 -8
- {aiq → nat}/builder/function_base.py +6 -6
- {aiq → nat}/builder/function_info.py +3 -3
- {aiq → nat}/builder/intermediate_step_manager.py +13 -13
- {aiq → nat}/builder/llm.py +1 -1
- {aiq → nat}/builder/retriever.py +1 -1
- {aiq → nat}/builder/user_interaction_manager.py +14 -10
- {aiq → nat}/builder/workflow.py +25 -25
- {aiq → nat}/builder/workflow_builder.py +86 -86
- {aiq → nat}/cli/cli_utils/config_override.py +2 -2
- {aiq → nat}/cli/cli_utils/validation.py +4 -4
- {aiq → nat}/cli/commands/configure/channel/add.py +2 -2
- {aiq → nat}/cli/commands/configure/channel/channel.py +4 -6
- {aiq → nat}/cli/commands/configure/channel/remove.py +2 -2
- {aiq → nat}/cli/commands/configure/channel/update.py +2 -2
- {aiq → nat}/cli/commands/configure/configure.py +3 -3
- {aiq → nat}/cli/commands/evaluate.py +3 -3
- {aiq → nat}/cli/commands/info/info.py +5 -7
- {aiq → nat}/cli/commands/info/list_channels.py +1 -1
- {aiq → nat}/cli/commands/info/list_components.py +14 -14
- {aiq → nat}/cli/commands/info/list_mcp.py +106 -15
- {aiq → nat}/cli/commands/registry/publish.py +9 -9
- {aiq → nat}/cli/commands/registry/pull.py +10 -10
- {aiq → nat}/cli/commands/registry/registry.py +5 -7
- {aiq → nat}/cli/commands/registry/remove.py +8 -8
- {aiq → nat}/cli/commands/registry/search.py +15 -15
- {aiq → nat}/cli/commands/sizing/calc.py +3 -3
- {aiq → nat}/cli/commands/start.py +15 -15
- {aiq → nat}/cli/commands/uninstall.py +5 -5
- {aiq → nat}/cli/commands/validate.py +1 -1
- {aiq → nat}/cli/commands/workflow/templates/pyproject.toml.j2 +4 -4
- {aiq → nat}/cli/commands/workflow/templates/workflow.py.j2 +4 -4
- {aiq → nat}/cli/commands/workflow/workflow.py +3 -3
- {aiq → nat}/cli/commands/workflow/workflow_commands.py +15 -11
- {aiq → nat}/cli/entrypoint.py +6 -6
- {aiq → nat}/cli/main.py +15 -2
- {aiq → nat}/cli/register_workflow.py +70 -70
- {aiq → nat}/cli/type_registry.py +82 -82
- {aiq → nat}/data_models/api_server.py +121 -99
- {aiq → nat}/data_models/authentication.py +2 -2
- {aiq → nat}/data_models/component.py +5 -1
- {aiq → nat}/data_models/component_ref.py +12 -12
- {aiq → nat}/data_models/config.py +17 -13
- {aiq → nat}/data_models/dataset_handler.py +58 -12
- {aiq → nat}/data_models/discovery_metadata.py +36 -66
- {aiq → nat}/data_models/evaluate.py +9 -9
- {aiq → nat}/data_models/intermediate_step.py +7 -7
- {aiq → nat}/data_models/retriever.py +2 -2
- {aiq → nat}/data_models/span.py +10 -7
- {aiq → nat}/data_models/step_adaptor.py +1 -1
- {aiq → nat}/data_models/telemetry_exporter.py +2 -2
- {aiq → nat}/embedder/nim_embedder.py +5 -5
- {aiq → nat}/embedder/openai_embedder.py +5 -5
- {aiq/retriever → nat/embedder}/register.py +2 -2
- {aiq → nat}/eval/config.py +4 -4
- {aiq → nat}/eval/dataset_handler/dataset_downloader.py +1 -1
- {aiq → nat}/eval/dataset_handler/dataset_filter.py +1 -1
- {aiq → nat}/eval/dataset_handler/dataset_handler.py +127 -14
- {aiq → nat}/eval/evaluate.py +38 -34
- {aiq → nat}/eval/evaluator/base_evaluator.py +9 -5
- {aiq → nat}/eval/evaluator/evaluator_model.py +4 -4
- {aiq → nat}/eval/intermediate_step_adapter.py +2 -2
- {aiq → nat}/eval/rag_evaluator/evaluate.py +8 -8
- {aiq → nat}/eval/rag_evaluator/register.py +7 -7
- {aiq → nat}/eval/remote_workflow.py +8 -8
- {aiq → nat}/eval/runners/config.py +2 -2
- {aiq → nat}/eval/runners/multi_eval_runner.py +4 -4
- {aiq → nat}/eval/runtime_event_subscriber.py +3 -3
- {aiq → nat}/eval/swe_bench_evaluator/evaluate.py +6 -6
- {aiq → nat}/eval/swe_bench_evaluator/register.py +4 -4
- {aiq → nat}/eval/trajectory_evaluator/evaluate.py +5 -5
- {aiq → nat}/eval/trajectory_evaluator/register.py +5 -5
- {aiq → nat}/eval/tunable_rag_evaluator/evaluate.py +3 -3
- {aiq → nat}/eval/tunable_rag_evaluator/register.py +6 -6
- {aiq → nat}/eval/utils/output_uploader.py +1 -1
- {aiq → nat}/eval/utils/weave_eval.py +6 -6
- {aiq → nat}/experimental/decorators/experimental_warning_decorator.py +6 -2
- {aiq → nat}/experimental/test_time_compute/editing/iterative_plan_refinement_editor.py +10 -10
- {aiq → nat}/experimental/test_time_compute/editing/llm_as_a_judge_editor.py +10 -10
- {aiq → nat}/experimental/test_time_compute/editing/motivation_aware_summarization.py +10 -10
- {aiq → nat}/experimental/test_time_compute/functions/execute_score_select_function.py +10 -10
- {aiq → nat}/experimental/test_time_compute/functions/plan_select_execute_function.py +17 -17
- aiq/experimental/test_time_compute/functions/its_tool_orchestration_function.py → nat/experimental/test_time_compute/functions/ttc_tool_orchestration_function.py +12 -12
- aiq/experimental/test_time_compute/functions/its_tool_wrapper_function.py → nat/experimental/test_time_compute/functions/ttc_tool_wrapper_function.py +10 -10
- {aiq → nat}/experimental/test_time_compute/models/editor_config.py +2 -2
- {aiq → nat}/experimental/test_time_compute/models/scoring_config.py +2 -2
- {aiq → nat}/experimental/test_time_compute/models/search_config.py +2 -2
- {aiq → nat}/experimental/test_time_compute/models/selection_config.py +2 -2
- {aiq → nat}/experimental/test_time_compute/models/strategy_base.py +4 -4
- {aiq → nat}/experimental/test_time_compute/register.py +2 -2
- {aiq → nat}/experimental/test_time_compute/scoring/llm_based_agent_scorer.py +11 -11
- {aiq → nat}/experimental/test_time_compute/scoring/llm_based_plan_scorer.py +11 -11
- {aiq → nat}/experimental/test_time_compute/scoring/motivation_aware_scorer.py +10 -10
- {aiq → nat}/experimental/test_time_compute/search/multi_llm_planner.py +10 -10
- {aiq → nat}/experimental/test_time_compute/search/multi_query_retrieval_search.py +10 -10
- {aiq → nat}/experimental/test_time_compute/search/single_shot_multi_plan_planner.py +11 -11
- {aiq → nat}/experimental/test_time_compute/selection/best_of_n_selector.py +7 -7
- {aiq → nat}/experimental/test_time_compute/selection/llm_based_agent_output_selector.py +11 -11
- {aiq → nat}/experimental/test_time_compute/selection/llm_based_output_merging_selector.py +11 -11
- {aiq → nat}/experimental/test_time_compute/selection/llm_based_plan_selector.py +11 -11
- {aiq → nat}/experimental/test_time_compute/selection/threshold_selector.py +7 -7
- {aiq → nat}/front_ends/console/authentication_flow_handler.py +6 -6
- {aiq → nat}/front_ends/console/console_front_end_config.py +2 -2
- {aiq → nat}/front_ends/console/console_front_end_plugin.py +9 -9
- {aiq → nat}/front_ends/console/register.py +5 -5
- {aiq → nat}/front_ends/fastapi/auth_flow_handlers/http_flow_handler.py +4 -4
- {aiq → nat}/front_ends/fastapi/auth_flow_handlers/websocket_flow_handler.py +6 -6
- {aiq → nat}/front_ends/fastapi/fastapi_front_end_config.py +22 -15
- {aiq → nat}/front_ends/fastapi/fastapi_front_end_plugin.py +10 -10
- {aiq → nat}/front_ends/fastapi/fastapi_front_end_plugin_worker.py +110 -115
- {aiq → nat}/front_ends/fastapi/intermediate_steps_subscriber.py +10 -10
- {aiq → nat}/front_ends/fastapi/main.py +8 -8
- {aiq → nat}/front_ends/fastapi/message_handler.py +58 -36
- {aiq → nat}/front_ends/fastapi/message_validator.py +55 -48
- {aiq → nat}/front_ends/fastapi/register.py +5 -5
- {aiq → nat}/front_ends/fastapi/response_helpers.py +26 -26
- {aiq → nat}/front_ends/fastapi/step_adaptor.py +35 -37
- {aiq → nat}/front_ends/mcp/mcp_front_end_config.py +12 -8
- nat/front_ends/mcp/mcp_front_end_plugin.py +81 -0
- nat/front_ends/mcp/mcp_front_end_plugin_worker.py +143 -0
- {aiq → nat}/front_ends/mcp/register.py +5 -5
- {aiq → nat}/front_ends/mcp/tool_converter.py +20 -21
- {aiq → nat}/front_ends/simple_base/simple_front_end_plugin_base.py +6 -6
- {aiq → nat}/llm/aws_bedrock_llm.py +5 -5
- {aiq → nat}/llm/nim_llm.py +5 -5
- {aiq → nat}/llm/openai_llm.py +5 -5
- {aiq → nat}/memory/__init__.py +2 -2
- nat/meta/pypi.md +58 -0
- {aiq → nat}/object_store/__init__.py +2 -2
- {aiq → nat}/object_store/in_memory_object_store.py +6 -6
- {aiq → nat}/observability/exporter/base_exporter.py +9 -9
- {aiq → nat}/observability/exporter/exporter.py +1 -1
- {aiq → nat}/observability/exporter/file_exporter.py +6 -6
- {aiq → nat}/observability/exporter/processing_exporter.py +9 -9
- {aiq → nat}/observability/exporter/raw_exporter.py +4 -4
- {aiq → nat}/observability/exporter/span_exporter.py +57 -34
- {aiq → nat}/observability/exporter_manager.py +6 -6
- {aiq → nat}/observability/mixin/file_mixin.py +2 -2
- {aiq → nat}/observability/processor/batching_processor.py +1 -1
- {aiq → nat}/observability/processor/callback_processor.py +1 -1
- {aiq → nat}/observability/processor/intermediate_step_serializer.py +4 -4
- {aiq → nat}/observability/processor/processor.py +1 -1
- {aiq → nat}/observability/register.py +7 -7
- {aiq → nat}/profiler/calc/calc_runner.py +18 -18
- {aiq → nat}/profiler/calc/calculations.py +3 -3
- {aiq → nat}/profiler/calc/plot.py +2 -2
- {aiq → nat}/profiler/callbacks/agno_callback_handler.py +14 -14
- {aiq → nat}/profiler/callbacks/langchain_callback_handler.py +11 -11
- {aiq → nat}/profiler/callbacks/llama_index_callback_handler.py +12 -12
- {aiq → nat}/profiler/callbacks/semantic_kernel_callback_handler.py +11 -11
- {aiq → nat}/profiler/data_models.py +2 -2
- {aiq → nat}/profiler/decorators/framework_wrapper.py +6 -6
- {aiq → nat}/profiler/decorators/function_tracking.py +10 -10
- {aiq → nat}/profiler/forecasting/model_trainer.py +5 -5
- {aiq → nat}/profiler/forecasting/models/linear_model.py +5 -4
- {aiq → nat}/profiler/forecasting/models/random_forest_regressor.py +5 -4
- {aiq → nat}/profiler/inference_optimization/bottleneck_analysis/nested_stack_analysis.py +7 -7
- {aiq → nat}/profiler/inference_optimization/bottleneck_analysis/simple_stack_analysis.py +4 -4
- {aiq → nat}/profiler/inference_optimization/experimental/concurrency_spike_analysis.py +6 -6
- {aiq → nat}/profiler/inference_optimization/experimental/prefix_span_analysis.py +6 -6
- {aiq → nat}/profiler/inference_optimization/llm_metrics.py +2 -2
- {aiq → nat}/profiler/inference_optimization/prompt_caching.py +5 -5
- {aiq → nat}/profiler/inference_optimization/token_uniqueness.py +4 -4
- {aiq → nat}/profiler/inference_optimization/workflow_runtimes.py +3 -3
- {aiq → nat}/profiler/intermediate_property_adapter.py +3 -3
- {aiq → nat}/profiler/profile_runner.py +17 -17
- {aiq → nat}/profiler/utils.py +4 -4
- {aiq → nat}/registry_handlers/local/local_handler.py +19 -19
- {aiq → nat}/registry_handlers/local/register_local.py +4 -4
- {aiq → nat}/registry_handlers/metadata_factory.py +7 -7
- {aiq → nat}/registry_handlers/package_utils.py +37 -33
- {aiq → nat}/registry_handlers/pypi/pypi_handler.py +21 -21
- {aiq → nat}/registry_handlers/pypi/register_pypi.py +6 -6
- {aiq → nat}/registry_handlers/registry_handler_base.py +21 -21
- {aiq → nat}/registry_handlers/rest/register_rest.py +7 -7
- {aiq → nat}/registry_handlers/rest/rest_handler.py +19 -19
- {aiq → nat}/registry_handlers/schemas/package.py +3 -3
- {aiq → nat}/registry_handlers/schemas/publish.py +17 -12
- {aiq → nat}/registry_handlers/schemas/pull.py +6 -6
- {aiq → nat}/registry_handlers/schemas/remove.py +2 -2
- {aiq → nat}/registry_handlers/schemas/search.py +11 -11
- {aiq → nat}/retriever/interface.py +6 -2
- {aiq → nat}/retriever/milvus/register.py +7 -7
- {aiq → nat}/retriever/milvus/retriever.py +8 -8
- {aiq → nat}/retriever/models.py +10 -7
- {aiq → nat}/retriever/nemo_retriever/register.py +6 -6
- {aiq → nat}/retriever/nemo_retriever/retriever.py +10 -10
- {aiq/embedder → nat/retriever}/register.py +2 -4
- {aiq → nat}/runtime/loader.py +38 -33
- {aiq → nat}/runtime/runner.py +30 -25
- {aiq → nat}/runtime/session.py +19 -15
- {aiq → nat}/runtime/user_metadata.py +1 -1
- {aiq → nat}/settings/global_settings.py +11 -11
- {aiq → nat}/tool/chat_completion.py +6 -6
- {aiq → nat}/tool/code_execution/README.md +2 -2
- {aiq → nat}/tool/code_execution/code_sandbox.py +1 -1
- {aiq → nat}/tool/code_execution/register.py +5 -5
- {aiq → nat}/tool/code_execution/test_code_execution_sandbox.py +1 -1
- {aiq → nat}/tool/datetime_tools.py +4 -4
- {aiq → nat}/tool/document_search.py +6 -6
- {aiq → nat}/tool/github_tools/create_github_commit.py +4 -4
- {aiq → nat}/tool/github_tools/create_github_issue.py +4 -4
- {aiq → nat}/tool/github_tools/create_github_pr.py +4 -4
- {aiq → nat}/tool/github_tools/get_github_file.py +4 -4
- {aiq → nat}/tool/github_tools/get_github_issue.py +4 -4
- {aiq → nat}/tool/github_tools/get_github_pr.py +4 -4
- {aiq → nat}/tool/github_tools/update_github_issue.py +4 -4
- {aiq → nat}/tool/mcp/exceptions.py +1 -1
- {aiq → nat}/tool/mcp/mcp_client.py +2 -2
- {aiq → nat}/tool/mcp/mcp_tool.py +7 -7
- {aiq → nat}/tool/memory_tools/add_memory_tool.py +6 -6
- {aiq → nat}/tool/memory_tools/delete_memory_tool.py +6 -6
- {aiq → nat}/tool/memory_tools/get_memory_tool.py +6 -6
- {aiq → nat}/tool/nvidia_rag.py +4 -4
- {aiq → nat}/tool/retriever.py +20 -15
- {aiq → nat}/tool/server_tools.py +16 -16
- {aiq → nat}/utils/dump_distro_mapping.py +2 -2
- {aiq → nat}/utils/exception_handlers/mcp.py +8 -8
- {aiq → nat}/utils/io/yaml_tools.py +1 -1
- {aiq → nat}/utils/metadata_utils.py +2 -2
- {aiq → nat}/utils/reactive/base/observable_base.py +2 -2
- {aiq → nat}/utils/reactive/base/subject_base.py +1 -1
- {aiq → nat}/utils/reactive/observable.py +5 -5
- {aiq → nat}/utils/reactive/observer.py +1 -1
- {aiq → nat}/utils/reactive/subject.py +4 -4
- {aiq → nat}/utils/reactive/subscription.py +1 -1
- {aiq → nat}/utils/settings/global_settings.py +4 -4
- {aiq → nat}/utils/type_converter.py +1 -1
- {nvidia_nat-1.2.0rc5.dist-info → nvidia_nat-1.2.0rc7.dist-info}/METADATA +37 -37
- nvidia_nat-1.2.0rc7.dist-info/RECORD +434 -0
- nvidia_nat-1.2.0rc7.dist-info/entry_points.txt +21 -0
- nvidia_nat-1.2.0rc7.dist-info/top_level.txt +1 -0
- aiq/embedder/langchain_client.py +0 -41
- aiq/front_ends/mcp/mcp_front_end_plugin.py +0 -93
- aiq/meta/module_to_distro.json +0 -3
- aiq/meta/pypi.md +0 -58
- nvidia_nat-1.2.0rc5.dist-info/RECORD +0 -435
- nvidia_nat-1.2.0rc5.dist-info/entry_points.txt +0 -20
- nvidia_nat-1.2.0rc5.dist-info/top_level.txt +0 -1
- {aiq → nat}/agent/__init__.py +0 -0
- {aiq → nat}/agent/base.py +0 -0
- {aiq → nat}/agent/dual_node.py +0 -0
- {aiq → nat}/agent/react_agent/__init__.py +0 -0
- {aiq → nat}/agent/react_agent/output_parser.py +0 -0
- {aiq → nat}/agent/react_agent/prompt.py +0 -0
- {aiq → nat}/agent/reasoning_agent/__init__.py +0 -0
- {aiq → nat}/agent/register.py +0 -0
- {aiq → nat}/agent/rewoo_agent/__init__.py +0 -0
- {aiq → nat}/agent/tool_calling_agent/__init__.py +0 -0
- {aiq → nat}/authentication/__init__.py +0 -0
- {aiq → nat}/authentication/api_key/__init__.py +0 -0
- {aiq → nat}/authentication/exceptions/__init__.py +0 -0
- {aiq → nat}/authentication/exceptions/api_key_exceptions.py +0 -0
- {aiq → nat}/authentication/http_basic_auth/__init__.py +0 -0
- {aiq → nat}/authentication/oauth2/__init__.py +0 -0
- {aiq → nat}/builder/__init__.py +0 -0
- {aiq → nat}/builder/framework_enum.py +0 -0
- {aiq → nat}/cli/__init__.py +0 -0
- {aiq → nat}/cli/cli_utils/__init__.py +0 -0
- {aiq → nat}/cli/commands/__init__.py +0 -0
- {aiq → nat}/cli/commands/configure/__init__.py +0 -0
- {aiq → nat}/cli/commands/configure/channel/__init__.py +0 -0
- {aiq → nat}/cli/commands/info/__init__.py +0 -0
- {aiq → nat}/cli/commands/registry/__init__.py +0 -0
- {aiq → nat}/cli/commands/sizing/__init__.py +0 -0
- {aiq → nat}/cli/commands/sizing/sizing.py +0 -0
- {aiq → nat}/cli/commands/workflow/__init__.py +0 -0
- {aiq → nat}/cli/commands/workflow/templates/__init__.py.j2 +0 -0
- {aiq → nat}/cli/commands/workflow/templates/config.yml.j2 +0 -0
- {aiq → nat}/cli/commands/workflow/templates/register.py.j2 +0 -0
- {aiq → nat}/data_models/__init__.py +0 -0
- {aiq → nat}/data_models/common.py +0 -0
- {aiq → nat}/data_models/embedder.py +0 -0
- {aiq → nat}/data_models/evaluator.py +0 -0
- {aiq → nat}/data_models/front_end.py +0 -0
- {aiq → nat}/data_models/function.py +0 -0
- {aiq → nat}/data_models/function_dependencies.py +0 -0
- {aiq → nat}/data_models/interactive.py +0 -0
- {aiq → nat}/data_models/invocation_node.py +0 -0
- {aiq → nat}/data_models/llm.py +0 -0
- {aiq → nat}/data_models/logging.py +0 -0
- {aiq → nat}/data_models/memory.py +0 -0
- {aiq → nat}/data_models/object_store.py +0 -0
- {aiq → nat}/data_models/profiler.py +0 -0
- {aiq → nat}/data_models/registry_handler.py +0 -0
- {aiq → nat}/data_models/retry_mixin.py +0 -0
- {aiq → nat}/data_models/streaming.py +0 -0
- {aiq → nat}/data_models/swe_bench_model.py +0 -0
- {aiq → nat}/data_models/ttc_strategy.py +0 -0
- {aiq → nat}/embedder/__init__.py +0 -0
- {aiq → nat}/eval/__init__.py +0 -0
- {aiq → nat}/eval/dataset_handler/__init__.py +0 -0
- {aiq → nat}/eval/evaluator/__init__.py +0 -0
- {aiq → nat}/eval/rag_evaluator/__init__.py +0 -0
- {aiq → nat}/eval/register.py +0 -0
- {aiq → nat}/eval/runners/__init__.py +0 -0
- {aiq → nat}/eval/swe_bench_evaluator/__init__.py +0 -0
- {aiq → nat}/eval/trajectory_evaluator/__init__.py +0 -0
- {aiq → nat}/eval/tunable_rag_evaluator/__init__.py +0 -0
- {aiq → nat}/eval/usage_stats.py +0 -0
- {aiq → nat}/eval/utils/__init__.py +0 -0
- {aiq → nat}/eval/utils/tqdm_position_registry.py +0 -0
- {aiq → nat}/experimental/__init__.py +0 -0
- {aiq → nat}/experimental/decorators/__init__.py +0 -0
- {aiq → nat}/experimental/test_time_compute/__init__.py +0 -0
- {aiq → nat}/experimental/test_time_compute/editing/__init__.py +0 -0
- {aiq → nat}/experimental/test_time_compute/functions/__init__.py +0 -0
- {aiq → nat}/experimental/test_time_compute/models/__init__.py +0 -0
- {aiq → nat}/experimental/test_time_compute/models/stage_enums.py +0 -0
- {aiq → nat}/experimental/test_time_compute/models/tool_use_config.py +0 -0
- {aiq → nat}/experimental/test_time_compute/models/ttc_item.py +0 -0
- {aiq → nat}/experimental/test_time_compute/scoring/__init__.py +0 -0
- {aiq → nat}/experimental/test_time_compute/search/__init__.py +0 -0
- {aiq → nat}/experimental/test_time_compute/selection/__init__.py +0 -0
- {aiq → nat}/front_ends/__init__.py +0 -0
- {aiq → nat}/front_ends/console/__init__.py +0 -0
- {aiq → nat}/front_ends/cron/__init__.py +0 -0
- {aiq → nat}/front_ends/fastapi/__init__.py +0 -0
- {aiq → nat}/front_ends/fastapi/auth_flow_handlers/__init__.py +0 -0
- {aiq → nat}/front_ends/fastapi/fastapi_front_end_controller.py +0 -0
- {aiq → nat}/front_ends/fastapi/html_snippets/__init__.py +0 -0
- {aiq → nat}/front_ends/fastapi/html_snippets/auth_code_grant_success.py +0 -0
- {aiq → nat}/front_ends/fastapi/job_store.py +0 -0
- {aiq → nat}/front_ends/mcp/__init__.py +0 -0
- {aiq → nat}/front_ends/register.py +0 -0
- {aiq → nat}/front_ends/simple_base/__init__.py +0 -0
- {aiq → nat}/llm/__init__.py +0 -0
- {aiq → nat}/llm/register.py +0 -0
- {aiq → nat}/llm/utils/__init__.py +0 -0
- {aiq → nat}/llm/utils/env_config_value.py +0 -0
- {aiq → nat}/llm/utils/error.py +0 -0
- {aiq → nat}/memory/interfaces.py +0 -0
- {aiq → nat}/memory/models.py +0 -0
- {aiq → nat}/object_store/interfaces.py +0 -0
- {aiq → nat}/object_store/models.py +0 -0
- {aiq → nat}/object_store/register.py +0 -0
- {aiq → nat}/observability/__init__.py +0 -0
- {aiq → nat}/observability/exporter/__init__.py +0 -0
- {aiq → nat}/observability/mixin/__init__.py +0 -0
- {aiq → nat}/observability/mixin/batch_config_mixin.py +0 -0
- {aiq → nat}/observability/mixin/collector_config_mixin.py +0 -0
- {aiq → nat}/observability/mixin/file_mode.py +0 -0
- {aiq → nat}/observability/mixin/resource_conflict_mixin.py +0 -0
- {aiq → nat}/observability/mixin/serialize_mixin.py +0 -0
- {aiq → nat}/observability/mixin/type_introspection_mixin.py +0 -0
- {aiq → nat}/observability/processor/__init__.py +0 -0
- {aiq → nat}/observability/utils/__init__.py +0 -0
- {aiq → nat}/observability/utils/dict_utils.py +0 -0
- {aiq → nat}/observability/utils/time_utils.py +0 -0
- {aiq → nat}/plugins/.namespace +0 -0
- {aiq → nat}/profiler/__init__.py +0 -0
- {aiq → nat}/profiler/calc/__init__.py +0 -0
- {aiq → nat}/profiler/calc/data_models.py +0 -0
- {aiq → nat}/profiler/callbacks/__init__.py +0 -0
- {aiq → nat}/profiler/callbacks/base_callback_class.py +0 -0
- {aiq → nat}/profiler/callbacks/token_usage_base_model.py +0 -0
- {aiq → nat}/profiler/data_frame_row.py +0 -0
- {aiq → nat}/profiler/decorators/__init__.py +0 -0
- {aiq → nat}/profiler/forecasting/__init__.py +0 -0
- {aiq → nat}/profiler/forecasting/config.py +0 -0
- {aiq → nat}/profiler/forecasting/models/__init__.py +0 -0
- {aiq → nat}/profiler/forecasting/models/forecasting_base_model.py +0 -0
- {aiq → nat}/profiler/inference_metrics_model.py +0 -0
- {aiq → nat}/profiler/inference_optimization/__init__.py +0 -0
- {aiq → nat}/profiler/inference_optimization/bottleneck_analysis/__init__.py +0 -0
- {aiq → nat}/profiler/inference_optimization/data_models.py +0 -0
- {aiq → nat}/profiler/inference_optimization/experimental/__init__.py +0 -0
- {aiq → nat}/registry_handlers/__init__.py +0 -0
- {aiq → nat}/registry_handlers/local/__init__.py +0 -0
- {aiq → nat}/registry_handlers/pypi/__init__.py +0 -0
- {aiq → nat}/registry_handlers/register.py +0 -0
- {aiq → nat}/registry_handlers/rest/__init__.py +0 -0
- {aiq → nat}/registry_handlers/schemas/__init__.py +0 -0
- {aiq → nat}/registry_handlers/schemas/headers.py +0 -0
- {aiq → nat}/registry_handlers/schemas/status.py +0 -0
- {aiq → nat}/retriever/__init__.py +0 -0
- {aiq → nat}/retriever/milvus/__init__.py +0 -0
- {aiq → nat}/retriever/nemo_retriever/__init__.py +0 -0
- {aiq → nat}/runtime/__init__.py +0 -0
- {aiq → nat}/settings/__init__.py +0 -0
- {aiq → nat}/test/.namespace +0 -0
- {aiq → nat}/tool/__init__.py +0 -0
- {aiq → nat}/tool/code_execution/__init__.py +0 -0
- {aiq → nat}/tool/code_execution/local_sandbox/.gitignore +0 -0
- {aiq → nat}/tool/code_execution/local_sandbox/Dockerfile.sandbox +0 -0
- {aiq → nat}/tool/code_execution/local_sandbox/__init__.py +0 -0
- {aiq → nat}/tool/code_execution/local_sandbox/local_sandbox_server.py +0 -0
- {aiq → nat}/tool/code_execution/local_sandbox/sandbox.requirements.txt +0 -0
- {aiq → nat}/tool/code_execution/local_sandbox/start_local_sandbox.sh +0 -0
- {aiq → nat}/tool/code_execution/utils.py +0 -0
- {aiq → nat}/tool/github_tools/__init__.py +0 -0
- {aiq → nat}/tool/mcp/__init__.py +0 -0
- {aiq → nat}/tool/memory_tools/__init__.py +0 -0
- {aiq → nat}/tool/register.py +0 -0
- {aiq → nat}/utils/__init__.py +0 -0
- {aiq → nat}/utils/data_models/__init__.py +0 -0
- {aiq → nat}/utils/data_models/schema_validator.py +0 -0
- {aiq → nat}/utils/debugging_utils.py +0 -0
- {aiq → nat}/utils/exception_handlers/__init__.py +0 -0
- {aiq → nat}/utils/exception_handlers/automatic_retries.py +0 -0
- {aiq → nat}/utils/exception_handlers/schemas.py +0 -0
- {aiq → nat}/utils/io/__init__.py +0 -0
- {aiq → nat}/utils/io/model_processing.py +0 -0
- {aiq → nat}/utils/log_utils.py +0 -0
- {aiq → nat}/utils/optional_imports.py +0 -0
- {aiq → nat}/utils/producer_consumer_queue.py +0 -0
- {aiq → nat}/utils/reactive/__init__.py +0 -0
- {aiq → nat}/utils/reactive/base/__init__.py +0 -0
- {aiq → nat}/utils/reactive/base/observer_base.py +0 -0
- {aiq → nat}/utils/settings/__init__.py +0 -0
- {aiq → nat}/utils/string_utils.py +0 -0
- {aiq → nat}/utils/type_utils.py +0 -0
- {aiq → nat}/utils/url_utils.py +0 -0
- {nvidia_nat-1.2.0rc5.dist-info → nvidia_nat-1.2.0rc7.dist-info}/WHEEL +0 -0
- {nvidia_nat-1.2.0rc5.dist-info → nvidia_nat-1.2.0rc7.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
- {nvidia_nat-1.2.0rc5.dist-info → nvidia_nat-1.2.0rc7.dist-info}/licenses/LICENSE.md +0 -0
|
@@ -33,18 +33,18 @@ from langchain_core.tools import BaseTool
|
|
|
33
33
|
from pydantic import BaseModel
|
|
34
34
|
from pydantic import Field
|
|
35
35
|
|
|
36
|
-
from
|
|
37
|
-
from
|
|
38
|
-
from
|
|
39
|
-
from
|
|
40
|
-
from
|
|
41
|
-
from
|
|
42
|
-
from
|
|
43
|
-
from
|
|
44
|
-
from
|
|
45
|
-
from
|
|
46
|
-
from
|
|
47
|
-
from
|
|
36
|
+
from nat.agent.base import AGENT_CALL_LOG_MESSAGE
|
|
37
|
+
from nat.agent.base import AGENT_LOG_PREFIX
|
|
38
|
+
from nat.agent.base import INPUT_SCHEMA_MESSAGE
|
|
39
|
+
from nat.agent.base import NO_INPUT_ERROR_MESSAGE
|
|
40
|
+
from nat.agent.base import TOOL_NOT_FOUND_ERROR_MESSAGE
|
|
41
|
+
from nat.agent.base import AgentDecision
|
|
42
|
+
from nat.agent.dual_node import DualNodeAgent
|
|
43
|
+
from nat.agent.react_agent.output_parser import ReActOutputParser
|
|
44
|
+
from nat.agent.react_agent.output_parser import ReActOutputParserException
|
|
45
|
+
from nat.agent.react_agent.prompt import SYSTEM_PROMPT
|
|
46
|
+
from nat.agent.react_agent.prompt import USER_PROMPT
|
|
47
|
+
from nat.agent.react_agent.register import ReActAgentWorkflowConfig
|
|
48
48
|
|
|
49
49
|
logger = logging.getLogger(__name__)
|
|
50
50
|
|
|
@@ -18,23 +18,23 @@ import logging
|
|
|
18
18
|
from pydantic import AliasChoices
|
|
19
19
|
from pydantic import Field
|
|
20
20
|
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
26
|
-
from
|
|
27
|
-
from
|
|
28
|
-
from
|
|
29
|
-
from
|
|
30
|
-
from
|
|
21
|
+
from nat.builder.builder import Builder
|
|
22
|
+
from nat.builder.framework_enum import LLMFrameworkEnum
|
|
23
|
+
from nat.builder.function_info import FunctionInfo
|
|
24
|
+
from nat.cli.register_workflow import register_function
|
|
25
|
+
from nat.data_models.api_server import ChatRequest
|
|
26
|
+
from nat.data_models.api_server import ChatResponse
|
|
27
|
+
from nat.data_models.component_ref import FunctionRef
|
|
28
|
+
from nat.data_models.component_ref import LLMRef
|
|
29
|
+
from nat.data_models.function import FunctionBaseConfig
|
|
30
|
+
from nat.utils.type_converter import GlobalTypeConverter
|
|
31
31
|
|
|
32
32
|
logger = logging.getLogger(__name__)
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
class ReActAgentWorkflowConfig(FunctionBaseConfig, name="react_agent"):
|
|
36
36
|
"""
|
|
37
|
-
Defines
|
|
37
|
+
Defines a NAT function that uses a ReAct Agent performs reasoning inbetween tool calls, and utilizes the
|
|
38
38
|
tool names and descriptions to select the optimal tool.
|
|
39
39
|
"""
|
|
40
40
|
|
|
@@ -78,10 +78,10 @@ async def react_agent_workflow(config: ReActAgentWorkflowConfig, builder: Builde
|
|
|
78
78
|
from langchain_core.messages import trim_messages
|
|
79
79
|
from langgraph.graph.graph import CompiledGraph
|
|
80
80
|
|
|
81
|
-
from
|
|
82
|
-
from
|
|
83
|
-
from
|
|
84
|
-
from
|
|
81
|
+
from nat.agent.base import AGENT_LOG_PREFIX
|
|
82
|
+
from nat.agent.react_agent.agent import ReActAgentGraph
|
|
83
|
+
from nat.agent.react_agent.agent import ReActGraphState
|
|
84
|
+
from nat.agent.react_agent.agent import create_react_agent_prompt
|
|
85
85
|
|
|
86
86
|
prompt = create_react_agent_prompt(config)
|
|
87
87
|
|
|
@@ -105,7 +105,7 @@ async def react_agent_workflow(config: ReActAgentWorkflowConfig, builder: Builde
|
|
|
105
105
|
tool_call_max_retries=config.tool_call_max_retries,
|
|
106
106
|
pass_tool_call_errors_to_agent=config.pass_tool_call_errors_to_agent).build_graph()
|
|
107
107
|
|
|
108
|
-
async def _response_fn(input_message:
|
|
108
|
+
async def _response_fn(input_message: ChatRequest) -> ChatResponse:
|
|
109
109
|
try:
|
|
110
110
|
# initialize the starting state with the user query
|
|
111
111
|
messages: list[BaseMessage] = trim_messages(messages=[m.model_dump() for m in input_message.messages],
|
|
@@ -126,21 +126,21 @@ async def react_agent_workflow(config: ReActAgentWorkflowConfig, builder: Builde
|
|
|
126
126
|
# get and return the output from the state
|
|
127
127
|
state = ReActGraphState(**state)
|
|
128
128
|
output_message = state.messages[-1] # pylint: disable=E1136
|
|
129
|
-
return
|
|
129
|
+
return ChatResponse.from_string(str(output_message.content))
|
|
130
130
|
|
|
131
131
|
except Exception as ex:
|
|
132
132
|
logger.exception("%s ReAct Agent failed with exception: %s", AGENT_LOG_PREFIX, ex, exc_info=ex)
|
|
133
133
|
# here, we can implement custom error messages
|
|
134
134
|
if config.verbose:
|
|
135
|
-
return
|
|
136
|
-
return
|
|
135
|
+
return ChatResponse.from_string(str(ex))
|
|
136
|
+
return ChatResponse.from_string("I seem to be having a problem.")
|
|
137
137
|
|
|
138
138
|
if (config.use_openai_api):
|
|
139
139
|
yield FunctionInfo.from_fn(_response_fn, description=config.description)
|
|
140
140
|
else:
|
|
141
141
|
|
|
142
142
|
async def _str_api_fn(input_message: str) -> str:
|
|
143
|
-
oai_input = GlobalTypeConverter.get().try_convert(input_message, to_type=
|
|
143
|
+
oai_input = GlobalTypeConverter.get().try_convert(input_message, to_type=ChatRequest)
|
|
144
144
|
|
|
145
145
|
oai_output = await _response_fn(oai_input)
|
|
146
146
|
|
|
@@ -19,21 +19,21 @@ from collections.abc import AsyncGenerator
|
|
|
19
19
|
|
|
20
20
|
from pydantic import Field
|
|
21
21
|
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
26
|
-
from
|
|
27
|
-
from
|
|
28
|
-
from
|
|
29
|
-
from
|
|
22
|
+
from nat.builder.builder import Builder
|
|
23
|
+
from nat.builder.framework_enum import LLMFrameworkEnum
|
|
24
|
+
from nat.builder.function_info import FunctionInfo
|
|
25
|
+
from nat.cli.register_workflow import register_function
|
|
26
|
+
from nat.data_models.api_server import ChatRequest
|
|
27
|
+
from nat.data_models.component_ref import FunctionRef
|
|
28
|
+
from nat.data_models.component_ref import LLMRef
|
|
29
|
+
from nat.data_models.function import FunctionBaseConfig
|
|
30
30
|
|
|
31
31
|
logger = logging.getLogger(__name__)
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
class ReasoningFunctionConfig(FunctionBaseConfig, name="reasoning_agent"):
|
|
35
35
|
"""
|
|
36
|
-
Defines
|
|
36
|
+
Defines a NAT function that performs reasoning on the input data.
|
|
37
37
|
Output is passed to the next function in the workflow.
|
|
38
38
|
|
|
39
39
|
Designed to be used with an InterceptingFunction.
|
|
@@ -85,7 +85,7 @@ async def build_reasoning_function(config: ReasoningFunctionConfig, builder: Bui
|
|
|
85
85
|
from langchain_core.language_models import BaseChatModel
|
|
86
86
|
from langchain_core.prompts import PromptTemplate
|
|
87
87
|
|
|
88
|
-
from
|
|
88
|
+
from nat.agent.base import AGENT_LOG_PREFIX
|
|
89
89
|
|
|
90
90
|
def remove_r1_think_tags(text: str):
|
|
91
91
|
pattern = r'(<think>)?.*?</think>\s*(.*)'
|
|
@@ -135,12 +135,12 @@ async def build_reasoning_function(config: ReasoningFunctionConfig, builder: Bui
|
|
|
135
135
|
if augmented_function.has_streaming_output:
|
|
136
136
|
|
|
137
137
|
async def streaming_inner(
|
|
138
|
-
input_message:
|
|
138
|
+
input_message: ChatRequest) -> AsyncGenerator[augmented_function.streaming_output_type]:
|
|
139
139
|
"""
|
|
140
140
|
Perform reasoning on the input text.
|
|
141
141
|
|
|
142
142
|
Args:
|
|
143
|
-
input_message (
|
|
143
|
+
input_message (ChatRequest): The input text to reason on.
|
|
144
144
|
"""
|
|
145
145
|
|
|
146
146
|
input_text = "".join([str(message.model_dump()) + "\n" for message in input_message.messages])
|
|
@@ -178,12 +178,12 @@ async def build_reasoning_function(config: ReasoningFunctionConfig, builder: Bui
|
|
|
178
178
|
|
|
179
179
|
if augmented_function.has_single_output:
|
|
180
180
|
|
|
181
|
-
async def single_inner(input_message:
|
|
181
|
+
async def single_inner(input_message: ChatRequest) -> augmented_function.single_output_type:
|
|
182
182
|
"""
|
|
183
183
|
Perform reasoning on the input text.
|
|
184
184
|
|
|
185
185
|
Args:
|
|
186
|
-
input_message (
|
|
186
|
+
input_message (ChatRequest): The input text to reason on.
|
|
187
187
|
"""
|
|
188
188
|
|
|
189
189
|
input_text = "".join([str(message.model_dump()) + "\n" for message in input_message.messages])
|
|
@@ -30,13 +30,13 @@ from langgraph.graph import StateGraph
|
|
|
30
30
|
from pydantic import BaseModel
|
|
31
31
|
from pydantic import Field
|
|
32
32
|
|
|
33
|
-
from
|
|
34
|
-
from
|
|
35
|
-
from
|
|
36
|
-
from
|
|
37
|
-
from
|
|
38
|
-
from
|
|
39
|
-
from
|
|
33
|
+
from nat.agent.base import AGENT_CALL_LOG_MESSAGE
|
|
34
|
+
from nat.agent.base import AGENT_LOG_PREFIX
|
|
35
|
+
from nat.agent.base import INPUT_SCHEMA_MESSAGE
|
|
36
|
+
from nat.agent.base import NO_INPUT_ERROR_MESSAGE
|
|
37
|
+
from nat.agent.base import TOOL_NOT_FOUND_ERROR_MESSAGE
|
|
38
|
+
from nat.agent.base import AgentDecision
|
|
39
|
+
from nat.agent.base import BaseAgent
|
|
40
40
|
|
|
41
41
|
logger = logging.getLogger(__name__)
|
|
42
42
|
|
|
@@ -13,9 +13,6 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
-
# flake8: noqa
|
|
17
|
-
from langchain_core.prompts.chat import ChatPromptTemplate
|
|
18
|
-
|
|
19
16
|
PLANNER_SYSTEM_PROMPT = """
|
|
20
17
|
For the following task, make plans that can solve the problem step by step. For each plan, indicate \
|
|
21
18
|
which external tool together with tool input to retrieve evidence. You can store the evidence into a \
|
|
@@ -29,19 +26,25 @@ The tools should be one of the following: [{tool_names}]
|
|
|
29
26
|
|
|
30
27
|
You are not required to use all the tools listed. Choose only the ones that best fit the needs of each plan step.
|
|
31
28
|
|
|
32
|
-
Your output must be a JSON array where each element represents one planning step. Each step must be an object with
|
|
29
|
+
Your output must be a JSON array where each element represents one planning step. Each step must be an object with
|
|
30
|
+
|
|
31
|
+
exactly two keys:
|
|
33
32
|
|
|
34
33
|
1. "plan": A string that describes in detail the action or reasoning for that step.
|
|
35
34
|
|
|
36
|
-
2. "evidence": An object representing the external tool call associated with that plan step. This object must have the
|
|
35
|
+
2. "evidence": An object representing the external tool call associated with that plan step. This object must have the
|
|
36
|
+
following keys:
|
|
37
37
|
|
|
38
|
-
-"placeholder": A string that identifies the evidence placeholder (e.g., "#E1", "#E2", etc.). The numbering should
|
|
38
|
+
-"placeholder": A string that identifies the evidence placeholder (e.g., "#E1", "#E2", etc.). The numbering should
|
|
39
|
+
be sequential based on the order of steps.
|
|
39
40
|
|
|
40
41
|
-"tool": A string specifying the name of the external tool used.
|
|
41
42
|
|
|
42
|
-
-"tool_input": The input to the tool. This can be a string, array, or object, depending on the requirements of the
|
|
43
|
+
-"tool_input": The input to the tool. This can be a string, array, or object, depending on the requirements of the
|
|
44
|
+
tool.
|
|
43
45
|
|
|
44
|
-
Do not include any additional keys or characters in your output, and do not wrap your response with markdown formatting.
|
|
46
|
+
Do not include any additional keys or characters in your output, and do not wrap your response with markdown formatting.
|
|
47
|
+
Your output must be strictly valid JSON.
|
|
45
48
|
|
|
46
49
|
Important instructions:
|
|
47
50
|
|
|
@@ -87,8 +90,6 @@ PLANNER_USER_PROMPT = """
|
|
|
87
90
|
task: {task}
|
|
88
91
|
"""
|
|
89
92
|
|
|
90
|
-
rewoo_planner_prompt = ChatPromptTemplate([("system", PLANNER_SYSTEM_PROMPT), ("user", PLANNER_USER_PROMPT)])
|
|
91
|
-
|
|
92
93
|
SOLVER_SYSTEM_PROMPT = """
|
|
93
94
|
Solve the following task or problem. To solve the problem, we have made step-by-step Plan and \
|
|
94
95
|
retrieved corresponding Evidence to each Plan. Use them with caution since long evidence might \
|
|
@@ -104,5 +105,3 @@ task: {task}
|
|
|
104
105
|
|
|
105
106
|
Response:
|
|
106
107
|
"""
|
|
107
|
-
|
|
108
|
-
rewoo_solver_prompt = ChatPromptTemplate([("system", SOLVER_SYSTEM_PROMPT), ("user", SOLVER_USER_PROMPT)])
|
|
@@ -15,25 +15,26 @@
|
|
|
15
15
|
|
|
16
16
|
import logging
|
|
17
17
|
|
|
18
|
+
from pydantic import AliasChoices
|
|
18
19
|
from pydantic import Field
|
|
19
20
|
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
26
|
-
from
|
|
27
|
-
from
|
|
28
|
-
from
|
|
29
|
-
from
|
|
21
|
+
from nat.builder.builder import Builder
|
|
22
|
+
from nat.builder.framework_enum import LLMFrameworkEnum
|
|
23
|
+
from nat.builder.function_info import FunctionInfo
|
|
24
|
+
from nat.cli.register_workflow import register_function
|
|
25
|
+
from nat.data_models.api_server import ChatRequest
|
|
26
|
+
from nat.data_models.api_server import ChatResponse
|
|
27
|
+
from nat.data_models.component_ref import FunctionRef
|
|
28
|
+
from nat.data_models.component_ref import LLMRef
|
|
29
|
+
from nat.data_models.function import FunctionBaseConfig
|
|
30
|
+
from nat.utils.type_converter import GlobalTypeConverter
|
|
30
31
|
|
|
31
32
|
logger = logging.getLogger(__name__)
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
class ReWOOAgentWorkflowConfig(FunctionBaseConfig, name="rewoo_agent"):
|
|
35
36
|
"""
|
|
36
|
-
Defines
|
|
37
|
+
Defines a NAT function that uses a ReWOO Agent performs reasoning inbetween tool calls, and utilizes the
|
|
37
38
|
tool names and descriptions to select the optimal tool.
|
|
38
39
|
"""
|
|
39
40
|
|
|
@@ -54,51 +55,48 @@ class ReWOOAgentWorkflowConfig(FunctionBaseConfig, name="rewoo_agent"):
|
|
|
54
55
|
use_openai_api: bool = Field(default=False,
|
|
55
56
|
description=("Use OpenAI API for the input/output types to the function. "
|
|
56
57
|
"If False, strings will be used."))
|
|
57
|
-
|
|
58
|
-
default=None,
|
|
58
|
+
additional_planner_instructions: str | None = Field(
|
|
59
|
+
default=None,
|
|
60
|
+
validation_alias=AliasChoices("additional_planner_instructions", "additional_instructions"),
|
|
61
|
+
description="Additional instructions to provide to the agent in addition to the base planner prompt.")
|
|
62
|
+
additional_solver_instructions: str | None = Field(
|
|
63
|
+
default=None,
|
|
64
|
+
description="Additional instructions to provide to the agent in addition to the base solver prompt.")
|
|
59
65
|
|
|
60
66
|
|
|
61
67
|
@register_function(config_type=ReWOOAgentWorkflowConfig, framework_wrappers=[LLMFrameworkEnum.LANGCHAIN])
|
|
62
|
-
async def
|
|
68
|
+
async def rewoo_agent_workflow(config: ReWOOAgentWorkflowConfig, builder: Builder):
|
|
63
69
|
from langchain.schema import BaseMessage
|
|
64
70
|
from langchain_core.messages import trim_messages
|
|
65
71
|
from langchain_core.messages.human import HumanMessage
|
|
66
72
|
from langchain_core.prompts import ChatPromptTemplate
|
|
67
73
|
from langgraph.graph.graph import CompiledGraph
|
|
68
74
|
|
|
69
|
-
from
|
|
70
|
-
from
|
|
75
|
+
from nat.agent.rewoo_agent.prompt import PLANNER_SYSTEM_PROMPT
|
|
76
|
+
from nat.agent.rewoo_agent.prompt import PLANNER_USER_PROMPT
|
|
77
|
+
from nat.agent.rewoo_agent.prompt import SOLVER_SYSTEM_PROMPT
|
|
78
|
+
from nat.agent.rewoo_agent.prompt import SOLVER_USER_PROMPT
|
|
71
79
|
|
|
72
80
|
from .agent import ReWOOAgentGraph
|
|
73
81
|
from .agent import ReWOOGraphState
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
solver_prompt = config.solver_prompt
|
|
93
|
-
if config.additional_instructions:
|
|
94
|
-
solver_prompt += f"{config.additional_instructions}"
|
|
95
|
-
valid = ReWOOAgentGraph.validate_solver_prompt(config.solver_prompt)
|
|
96
|
-
if not valid:
|
|
97
|
-
logger.exception("Invalid solver_prompt")
|
|
98
|
-
raise ValueError("Invalid solver_prompt")
|
|
99
|
-
solver_prompt = ChatPromptTemplate([("system", config.solver_prompt), ("user", SOLVER_USER_PROMPT)])
|
|
100
|
-
else:
|
|
101
|
-
solver_prompt = rewoo_solver_prompt
|
|
82
|
+
|
|
83
|
+
# the ReWOO Agent prompts are defined in prompt.py, and can be customized there or by modifying the config option
|
|
84
|
+
# planner_prompt and solver_prompt.
|
|
85
|
+
planner_system_prompt = PLANNER_SYSTEM_PROMPT if config.planner_prompt is None else config.planner_prompt
|
|
86
|
+
if config.additional_planner_instructions:
|
|
87
|
+
planner_system_prompt += f"{config.additional_planner_instructions}"
|
|
88
|
+
if not ReWOOAgentGraph.validate_planner_prompt(planner_system_prompt):
|
|
89
|
+
logger.exception("Invalid planner prompt")
|
|
90
|
+
raise ValueError("Invalid planner prompt")
|
|
91
|
+
planner_prompt = ChatPromptTemplate([("system", planner_system_prompt), ("user", PLANNER_USER_PROMPT)])
|
|
92
|
+
|
|
93
|
+
solver_system_prompt = SOLVER_SYSTEM_PROMPT if config.solver_prompt is None else config.solver_prompt
|
|
94
|
+
if config.additional_solver_instructions:
|
|
95
|
+
solver_system_prompt += f"{config.additional_solver_instructions}"
|
|
96
|
+
if not ReWOOAgentGraph.validate_solver_prompt(solver_system_prompt):
|
|
97
|
+
logger.exception("Invalid solver prompt")
|
|
98
|
+
raise ValueError("Invalid solver prompt")
|
|
99
|
+
solver_prompt = ChatPromptTemplate([("system", solver_system_prompt), ("user", SOLVER_USER_PROMPT)])
|
|
102
100
|
|
|
103
101
|
# we can choose an LLM for the ReWOO agent in the config file
|
|
104
102
|
llm = await builder.get_llm(config.llm_name, wrapper_type=LLMFrameworkEnum.LANGCHAIN)
|
|
@@ -117,7 +115,7 @@ async def ReWOO_agent_workflow(config: ReWOOAgentWorkflowConfig, builder: Builde
|
|
|
117
115
|
use_tool_schema=config.include_tool_input_schema_in_tool_description,
|
|
118
116
|
detailed_logs=config.verbose).build_graph()
|
|
119
117
|
|
|
120
|
-
async def _response_fn(input_message:
|
|
118
|
+
async def _response_fn(input_message: ChatRequest) -> ChatResponse:
|
|
121
119
|
try:
|
|
122
120
|
# initialize the starting state with the user query
|
|
123
121
|
messages: list[BaseMessage] = trim_messages(messages=[m.model_dump() for m in input_message.messages],
|
|
@@ -135,14 +133,14 @@ async def ReWOO_agent_workflow(config: ReWOOAgentWorkflowConfig, builder: Builde
|
|
|
135
133
|
# get and return the output from the state
|
|
136
134
|
state = ReWOOGraphState(**state)
|
|
137
135
|
output_message = state.result.content # pylint: disable=E1101
|
|
138
|
-
return
|
|
136
|
+
return ChatResponse.from_string(output_message)
|
|
139
137
|
|
|
140
138
|
except Exception as ex:
|
|
141
139
|
logger.exception("ReWOO Agent failed with exception: %s", ex, exc_info=ex)
|
|
142
140
|
# here, we can implement custom error messages
|
|
143
141
|
if config.verbose:
|
|
144
|
-
return
|
|
145
|
-
return
|
|
142
|
+
return ChatResponse.from_string(str(ex))
|
|
143
|
+
return ChatResponse.from_string("I seem to be having a problem.")
|
|
146
144
|
|
|
147
145
|
if (config.use_openai_api):
|
|
148
146
|
yield FunctionInfo.from_fn(_response_fn, description=config.description)
|
|
@@ -150,7 +148,7 @@ async def ReWOO_agent_workflow(config: ReWOOAgentWorkflowConfig, builder: Builde
|
|
|
150
148
|
else:
|
|
151
149
|
|
|
152
150
|
async def _str_api_fn(input_message: str) -> str:
|
|
153
|
-
oai_input = GlobalTypeConverter.get().try_convert(input_message, to_type=
|
|
151
|
+
oai_input = GlobalTypeConverter.get().try_convert(input_message, to_type=ChatRequest)
|
|
154
152
|
oai_output = await _response_fn(oai_input)
|
|
155
153
|
|
|
156
154
|
return GlobalTypeConverter.get().try_convert(oai_output, to_type=str)
|
|
@@ -25,10 +25,10 @@ from langgraph.prebuilt import ToolNode
|
|
|
25
25
|
from pydantic import BaseModel
|
|
26
26
|
from pydantic import Field
|
|
27
27
|
|
|
28
|
-
from
|
|
29
|
-
from
|
|
30
|
-
from
|
|
31
|
-
from
|
|
28
|
+
from nat.agent.base import AGENT_CALL_LOG_MESSAGE
|
|
29
|
+
from nat.agent.base import AGENT_LOG_PREFIX
|
|
30
|
+
from nat.agent.base import AgentDecision
|
|
31
|
+
from nat.agent.dual_node import DualNodeAgent
|
|
32
32
|
|
|
33
33
|
logger = logging.getLogger(__name__)
|
|
34
34
|
|
|
@@ -17,13 +17,13 @@ import logging
|
|
|
17
17
|
|
|
18
18
|
from pydantic import Field
|
|
19
19
|
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
26
|
-
from
|
|
20
|
+
from nat.builder.builder import Builder
|
|
21
|
+
from nat.builder.framework_enum import LLMFrameworkEnum
|
|
22
|
+
from nat.builder.function_info import FunctionInfo
|
|
23
|
+
from nat.cli.register_workflow import register_function
|
|
24
|
+
from nat.data_models.component_ref import FunctionRef
|
|
25
|
+
from nat.data_models.component_ref import LLMRef
|
|
26
|
+
from nat.data_models.function import FunctionBaseConfig
|
|
27
27
|
|
|
28
28
|
logger = logging.getLogger(__name__)
|
|
29
29
|
|
|
@@ -48,7 +48,7 @@ async def tool_calling_agent_workflow(config: ToolCallAgentWorkflowConfig, build
|
|
|
48
48
|
from langchain_core.messages.human import HumanMessage
|
|
49
49
|
from langgraph.graph.graph import CompiledGraph
|
|
50
50
|
|
|
51
|
-
from
|
|
51
|
+
from nat.agent.base import AGENT_LOG_PREFIX
|
|
52
52
|
|
|
53
53
|
from .agent import ToolCallAgentGraph
|
|
54
54
|
from .agent import ToolCallAgentGraphState
|
|
@@ -17,11 +17,11 @@ import logging
|
|
|
17
17
|
|
|
18
18
|
from pydantic import SecretStr
|
|
19
19
|
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
20
|
+
from nat.authentication.api_key.api_key_auth_provider_config import APIKeyAuthProviderConfig
|
|
21
|
+
from nat.authentication.interfaces import AuthProviderBase
|
|
22
|
+
from nat.data_models.authentication import AuthResult
|
|
23
|
+
from nat.data_models.authentication import BearerTokenCred
|
|
24
|
+
from nat.data_models.authentication import HeaderAuthScheme
|
|
25
25
|
|
|
26
26
|
logger = logging.getLogger(__name__)
|
|
27
27
|
|
|
@@ -51,7 +51,7 @@ class APIKeyAuthProvider(AuthProviderBase[APIKeyAuthProviderConfig]):
|
|
|
51
51
|
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
|
-
from
|
|
54
|
+
from nat.authentication.interfaces import AUTHORIZATION_HEADER
|
|
55
55
|
|
|
56
56
|
config: APIKeyAuthProviderConfig = self.config
|
|
57
57
|
|
|
@@ -20,11 +20,11 @@ import string
|
|
|
20
20
|
from pydantic import Field
|
|
21
21
|
from pydantic import field_validator
|
|
22
22
|
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
26
|
-
from
|
|
27
|
-
from
|
|
23
|
+
from nat.authentication.exceptions.api_key_exceptions import APIKeyFieldError
|
|
24
|
+
from nat.authentication.exceptions.api_key_exceptions import HeaderNameFieldError
|
|
25
|
+
from nat.authentication.exceptions.api_key_exceptions import HeaderPrefixFieldError
|
|
26
|
+
from nat.data_models.authentication import AuthProviderBaseConfig
|
|
27
|
+
from nat.data_models.authentication import HeaderAuthScheme
|
|
28
28
|
|
|
29
29
|
logger = logging.getLogger(__name__)
|
|
30
30
|
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
16
|
+
from nat.authentication.api_key.api_key_auth_provider_config import APIKeyAuthProviderConfig
|
|
17
|
+
from nat.builder.builder import Builder
|
|
18
|
+
from nat.cli.register_workflow import register_auth_provider
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
@register_auth_provider(config_type=APIKeyAuthProviderConfig)
|
|
22
22
|
async def api_key_client(config: APIKeyAuthProviderConfig, builder: Builder):
|
|
23
23
|
|
|
24
|
-
from
|
|
24
|
+
from nat.authentication.api_key.api_key_auth_provider import APIKeyAuthProvider
|
|
25
25
|
|
|
26
26
|
yield APIKeyAuthProvider(config=config)
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
|
|
16
16
|
from pydantic import SecretStr
|
|
17
17
|
|
|
18
|
-
from
|
|
19
|
-
from
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
18
|
+
from nat.authentication.interfaces import AuthProviderBase
|
|
19
|
+
from nat.builder.context import Context
|
|
20
|
+
from nat.data_models.authentication import AuthenticatedContext
|
|
21
|
+
from nat.data_models.authentication import AuthFlowType
|
|
22
|
+
from nat.data_models.authentication import AuthProviderBaseConfig
|
|
23
|
+
from nat.data_models.authentication import AuthResult
|
|
24
|
+
from nat.data_models.authentication import BasicAuthCred
|
|
25
|
+
from nat.data_models.authentication import BearerTokenCred
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
class HTTPBasicAuthProvider(AuthProviderBase):
|
|
@@ -43,11 +43,11 @@ class HTTPBasicAuthProvider(AuthProviderBase):
|
|
|
43
43
|
Performs simple HTTP Authentication using the provided user ID.
|
|
44
44
|
"""
|
|
45
45
|
|
|
46
|
-
context =
|
|
46
|
+
context = Context.get()
|
|
47
47
|
|
|
48
48
|
if user_id is None and hasattr(context, "metadata") and hasattr(
|
|
49
49
|
context.metadata, "cookies") and context.metadata.cookies is not None:
|
|
50
|
-
session_id = context.metadata.cookies.get("
|
|
50
|
+
session_id = context.metadata.cookies.get("nat-session", None)
|
|
51
51
|
if not session_id:
|
|
52
52
|
raise RuntimeError("Authentication failed. No session ID found. Cannot identify user.")
|
|
53
53
|
|
|
@@ -13,9 +13,9 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
-
from
|
|
17
|
-
from
|
|
18
|
-
from
|
|
16
|
+
from nat.builder.builder import Builder
|
|
17
|
+
from nat.cli.register_workflow import register_auth_provider
|
|
18
|
+
from nat.data_models.authentication import AuthProviderBaseConfig
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
class HTTPBasicAuthProviderConfig(AuthProviderBaseConfig, name="http_basic"):
|
|
@@ -25,6 +25,6 @@ class HTTPBasicAuthProviderConfig(AuthProviderBaseConfig, name="http_basic"):
|
|
|
25
25
|
@register_auth_provider(config_type=HTTPBasicAuthProviderConfig)
|
|
26
26
|
async def http_basic_auth_provider(config: HTTPBasicAuthProviderConfig, builder: Builder):
|
|
27
27
|
|
|
28
|
-
from
|
|
28
|
+
from nat.authentication.http_basic_auth.http_basic_auth_provider import HTTPBasicAuthProvider
|
|
29
29
|
|
|
30
30
|
yield HTTPBasicAuthProvider(config)
|
|
@@ -17,11 +17,11 @@ import typing
|
|
|
17
17
|
from abc import ABC
|
|
18
18
|
from abc import abstractmethod
|
|
19
19
|
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
20
|
+
from nat.data_models.authentication import AuthenticatedContext
|
|
21
|
+
from nat.data_models.authentication import AuthFlowType
|
|
22
|
+
from nat.data_models.authentication import AuthProviderBaseConfig
|
|
23
|
+
from nat.data_models.authentication import AuthProviderBaseConfigT
|
|
24
|
+
from nat.data_models.authentication import AuthResult
|
|
25
25
|
|
|
26
26
|
AUTHORIZATION_HEADER = "Authorization"
|
|
27
27
|
|
|
@@ -75,7 +75,7 @@ class FlowHandlerBase(ABC):
|
|
|
75
75
|
|
|
76
76
|
Each front end will define a FlowHandler that will implement the authenticate method.
|
|
77
77
|
|
|
78
|
-
The `authenticate` method will be stored as the callback in the
|
|
78
|
+
The `authenticate` method will be stored as the callback in the ContextState.user_auth_callback
|
|
79
79
|
"""
|
|
80
80
|
|
|
81
81
|
@abstractmethod
|