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
|
@@ -24,48 +24,58 @@ from pydantic import BaseModel
|
|
|
24
24
|
from pydantic import ValidationError
|
|
25
25
|
from starlette.websockets import WebSocketDisconnect
|
|
26
26
|
|
|
27
|
-
from
|
|
28
|
-
from
|
|
29
|
-
from
|
|
30
|
-
from
|
|
31
|
-
from
|
|
32
|
-
from
|
|
33
|
-
from
|
|
34
|
-
from
|
|
35
|
-
from
|
|
36
|
-
from
|
|
37
|
-
from
|
|
38
|
-
from
|
|
39
|
-
from
|
|
40
|
-
from
|
|
41
|
-
from
|
|
42
|
-
from
|
|
43
|
-
from
|
|
44
|
-
from
|
|
45
|
-
from
|
|
46
|
-
from
|
|
47
|
-
from
|
|
48
|
-
from
|
|
49
|
-
from
|
|
27
|
+
from nat.authentication.interfaces import FlowHandlerBase
|
|
28
|
+
from nat.data_models.api_server import ChatResponse
|
|
29
|
+
from nat.data_models.api_server import ChatResponseChunk
|
|
30
|
+
from nat.data_models.api_server import Error
|
|
31
|
+
from nat.data_models.api_server import ErrorTypes
|
|
32
|
+
from nat.data_models.api_server import ResponsePayloadOutput
|
|
33
|
+
from nat.data_models.api_server import ResponseSerializable
|
|
34
|
+
from nat.data_models.api_server import SystemResponseContent
|
|
35
|
+
from nat.data_models.api_server import TextContent
|
|
36
|
+
from nat.data_models.api_server import WebSocketMessageStatus
|
|
37
|
+
from nat.data_models.api_server import WebSocketMessageType
|
|
38
|
+
from nat.data_models.api_server import WebSocketSystemInteractionMessage
|
|
39
|
+
from nat.data_models.api_server import WebSocketSystemIntermediateStepMessage
|
|
40
|
+
from nat.data_models.api_server import WebSocketSystemResponseTokenMessage
|
|
41
|
+
from nat.data_models.api_server import WebSocketUserInteractionResponseMessage
|
|
42
|
+
from nat.data_models.api_server import WebSocketUserMessage
|
|
43
|
+
from nat.data_models.api_server import WorkflowSchemaType
|
|
44
|
+
from nat.data_models.interactive import HumanPromptNotification
|
|
45
|
+
from nat.data_models.interactive import HumanResponse
|
|
46
|
+
from nat.data_models.interactive import HumanResponseNotification
|
|
47
|
+
from nat.data_models.interactive import InteractionPrompt
|
|
48
|
+
from nat.front_ends.fastapi.message_validator import MessageValidator
|
|
49
|
+
from nat.front_ends.fastapi.response_helpers import generate_streaming_response
|
|
50
|
+
from nat.front_ends.fastapi.step_adaptor import StepAdaptor
|
|
51
|
+
from nat.runtime.session import SessionManager
|
|
50
52
|
|
|
51
53
|
logger = logging.getLogger(__name__)
|
|
52
54
|
|
|
53
55
|
|
|
54
56
|
class WebSocketMessageHandler:
|
|
55
57
|
|
|
56
|
-
def __init__(self, socket: WebSocket, session_manager:
|
|
58
|
+
def __init__(self, socket: WebSocket, session_manager: SessionManager, step_adaptor: StepAdaptor):
|
|
57
59
|
self._socket: WebSocket = socket
|
|
58
|
-
self._session_manager:
|
|
60
|
+
self._session_manager: SessionManager = session_manager
|
|
59
61
|
self._step_adaptor: StepAdaptor = step_adaptor
|
|
60
62
|
|
|
61
63
|
self._message_validator: MessageValidator = MessageValidator()
|
|
62
64
|
self._running_workflow_task: asyncio.Task | None = None
|
|
63
65
|
self._message_parent_id: str = "default_id"
|
|
66
|
+
self._conversation_id: str | None = None
|
|
64
67
|
self._workflow_schema_type: str = None
|
|
65
68
|
self._user_interaction_response: asyncio.Future[HumanResponse] | None = None
|
|
66
69
|
|
|
67
70
|
self._flow_handler: FlowHandlerBase | None = None
|
|
68
71
|
|
|
72
|
+
self._schema_output_mapping: dict[str, type[BaseModel] | None] = {
|
|
73
|
+
WorkflowSchemaType.GENERATE: self._session_manager.workflow.single_output_schema,
|
|
74
|
+
WorkflowSchemaType.CHAT: ChatResponse,
|
|
75
|
+
WorkflowSchemaType.CHAT_STREAM: ChatResponseChunk,
|
|
76
|
+
WorkflowSchemaType.GENERATE_STREAM: self._session_manager.workflow.streaming_output_schema,
|
|
77
|
+
}
|
|
78
|
+
|
|
69
79
|
def set_flow_handler(self, flow_handler: FlowHandlerBase) -> None:
|
|
70
80
|
self._flow_handler = flow_handler
|
|
71
81
|
|
|
@@ -76,7 +86,7 @@ class WebSocketMessageHandler:
|
|
|
76
86
|
|
|
77
87
|
async def __aexit__(self, exc_type, exc_value, traceback) -> None:
|
|
78
88
|
|
|
79
|
-
# TODO: Handle the exit
|
|
89
|
+
# TODO: Handle the exit # pylint: disable=fixme
|
|
80
90
|
pass
|
|
81
91
|
|
|
82
92
|
async def run(self) -> None:
|
|
@@ -109,7 +119,7 @@ class WebSocketMessageHandler:
|
|
|
109
119
|
user_content = await self.process_user_message_content(validated_message)
|
|
110
120
|
self._user_interaction_response.set_result(user_content)
|
|
111
121
|
except (asyncio.CancelledError, WebSocketDisconnect):
|
|
112
|
-
# TODO: Handle the disconnect
|
|
122
|
+
# TODO: Handle the disconnect # pylint: disable=fixme
|
|
113
123
|
break
|
|
114
124
|
|
|
115
125
|
return None
|
|
@@ -143,7 +153,7 @@ class WebSocketMessageHandler:
|
|
|
143
153
|
try:
|
|
144
154
|
self._message_parent_id = user_message_as_validated_type.id
|
|
145
155
|
self._workflow_schema_type = user_message_as_validated_type.schema_type
|
|
146
|
-
|
|
156
|
+
self._conversation_id = user_message_as_validated_type.conversation_id
|
|
147
157
|
|
|
148
158
|
content: BaseModel | None = await self.process_user_message_content(user_message_as_validated_type)
|
|
149
159
|
|
|
@@ -152,13 +162,15 @@ class WebSocketMessageHandler:
|
|
|
152
162
|
|
|
153
163
|
if isinstance(content, TextContent) and (self._running_workflow_task is None):
|
|
154
164
|
|
|
155
|
-
def _done_callback(task: asyncio.Task):
|
|
165
|
+
def _done_callback(task: asyncio.Task): # pylint: disable=unused-argument
|
|
156
166
|
self._running_workflow_task = None
|
|
157
167
|
|
|
158
|
-
# await self._process_response()
|
|
159
168
|
self._running_workflow_task = asyncio.create_task(
|
|
160
|
-
self._run_workflow(content.text,
|
|
161
|
-
|
|
169
|
+
self._run_workflow(content.text,
|
|
170
|
+
self._conversation_id,
|
|
171
|
+
result_type=self._schema_output_mapping[self._workflow_schema_type],
|
|
172
|
+
output_type=self._schema_output_mapping[
|
|
173
|
+
self._workflow_schema_type])).add_done_callback(_done_callback)
|
|
162
174
|
|
|
163
175
|
except ValueError as e:
|
|
164
176
|
logger.error("User message content not found: %s", str(e), exc_info=True)
|
|
@@ -196,18 +208,27 @@ class WebSocketMessageHandler:
|
|
|
196
208
|
|
|
197
209
|
if issubclass(message_schema, WebSocketSystemResponseTokenMessage):
|
|
198
210
|
message = await self._message_validator.create_system_response_token_message(
|
|
199
|
-
message_id=message_id,
|
|
211
|
+
message_id=message_id,
|
|
212
|
+
parent_id=self._message_parent_id,
|
|
213
|
+
conversation_id=self._conversation_id,
|
|
214
|
+
content=content,
|
|
215
|
+
status=status)
|
|
200
216
|
|
|
201
217
|
elif issubclass(message_schema, WebSocketSystemIntermediateStepMessage):
|
|
202
218
|
message = await self._message_validator.create_system_intermediate_step_message(
|
|
203
219
|
message_id=message_id,
|
|
204
220
|
parent_id=await self._message_validator.get_intermediate_step_parent_id(data_model),
|
|
221
|
+
conversation_id=self._conversation_id,
|
|
205
222
|
content=content,
|
|
206
223
|
status=status)
|
|
207
224
|
|
|
208
225
|
elif issubclass(message_schema, WebSocketSystemInteractionMessage):
|
|
209
226
|
message = await self._message_validator.create_system_interaction_message(
|
|
210
|
-
message_id=message_id,
|
|
227
|
+
message_id=message_id,
|
|
228
|
+
parent_id=self._message_parent_id,
|
|
229
|
+
conversation_id=self._conversation_id,
|
|
230
|
+
content=content,
|
|
231
|
+
status=status)
|
|
211
232
|
|
|
212
233
|
elif isinstance(content, Error):
|
|
213
234
|
raise ValidationError(f"Invalid input data creating websocket message. {data_model.model_dump_json()}")
|
|
@@ -223,6 +244,7 @@ class WebSocketMessageHandler:
|
|
|
223
244
|
logger.error("A data vaidation error ocurred creating websocket message: %s", str(e), exc_info=True)
|
|
224
245
|
message = await self._message_validator.create_system_response_token_message(
|
|
225
246
|
message_type=WebSocketMessageType.ERROR_MESSAGE,
|
|
247
|
+
conversation_id=self._conversation_id,
|
|
226
248
|
content=Error(code=ErrorTypes.UNKNOWN_ERROR, message="default", details=str(e)))
|
|
227
249
|
|
|
228
250
|
finally:
|
|
@@ -287,8 +309,8 @@ class WebSocketMessageHandler:
|
|
|
287
309
|
result_type=result_type,
|
|
288
310
|
output_type=output_type):
|
|
289
311
|
|
|
290
|
-
if not isinstance(value,
|
|
291
|
-
value =
|
|
312
|
+
if not isinstance(value, ResponseSerializable):
|
|
313
|
+
value = ResponsePayloadOutput(payload=value)
|
|
292
314
|
|
|
293
315
|
await self.create_websocket_message(data_model=value, status=WebSocketMessageStatus.IN_PROGRESS)
|
|
294
316
|
|
|
@@ -23,38 +23,37 @@ from typing import Literal
|
|
|
23
23
|
from pydantic import BaseModel
|
|
24
24
|
from pydantic import ValidationError
|
|
25
25
|
|
|
26
|
-
from
|
|
27
|
-
from
|
|
28
|
-
from
|
|
29
|
-
from
|
|
30
|
-
from
|
|
31
|
-
from
|
|
32
|
-
from
|
|
33
|
-
from
|
|
34
|
-
from
|
|
35
|
-
from
|
|
36
|
-
from
|
|
37
|
-
from
|
|
38
|
-
from
|
|
39
|
-
from
|
|
40
|
-
from
|
|
41
|
-
from
|
|
42
|
-
from
|
|
43
|
-
from
|
|
44
|
-
from
|
|
45
|
-
from
|
|
46
|
-
from
|
|
47
|
-
from
|
|
48
|
-
from
|
|
49
|
-
from
|
|
50
|
-
from
|
|
51
|
-
from
|
|
52
|
-
from
|
|
53
|
-
from
|
|
54
|
-
from
|
|
55
|
-
from
|
|
56
|
-
from
|
|
57
|
-
from aiq.data_models.interactive import MultipleChoiceOption
|
|
26
|
+
from nat.data_models.api_server import ChatResponse
|
|
27
|
+
from nat.data_models.api_server import ChatResponseChunk
|
|
28
|
+
from nat.data_models.api_server import Error
|
|
29
|
+
from nat.data_models.api_server import ErrorTypes
|
|
30
|
+
from nat.data_models.api_server import ResponseIntermediateStep
|
|
31
|
+
from nat.data_models.api_server import ResponsePayloadOutput
|
|
32
|
+
from nat.data_models.api_server import SystemIntermediateStepContent
|
|
33
|
+
from nat.data_models.api_server import SystemResponseContent
|
|
34
|
+
from nat.data_models.api_server import TextContent
|
|
35
|
+
from nat.data_models.api_server import WebSocketMessageStatus
|
|
36
|
+
from nat.data_models.api_server import WebSocketMessageType
|
|
37
|
+
from nat.data_models.api_server import WebSocketSystemInteractionMessage
|
|
38
|
+
from nat.data_models.api_server import WebSocketSystemIntermediateStepMessage
|
|
39
|
+
from nat.data_models.api_server import WebSocketSystemResponseTokenMessage
|
|
40
|
+
from nat.data_models.api_server import WebSocketUserInteractionResponseMessage
|
|
41
|
+
from nat.data_models.api_server import WebSocketUserMessage
|
|
42
|
+
from nat.data_models.interactive import BinaryHumanPromptOption
|
|
43
|
+
from nat.data_models.interactive import HumanPrompt
|
|
44
|
+
from nat.data_models.interactive import HumanPromptBase
|
|
45
|
+
from nat.data_models.interactive import HumanPromptBinary
|
|
46
|
+
from nat.data_models.interactive import HumanPromptCheckbox
|
|
47
|
+
from nat.data_models.interactive import HumanPromptDropdown
|
|
48
|
+
from nat.data_models.interactive import HumanPromptRadio
|
|
49
|
+
from nat.data_models.interactive import HumanPromptText
|
|
50
|
+
from nat.data_models.interactive import HumanResponse
|
|
51
|
+
from nat.data_models.interactive import HumanResponseBinary
|
|
52
|
+
from nat.data_models.interactive import HumanResponseCheckbox
|
|
53
|
+
from nat.data_models.interactive import HumanResponseDropdown
|
|
54
|
+
from nat.data_models.interactive import HumanResponseRadio
|
|
55
|
+
from nat.data_models.interactive import HumanResponseText
|
|
56
|
+
from nat.data_models.interactive import MultipleChoiceOption
|
|
58
57
|
|
|
59
58
|
logger = logging.getLogger(__name__)
|
|
60
59
|
|
|
@@ -70,12 +69,7 @@ class MessageValidator:
|
|
|
70
69
|
WebSocketMessageType.USER_INTERACTION_MESSAGE: WebSocketUserInteractionResponseMessage,
|
|
71
70
|
WebSocketMessageType.ERROR_MESSAGE: Error
|
|
72
71
|
}
|
|
73
|
-
|
|
74
|
-
WorkflowSchemaType.GENERATE: AIQResponsePayloadOutput,
|
|
75
|
-
WorkflowSchemaType.CHAT: AIQChatResponse,
|
|
76
|
-
WorkflowSchemaType.CHAT_STREAM: AIQChatResponseChunk,
|
|
77
|
-
WorkflowSchemaType.GENERATE_STREAM: AIQResponseIntermediateStep,
|
|
78
|
-
}
|
|
72
|
+
|
|
79
73
|
self._message_parent_id: str = "default_id"
|
|
80
74
|
|
|
81
75
|
async def validate_message(self, message: dict[str, Any]) -> BaseModel:
|
|
@@ -138,13 +132,17 @@ class MessageValidator:
|
|
|
138
132
|
|
|
139
133
|
validated_message_content: BaseModel = None
|
|
140
134
|
try:
|
|
141
|
-
if (isinstance(data_model,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
135
|
+
if (isinstance(data_model, ResponsePayloadOutput)):
|
|
136
|
+
if hasattr(data_model.payload, 'model_dump_json'):
|
|
137
|
+
text_content: str = data_model.payload.model_dump_json()
|
|
138
|
+
else:
|
|
139
|
+
text_content: str = str(data_model.payload)
|
|
140
|
+
validated_message_content = SystemResponseContent(text=text_content)
|
|
141
|
+
|
|
142
|
+
elif (isinstance(data_model, (ChatResponse, ChatResponseChunk))):
|
|
145
143
|
validated_message_content = SystemResponseContent(text=data_model.choices[0].message.content)
|
|
146
144
|
|
|
147
|
-
elif (isinstance(data_model,
|
|
145
|
+
elif (isinstance(data_model, ResponseIntermediateStep)):
|
|
148
146
|
validated_message_content = SystemIntermediateStepContent(name=data_model.name,
|
|
149
147
|
payload=data_model.payload)
|
|
150
148
|
elif (isinstance(data_model, HumanPromptBase)):
|
|
@@ -206,10 +204,10 @@ class MessageValidator:
|
|
|
206
204
|
|
|
207
205
|
validated_message_type: str = ""
|
|
208
206
|
try:
|
|
209
|
-
if (isinstance(data_model, (
|
|
207
|
+
if (isinstance(data_model, (ResponsePayloadOutput, ChatResponse, ChatResponseChunk))):
|
|
210
208
|
validated_message_type = WebSocketMessageType.RESPONSE_MESSAGE
|
|
211
209
|
|
|
212
|
-
elif (isinstance(data_model,
|
|
210
|
+
elif (isinstance(data_model, ResponseIntermediateStep)):
|
|
213
211
|
validated_message_type = WebSocketMessageType.INTERMEDIATE_STEP_MESSAGE
|
|
214
212
|
|
|
215
213
|
elif (isinstance(data_model, HumanPromptBase)):
|
|
@@ -225,11 +223,11 @@ class MessageValidator:
|
|
|
225
223
|
exc_info=True)
|
|
226
224
|
return WebSocketMessageType.ERROR_MESSAGE
|
|
227
225
|
|
|
228
|
-
async def get_intermediate_step_parent_id(self, data_model:
|
|
226
|
+
async def get_intermediate_step_parent_id(self, data_model: ResponseIntermediateStep) -> str:
|
|
229
227
|
"""
|
|
230
|
-
Retrieves intermediate step parent_id from
|
|
228
|
+
Retrieves intermediate step parent_id from ResponseIntermediateStep instance.
|
|
231
229
|
|
|
232
|
-
:param data_model:
|
|
230
|
+
:param data_model: ResponseIntermediateStep Data Model instance.
|
|
233
231
|
:return: Intermediate step parent_id or "default".
|
|
234
232
|
"""
|
|
235
233
|
return data_model.parent_id or "root"
|
|
@@ -241,6 +239,7 @@ class MessageValidator:
|
|
|
241
239
|
message_id: str | None = str(uuid.uuid4()),
|
|
242
240
|
thread_id: str = "default",
|
|
243
241
|
parent_id: str = "default",
|
|
242
|
+
conversation_id: str | None = None,
|
|
244
243
|
content: SystemResponseContent
|
|
245
244
|
| Error = SystemResponseContent(),
|
|
246
245
|
status: WebSocketMessageStatus = WebSocketMessageStatus.IN_PROGRESS,
|
|
@@ -253,6 +252,7 @@ class MessageValidator:
|
|
|
253
252
|
:param message_id: Unique identifier for the message (default: generated UUID).
|
|
254
253
|
:param thread_id: ID of the thread the message belongs to (default: "default").
|
|
255
254
|
:param parent_id: ID of the user message that spawned child messages.
|
|
255
|
+
:param conversation_id: ID of the conversation this message belongs to (default: None).
|
|
256
256
|
:param content: Message content.
|
|
257
257
|
:param status: Status of the message (default: IN_PROGRESS).
|
|
258
258
|
:param timestamp: Timestamp of the message (default: current UTC time).
|
|
@@ -263,6 +263,7 @@ class MessageValidator:
|
|
|
263
263
|
id=message_id,
|
|
264
264
|
thread_id=thread_id,
|
|
265
265
|
parent_id=parent_id,
|
|
266
|
+
conversation_id=conversation_id,
|
|
266
267
|
content=content,
|
|
267
268
|
status=status,
|
|
268
269
|
timestamp=timestamp)
|
|
@@ -278,6 +279,7 @@ class MessageValidator:
|
|
|
278
279
|
message_id: str = str(uuid.uuid4()),
|
|
279
280
|
thread_id: str = "default",
|
|
280
281
|
parent_id: str = "default",
|
|
282
|
+
conversation_id: str | None = None,
|
|
281
283
|
content: SystemIntermediateStepContent = SystemIntermediateStepContent(name="default", payload="default"),
|
|
282
284
|
status: WebSocketMessageStatus = WebSocketMessageStatus.IN_PROGRESS,
|
|
283
285
|
timestamp: str = str(datetime.datetime.now(datetime.timezone.utc))
|
|
@@ -289,6 +291,7 @@ class MessageValidator:
|
|
|
289
291
|
:param message_id: Unique identifier for the message (default: generated UUID).
|
|
290
292
|
:param thread_id: ID of the thread the message belongs to (default: "default").
|
|
291
293
|
:param parent_id: ID of the user message that spawned child messages.
|
|
294
|
+
:param conversation_id: ID of the conversation this message belongs to (default: None).
|
|
292
295
|
:param content: Message content
|
|
293
296
|
:param status: Status of the message (default: IN_PROGRESS).
|
|
294
297
|
:param timestamp: Timestamp of the message (default: current UTC time).
|
|
@@ -299,6 +302,7 @@ class MessageValidator:
|
|
|
299
302
|
id=message_id,
|
|
300
303
|
thread_id=thread_id,
|
|
301
304
|
parent_id=parent_id,
|
|
305
|
+
conversation_id=conversation_id,
|
|
302
306
|
content=content,
|
|
303
307
|
status=status,
|
|
304
308
|
timestamp=timestamp)
|
|
@@ -315,6 +319,7 @@ class MessageValidator:
|
|
|
315
319
|
message_id: str | None = str(uuid.uuid4()),
|
|
316
320
|
thread_id: str = "default",
|
|
317
321
|
parent_id: str = "default",
|
|
322
|
+
conversation_id: str | None = None,
|
|
318
323
|
content: HumanPrompt,
|
|
319
324
|
status: WebSocketMessageStatus = WebSocketMessageStatus.IN_PROGRESS,
|
|
320
325
|
timestamp: str = str(datetime.datetime.now(datetime.timezone.utc))
|
|
@@ -326,6 +331,7 @@ class MessageValidator:
|
|
|
326
331
|
:param message_id: Unique identifier for the message (default: generated UUID).
|
|
327
332
|
:param thread_id: ID of the thread the message belongs to (default: "default").
|
|
328
333
|
:param parent_id: ID of the user message that spawned child messages.
|
|
334
|
+
:param conversation_id: ID of the conversation this message belongs to (default: None).
|
|
329
335
|
:param content: Message content
|
|
330
336
|
:param status: Status of the message (default: IN_PROGRESS).
|
|
331
337
|
:param timestamp: Timestamp of the message (default: current UTC time).
|
|
@@ -336,6 +342,7 @@ class MessageValidator:
|
|
|
336
342
|
id=message_id,
|
|
337
343
|
thread_id=thread_id,
|
|
338
344
|
parent_id=parent_id,
|
|
345
|
+
conversation_id=conversation_id,
|
|
339
346
|
content=content,
|
|
340
347
|
status=status,
|
|
341
348
|
timestamp=timestamp)
|
|
@@ -13,13 +13,13 @@
|
|
|
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.cli.register_workflow import register_front_end
|
|
17
|
+
from nat.data_models.config import Config
|
|
18
|
+
from nat.front_ends.fastapi.fastapi_front_end_config import FastApiFrontEndConfig
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
@register_front_end(config_type=FastApiFrontEndConfig)
|
|
22
|
-
async def register_fastapi_front_end(config: FastApiFrontEndConfig, full_config:
|
|
23
|
-
from
|
|
22
|
+
async def register_fastapi_front_end(config: FastApiFrontEndConfig, full_config: Config):
|
|
23
|
+
from nat.front_ends.fastapi.fastapi_front_end_plugin import FastApiFrontEndPlugin
|
|
24
24
|
|
|
25
25
|
yield FastApiFrontEndPlugin(full_config=full_config)
|
|
@@ -17,19 +17,19 @@ import asyncio
|
|
|
17
17
|
import typing
|
|
18
18
|
from collections.abc import AsyncGenerator
|
|
19
19
|
|
|
20
|
-
from
|
|
21
|
-
from
|
|
22
|
-
from
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
26
|
-
from
|
|
27
|
-
from
|
|
20
|
+
from nat.data_models.api_server import ResponseIntermediateStep
|
|
21
|
+
from nat.data_models.api_server import ResponsePayloadOutput
|
|
22
|
+
from nat.data_models.api_server import ResponseSerializable
|
|
23
|
+
from nat.data_models.step_adaptor import StepAdaptorConfig
|
|
24
|
+
from nat.front_ends.fastapi.intermediate_steps_subscriber import pull_intermediate
|
|
25
|
+
from nat.front_ends.fastapi.step_adaptor import StepAdaptor
|
|
26
|
+
from nat.runtime.session import SessionManager
|
|
27
|
+
from nat.utils.producer_consumer_queue import AsyncIOProducerConsumerQueue
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
async def generate_streaming_response_as_str(payload: typing.Any,
|
|
31
31
|
*,
|
|
32
|
-
session_manager:
|
|
32
|
+
session_manager: SessionManager,
|
|
33
33
|
streaming: bool,
|
|
34
34
|
step_adaptor: StepAdaptor = StepAdaptor(StepAdaptorConfig()),
|
|
35
35
|
result_type: type | None = None,
|
|
@@ -42,24 +42,24 @@ async def generate_streaming_response_as_str(payload: typing.Any,
|
|
|
42
42
|
result_type=result_type,
|
|
43
43
|
output_type=output_type):
|
|
44
44
|
|
|
45
|
-
if (isinstance(item,
|
|
45
|
+
if (isinstance(item, ResponseSerializable)):
|
|
46
46
|
yield item.get_stream_data()
|
|
47
47
|
else:
|
|
48
|
-
raise ValueError("Unexpected item type in stream. Expected
|
|
48
|
+
raise ValueError("Unexpected item type in stream. Expected ChatResponseSerializable, got: " +
|
|
49
49
|
str(type(item)))
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
async def generate_streaming_response(payload: typing.Any,
|
|
53
53
|
*,
|
|
54
|
-
session_manager:
|
|
54
|
+
session_manager: SessionManager,
|
|
55
55
|
streaming: bool,
|
|
56
56
|
step_adaptor: StepAdaptor = StepAdaptor(StepAdaptorConfig()),
|
|
57
57
|
result_type: type | None = None,
|
|
58
|
-
output_type: type | None = None) -> AsyncGenerator[
|
|
58
|
+
output_type: type | None = None) -> AsyncGenerator[ResponseSerializable]:
|
|
59
59
|
|
|
60
60
|
async with session_manager.run(payload) as runner:
|
|
61
61
|
|
|
62
|
-
q: AsyncIOProducerConsumerQueue[
|
|
62
|
+
q: AsyncIOProducerConsumerQueue[ResponseSerializable] = AsyncIOProducerConsumerQueue()
|
|
63
63
|
|
|
64
64
|
# Start the intermediate stream
|
|
65
65
|
intermediate_complete = await pull_intermediate(q, step_adaptor)
|
|
@@ -94,10 +94,10 @@ async def generate_streaming_response(payload: typing.Any,
|
|
|
94
94
|
|
|
95
95
|
async for item in q:
|
|
96
96
|
|
|
97
|
-
if (isinstance(item,
|
|
97
|
+
if (isinstance(item, ResponseSerializable)):
|
|
98
98
|
yield item
|
|
99
99
|
else:
|
|
100
|
-
yield
|
|
100
|
+
yield ResponsePayloadOutput(payload=item)
|
|
101
101
|
except Exception as e:
|
|
102
102
|
# Handle exceptions here
|
|
103
103
|
raise e
|
|
@@ -107,7 +107,7 @@ async def generate_streaming_response(payload: typing.Any,
|
|
|
107
107
|
|
|
108
108
|
async def generate_single_response(
|
|
109
109
|
payload: typing.Any,
|
|
110
|
-
session_manager:
|
|
110
|
+
session_manager: SessionManager,
|
|
111
111
|
result_type: type | None = None,
|
|
112
112
|
) -> typing.Any:
|
|
113
113
|
if (not session_manager.workflow.has_single_output):
|
|
@@ -119,13 +119,13 @@ async def generate_single_response(
|
|
|
119
119
|
|
|
120
120
|
async def generate_streaming_response_full(payload: typing.Any,
|
|
121
121
|
*,
|
|
122
|
-
session_manager:
|
|
122
|
+
session_manager: SessionManager,
|
|
123
123
|
streaming: bool,
|
|
124
124
|
result_type: type | None = None,
|
|
125
125
|
output_type: type | None = None,
|
|
126
|
-
filter_steps: str | None = None) -> AsyncGenerator[
|
|
126
|
+
filter_steps: str | None = None) -> AsyncGenerator[ResponseSerializable]:
|
|
127
127
|
"""
|
|
128
|
-
Similar to generate_streaming_response but provides raw
|
|
128
|
+
Similar to generate_streaming_response but provides raw ResponseIntermediateStep objects
|
|
129
129
|
without any step adaptor translations.
|
|
130
130
|
"""
|
|
131
131
|
# Parse filter_steps into a set of allowed types if provided
|
|
@@ -138,7 +138,7 @@ async def generate_streaming_response_full(payload: typing.Any,
|
|
|
138
138
|
allowed_types = set(filter_steps.split(','))
|
|
139
139
|
|
|
140
140
|
async with session_manager.run(payload) as runner:
|
|
141
|
-
q: AsyncIOProducerConsumerQueue[
|
|
141
|
+
q: AsyncIOProducerConsumerQueue[ResponseSerializable] = AsyncIOProducerConsumerQueue()
|
|
142
142
|
|
|
143
143
|
# Start the intermediate stream without step adaptor
|
|
144
144
|
intermediate_complete = await pull_intermediate(q, None)
|
|
@@ -159,12 +159,12 @@ async def generate_streaming_response_full(payload: typing.Any,
|
|
|
159
159
|
asyncio.create_task(pull_result())
|
|
160
160
|
|
|
161
161
|
async for item in q:
|
|
162
|
-
if (isinstance(item,
|
|
162
|
+
if (isinstance(item, ResponseIntermediateStep)):
|
|
163
163
|
# Filter intermediate steps if filter_steps is provided
|
|
164
164
|
if allowed_types is None or item.type in allowed_types:
|
|
165
165
|
yield item
|
|
166
166
|
else:
|
|
167
|
-
yield
|
|
167
|
+
yield ResponsePayloadOutput(payload=item)
|
|
168
168
|
except Exception as e:
|
|
169
169
|
# Handle exceptions here
|
|
170
170
|
raise e
|
|
@@ -174,7 +174,7 @@ async def generate_streaming_response_full(payload: typing.Any,
|
|
|
174
174
|
|
|
175
175
|
async def generate_streaming_response_full_as_str(payload: typing.Any,
|
|
176
176
|
*,
|
|
177
|
-
session_manager:
|
|
177
|
+
session_manager: SessionManager,
|
|
178
178
|
streaming: bool,
|
|
179
179
|
result_type: type | None = None,
|
|
180
180
|
output_type: type | None = None,
|
|
@@ -188,8 +188,8 @@ async def generate_streaming_response_full_as_str(payload: typing.Any,
|
|
|
188
188
|
result_type=result_type,
|
|
189
189
|
output_type=output_type,
|
|
190
190
|
filter_steps=filter_steps):
|
|
191
|
-
if (isinstance(item,
|
|
191
|
+
if (isinstance(item, ResponseIntermediateStep) or isinstance(item, ResponsePayloadOutput)):
|
|
192
192
|
yield item.get_stream_data()
|
|
193
193
|
else:
|
|
194
|
-
raise ValueError("Unexpected item type in stream. Expected
|
|
194
|
+
raise ValueError("Unexpected item type in stream. Expected ChatResponseSerializable, got: " +
|
|
195
195
|
str(type(item)))
|