nvidia-nat 1.2.0rc5__py3-none-any.whl → 1.2.0rc6__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.0rc6.dist-info}/METADATA +37 -37
- nvidia_nat-1.2.0rc6.dist-info/RECORD +434 -0
- nvidia_nat-1.2.0rc6.dist-info/entry_points.txt +21 -0
- nvidia_nat-1.2.0rc6.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.0rc6.dist-info}/WHEEL +0 -0
- {nvidia_nat-1.2.0rc5.dist-info → nvidia_nat-1.2.0rc6.dist-info}/licenses/LICENSE-3rd-party.txt +0 -0
- {nvidia_nat-1.2.0rc5.dist-info → nvidia_nat-1.2.0rc6.dist-info}/licenses/LICENSE.md +0 -0
|
@@ -30,8 +30,10 @@ from pydantic import field_serializer
|
|
|
30
30
|
from pydantic import field_validator
|
|
31
31
|
from pydantic_core.core_schema import ValidationInfo
|
|
32
32
|
|
|
33
|
-
from
|
|
34
|
-
from
|
|
33
|
+
from nat.data_models.interactive import HumanPrompt
|
|
34
|
+
from nat.utils.type_converter import GlobalTypeConverter
|
|
35
|
+
|
|
36
|
+
FINISH_REASONS = frozenset({'stop', 'length', 'tool_calls', 'content_filter', 'function_call'})
|
|
35
37
|
|
|
36
38
|
|
|
37
39
|
class Request(BaseModel):
|
|
@@ -109,9 +111,9 @@ class Message(BaseModel):
|
|
|
109
111
|
role: str
|
|
110
112
|
|
|
111
113
|
|
|
112
|
-
class
|
|
114
|
+
class ChatRequest(BaseModel):
|
|
113
115
|
"""
|
|
114
|
-
|
|
116
|
+
ChatRequest is a data model that represents a request to the NAT chat API.
|
|
115
117
|
Fully compatible with OpenAI Chat Completions API specification.
|
|
116
118
|
"""
|
|
117
119
|
|
|
@@ -160,13 +162,13 @@ class AIQChatRequest(BaseModel):
|
|
|
160
162
|
model: str | None = None,
|
|
161
163
|
temperature: float | None = None,
|
|
162
164
|
max_tokens: int | None = None,
|
|
163
|
-
top_p: float | None = None) -> "
|
|
165
|
+
top_p: float | None = None) -> "ChatRequest":
|
|
164
166
|
|
|
165
|
-
return
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
167
|
+
return ChatRequest(messages=[Message(content=data, role="user")],
|
|
168
|
+
model=model,
|
|
169
|
+
temperature=temperature,
|
|
170
|
+
max_tokens=max_tokens,
|
|
171
|
+
top_p=top_p)
|
|
170
172
|
|
|
171
173
|
@staticmethod
|
|
172
174
|
def from_content(content: list[UserContent],
|
|
@@ -174,45 +176,45 @@ class AIQChatRequest(BaseModel):
|
|
|
174
176
|
model: str | None = None,
|
|
175
177
|
temperature: float | None = None,
|
|
176
178
|
max_tokens: int | None = None,
|
|
177
|
-
top_p: float | None = None) -> "
|
|
179
|
+
top_p: float | None = None) -> "ChatRequest":
|
|
178
180
|
|
|
179
|
-
return
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
return ChatRequest(messages=[Message(content=content, role="user")],
|
|
182
|
+
model=model,
|
|
183
|
+
temperature=temperature,
|
|
184
|
+
max_tokens=max_tokens,
|
|
185
|
+
top_p=top_p)
|
|
184
186
|
|
|
185
187
|
|
|
186
|
-
class
|
|
188
|
+
class ChoiceMessage(BaseModel):
|
|
187
189
|
content: str | None = None
|
|
188
190
|
role: str | None = None
|
|
189
191
|
|
|
190
192
|
|
|
191
|
-
class
|
|
193
|
+
class ChoiceDelta(BaseModel):
|
|
192
194
|
"""Delta object for streaming responses (OpenAI-compatible)"""
|
|
193
195
|
content: str | None = None
|
|
194
196
|
role: str | None = None
|
|
195
197
|
|
|
196
198
|
|
|
197
|
-
class
|
|
199
|
+
class Choice(BaseModel):
|
|
198
200
|
model_config = ConfigDict(extra="allow")
|
|
199
201
|
|
|
200
|
-
message:
|
|
201
|
-
delta:
|
|
202
|
+
message: ChoiceMessage | None = None
|
|
203
|
+
delta: ChoiceDelta | None = None
|
|
202
204
|
finish_reason: typing.Literal['stop', 'length', 'tool_calls', 'content_filter', 'function_call'] | None = None
|
|
203
205
|
index: int
|
|
204
|
-
# logprobs:
|
|
206
|
+
# logprobs: ChoiceLogprobs | None = None
|
|
205
207
|
|
|
206
208
|
|
|
207
|
-
class
|
|
209
|
+
class Usage(BaseModel):
|
|
208
210
|
prompt_tokens: int
|
|
209
211
|
completion_tokens: int
|
|
210
212
|
total_tokens: int
|
|
211
213
|
|
|
212
214
|
|
|
213
|
-
class
|
|
215
|
+
class ResponseSerializable(abc.ABC):
|
|
214
216
|
"""
|
|
215
|
-
|
|
217
|
+
ResponseSerializable is an abstract class that defines the interface for serializing output for the NAT
|
|
216
218
|
Toolkit chat streaming API.
|
|
217
219
|
"""
|
|
218
220
|
|
|
@@ -221,21 +223,21 @@ class AIQResponseSerializable(abc.ABC):
|
|
|
221
223
|
pass
|
|
222
224
|
|
|
223
225
|
|
|
224
|
-
class
|
|
226
|
+
class ResponseBaseModelOutput(BaseModel, ResponseSerializable):
|
|
225
227
|
|
|
226
228
|
def get_stream_data(self) -> str:
|
|
227
229
|
return f"data: {self.model_dump_json()}\n\n"
|
|
228
230
|
|
|
229
231
|
|
|
230
|
-
class
|
|
232
|
+
class ResponseBaseModelIntermediate(BaseModel, ResponseSerializable):
|
|
231
233
|
|
|
232
234
|
def get_stream_data(self) -> str:
|
|
233
235
|
return f"intermediate_data: {self.model_dump_json()}\n\n"
|
|
234
236
|
|
|
235
237
|
|
|
236
|
-
class
|
|
238
|
+
class ChatResponse(ResponseBaseModelOutput):
|
|
237
239
|
"""
|
|
238
|
-
|
|
240
|
+
ChatResponse is a data model that represents a response from the NAT chat API.
|
|
239
241
|
Fully compatible with OpenAI Chat Completions API specification.
|
|
240
242
|
"""
|
|
241
243
|
|
|
@@ -245,8 +247,8 @@ class AIQChatResponse(AIQResponseBaseModelOutput):
|
|
|
245
247
|
object: str = "chat.completion"
|
|
246
248
|
model: str = ""
|
|
247
249
|
created: datetime.datetime
|
|
248
|
-
choices: list[
|
|
249
|
-
usage:
|
|
250
|
+
choices: list[Choice]
|
|
251
|
+
usage: Usage | None = None
|
|
250
252
|
system_fingerprint: str | None = None
|
|
251
253
|
service_tier: typing.Literal["scale", "default"] | None = None
|
|
252
254
|
|
|
@@ -262,7 +264,7 @@ class AIQChatResponse(AIQResponseBaseModelOutput):
|
|
|
262
264
|
object_: str | None = None,
|
|
263
265
|
model: str | None = None,
|
|
264
266
|
created: datetime.datetime | None = None,
|
|
265
|
-
usage:
|
|
267
|
+
usage: Usage | None = None) -> "ChatResponse":
|
|
266
268
|
|
|
267
269
|
if id_ is None:
|
|
268
270
|
id_ = str(uuid.uuid4())
|
|
@@ -273,18 +275,17 @@ class AIQChatResponse(AIQResponseBaseModelOutput):
|
|
|
273
275
|
if created is None:
|
|
274
276
|
created = datetime.datetime.now(datetime.timezone.utc)
|
|
275
277
|
|
|
276
|
-
return
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
usage=usage)
|
|
278
|
+
return ChatResponse(id=id_,
|
|
279
|
+
object=object_,
|
|
280
|
+
model=model,
|
|
281
|
+
created=created,
|
|
282
|
+
choices=[Choice(index=0, message=ChoiceMessage(content=data), finish_reason="stop")],
|
|
283
|
+
usage=usage)
|
|
283
284
|
|
|
284
285
|
|
|
285
|
-
class
|
|
286
|
+
class ChatResponseChunk(ResponseBaseModelOutput):
|
|
286
287
|
"""
|
|
287
|
-
|
|
288
|
+
ChatResponseChunk is a data model that represents a response chunk from the NAT chat streaming API.
|
|
288
289
|
Fully compatible with OpenAI Chat Completions API specification.
|
|
289
290
|
"""
|
|
290
291
|
|
|
@@ -292,13 +293,13 @@ class AIQChatResponseChunk(AIQResponseBaseModelOutput):
|
|
|
292
293
|
model_config = ConfigDict(extra="allow")
|
|
293
294
|
|
|
294
295
|
id: str
|
|
295
|
-
choices: list[
|
|
296
|
+
choices: list[Choice]
|
|
296
297
|
created: datetime.datetime
|
|
297
298
|
model: str = ""
|
|
298
299
|
object: str = "chat.completion.chunk"
|
|
299
300
|
system_fingerprint: str | None = None
|
|
300
301
|
service_tier: typing.Literal["scale", "default"] | None = None
|
|
301
|
-
usage:
|
|
302
|
+
usage: Usage | None = None
|
|
302
303
|
|
|
303
304
|
@field_serializer('created')
|
|
304
305
|
def serialize_created(self, created: datetime.datetime) -> int:
|
|
@@ -311,7 +312,7 @@ class AIQChatResponseChunk(AIQResponseBaseModelOutput):
|
|
|
311
312
|
id_: str | None = None,
|
|
312
313
|
created: datetime.datetime | None = None,
|
|
313
314
|
model: str | None = None,
|
|
314
|
-
object_: str | None = None) -> "
|
|
315
|
+
object_: str | None = None) -> "ChatResponseChunk":
|
|
315
316
|
|
|
316
317
|
if id_ is None:
|
|
317
318
|
id_ = str(uuid.uuid4())
|
|
@@ -322,12 +323,11 @@ class AIQChatResponseChunk(AIQResponseBaseModelOutput):
|
|
|
322
323
|
if object_ is None:
|
|
323
324
|
object_ = "chat.completion.chunk"
|
|
324
325
|
|
|
325
|
-
return
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
object=object_)
|
|
326
|
+
return ChatResponseChunk(id=id_,
|
|
327
|
+
choices=[Choice(index=0, message=ChoiceMessage(content=data), finish_reason="stop")],
|
|
328
|
+
created=created,
|
|
329
|
+
model=model,
|
|
330
|
+
object=object_)
|
|
331
331
|
|
|
332
332
|
@staticmethod
|
|
333
333
|
def create_streaming_chunk(content: str,
|
|
@@ -337,8 +337,8 @@ class AIQChatResponseChunk(AIQResponseBaseModelOutput):
|
|
|
337
337
|
model: str | None = None,
|
|
338
338
|
role: str | None = None,
|
|
339
339
|
finish_reason: str | None = None,
|
|
340
|
-
usage:
|
|
341
|
-
system_fingerprint: str | None = None) -> "
|
|
340
|
+
usage: Usage | None = None,
|
|
341
|
+
system_fingerprint: str | None = None) -> "ChatResponseChunk":
|
|
342
342
|
"""Create an OpenAI-compatible streaming chunk"""
|
|
343
343
|
if id_ is None:
|
|
344
344
|
id_ = str(uuid.uuid4())
|
|
@@ -347,12 +347,13 @@ class AIQChatResponseChunk(AIQResponseBaseModelOutput):
|
|
|
347
347
|
if model is None:
|
|
348
348
|
model = ""
|
|
349
349
|
|
|
350
|
-
delta =
|
|
351
|
-
|
|
350
|
+
delta = ChoiceDelta(content=content, role=role) if content is not None or role is not None else ChoiceDelta()
|
|
351
|
+
|
|
352
|
+
final_finish_reason = finish_reason if finish_reason in FINISH_REASONS else None
|
|
352
353
|
|
|
353
|
-
return
|
|
354
|
+
return ChatResponseChunk(
|
|
354
355
|
id=id_,
|
|
355
|
-
choices=[
|
|
356
|
+
choices=[Choice(index=0, message=None, delta=delta, finish_reason=final_finish_reason)],
|
|
356
357
|
created=created,
|
|
357
358
|
model=model,
|
|
358
359
|
object="chat.completion.chunk",
|
|
@@ -360,9 +361,9 @@ class AIQChatResponseChunk(AIQResponseBaseModelOutput):
|
|
|
360
361
|
system_fingerprint=system_fingerprint)
|
|
361
362
|
|
|
362
363
|
|
|
363
|
-
class
|
|
364
|
+
class ResponseIntermediateStep(ResponseBaseModelIntermediate):
|
|
364
365
|
"""
|
|
365
|
-
|
|
366
|
+
ResponseSerializedStep is a data model that represents a serialized step in the NAT chat streaming API.
|
|
366
367
|
"""
|
|
367
368
|
|
|
368
369
|
# Allow extra fields in the model_config to support derived models
|
|
@@ -375,7 +376,7 @@ class AIQResponseIntermediateStep(AIQResponseBaseModelIntermediate):
|
|
|
375
376
|
payload: str
|
|
376
377
|
|
|
377
378
|
|
|
378
|
-
class
|
|
379
|
+
class ResponsePayloadOutput(BaseModel, ResponseSerializable):
|
|
379
380
|
|
|
380
381
|
payload: typing.Any
|
|
381
382
|
|
|
@@ -387,7 +388,7 @@ class AIQResponsePayloadOutput(BaseModel, AIQResponseSerializable):
|
|
|
387
388
|
return f"data: {self.payload}\n\n"
|
|
388
389
|
|
|
389
390
|
|
|
390
|
-
class
|
|
391
|
+
class GenerateResponse(BaseModel):
|
|
391
392
|
# Allow extra fields in the model_config to support derived models
|
|
392
393
|
model_config = ConfigDict(extra="allow")
|
|
393
394
|
|
|
@@ -523,6 +524,7 @@ class WebSocketSystemIntermediateStepMessage(BaseModel):
|
|
|
523
524
|
parent_id: str = "default"
|
|
524
525
|
intermediate_parent_id: str | None = "default"
|
|
525
526
|
update_message_id: str | None = "default"
|
|
527
|
+
conversation_id: str | None = None
|
|
526
528
|
content: SystemIntermediateStepContent
|
|
527
529
|
status: WebSocketMessageStatus
|
|
528
530
|
timestamp: str = str(datetime.datetime.now(datetime.timezone.utc))
|
|
@@ -546,18 +548,19 @@ class WebSocketSystemResponseTokenMessage(BaseModel):
|
|
|
546
548
|
id: str | None = "default"
|
|
547
549
|
thread_id: str | None = "default"
|
|
548
550
|
parent_id: str = "default"
|
|
549
|
-
|
|
551
|
+
conversation_id: str | None = None
|
|
552
|
+
content: SystemResponseContent | Error | GenerateResponse
|
|
550
553
|
status: WebSocketMessageStatus
|
|
551
554
|
timestamp: str = str(datetime.datetime.now(datetime.timezone.utc))
|
|
552
555
|
|
|
553
556
|
@field_validator("content")
|
|
554
557
|
@classmethod
|
|
555
|
-
def validate_content_by_type(cls, value: SystemResponseContent | Error |
|
|
558
|
+
def validate_content_by_type(cls, value: SystemResponseContent | Error | GenerateResponse, info: ValidationInfo):
|
|
556
559
|
if info.data.get("type") == WebSocketMessageType.ERROR_MESSAGE and not isinstance(value, Error):
|
|
557
560
|
raise ValueError(f"Field: content must be 'Error' when type is {WebSocketMessageType.ERROR_MESSAGE}")
|
|
558
561
|
|
|
559
562
|
if info.data.get("type") == WebSocketMessageType.RESPONSE_MESSAGE and not isinstance(
|
|
560
|
-
value, (SystemResponseContent,
|
|
563
|
+
value, (SystemResponseContent, GenerateResponse)):
|
|
561
564
|
raise ValueError(
|
|
562
565
|
f"Field: content must be 'SystemResponseContent' when type is {WebSocketMessageType.RESPONSE_MESSAGE}")
|
|
563
566
|
return value
|
|
@@ -576,88 +579,91 @@ class WebSocketSystemInteractionMessage(BaseModel):
|
|
|
576
579
|
id: str | None = "default"
|
|
577
580
|
thread_id: str | None = "default"
|
|
578
581
|
parent_id: str = "default"
|
|
582
|
+
conversation_id: str | None = None
|
|
579
583
|
content: HumanPrompt
|
|
580
584
|
status: WebSocketMessageStatus
|
|
581
585
|
timestamp: str = str(datetime.datetime.now(datetime.timezone.utc))
|
|
582
586
|
|
|
583
587
|
|
|
584
|
-
# ========
|
|
588
|
+
# ======== GenerateResponse Converters ========
|
|
585
589
|
|
|
586
590
|
|
|
587
|
-
def _generate_response_to_str(response:
|
|
591
|
+
def _generate_response_to_str(response: GenerateResponse) -> str:
|
|
588
592
|
return response.output
|
|
589
593
|
|
|
590
594
|
|
|
591
595
|
GlobalTypeConverter.register_converter(_generate_response_to_str)
|
|
592
596
|
|
|
593
597
|
|
|
594
|
-
def _generate_response_to_chat_response(response:
|
|
598
|
+
def _generate_response_to_chat_response(response: GenerateResponse) -> ChatResponse:
|
|
595
599
|
data = response.output
|
|
596
600
|
|
|
597
601
|
# Simulate usage
|
|
598
602
|
prompt_tokens = 0
|
|
599
|
-
usage =
|
|
600
|
-
|
|
601
|
-
|
|
603
|
+
usage = Usage(prompt_tokens=prompt_tokens,
|
|
604
|
+
completion_tokens=len(data.split()),
|
|
605
|
+
total_tokens=prompt_tokens + len(data.split()))
|
|
602
606
|
|
|
603
607
|
# Build and return the response
|
|
604
|
-
return
|
|
608
|
+
return ChatResponse.from_string(data, usage=usage)
|
|
605
609
|
|
|
606
610
|
|
|
607
611
|
GlobalTypeConverter.register_converter(_generate_response_to_chat_response)
|
|
608
612
|
|
|
609
613
|
|
|
610
|
-
# ========
|
|
611
|
-
def
|
|
614
|
+
# ======== ChatRequest Converters ========
|
|
615
|
+
def _nat_chat_request_to_string(data: ChatRequest) -> str:
|
|
612
616
|
if isinstance(data.messages[-1].content, str):
|
|
613
617
|
return data.messages[-1].content
|
|
614
618
|
return str(data.messages[-1].content)
|
|
615
619
|
|
|
616
620
|
|
|
617
|
-
GlobalTypeConverter.register_converter(
|
|
621
|
+
GlobalTypeConverter.register_converter(_nat_chat_request_to_string)
|
|
618
622
|
|
|
619
623
|
|
|
620
|
-
def
|
|
621
|
-
return
|
|
624
|
+
def _string_to_nat_chat_request(data: str) -> ChatRequest:
|
|
625
|
+
return ChatRequest.from_string(data, model="")
|
|
622
626
|
|
|
623
627
|
|
|
624
|
-
GlobalTypeConverter.register_converter(
|
|
628
|
+
GlobalTypeConverter.register_converter(_string_to_nat_chat_request)
|
|
625
629
|
|
|
626
630
|
|
|
627
|
-
# ========
|
|
628
|
-
def
|
|
629
|
-
|
|
631
|
+
# ======== ChatResponse Converters ========
|
|
632
|
+
def _nat_chat_response_to_string(data: ChatResponse) -> str:
|
|
633
|
+
if data.choices and data.choices[0].message:
|
|
634
|
+
return data.choices[0].message.content or ""
|
|
635
|
+
return ""
|
|
630
636
|
|
|
631
637
|
|
|
632
|
-
GlobalTypeConverter.register_converter(
|
|
638
|
+
GlobalTypeConverter.register_converter(_nat_chat_response_to_string)
|
|
633
639
|
|
|
634
640
|
|
|
635
|
-
def
|
|
636
|
-
'''Converts a string to an
|
|
641
|
+
def _string_to_nat_chat_response(data: str) -> ChatResponse:
|
|
642
|
+
'''Converts a string to an ChatResponse object'''
|
|
637
643
|
|
|
638
644
|
# Simulate usage
|
|
639
645
|
prompt_tokens = 0
|
|
640
|
-
usage =
|
|
641
|
-
|
|
642
|
-
|
|
646
|
+
usage = Usage(prompt_tokens=prompt_tokens,
|
|
647
|
+
completion_tokens=len(data.split()),
|
|
648
|
+
total_tokens=prompt_tokens + len(data.split()))
|
|
643
649
|
|
|
644
650
|
# Build and return the response
|
|
645
|
-
return
|
|
651
|
+
return ChatResponse.from_string(data, usage=usage)
|
|
646
652
|
|
|
647
653
|
|
|
648
|
-
GlobalTypeConverter.register_converter(
|
|
654
|
+
GlobalTypeConverter.register_converter(_string_to_nat_chat_response)
|
|
649
655
|
|
|
650
656
|
|
|
651
|
-
def _chat_response_to_chat_response_chunk(data:
|
|
657
|
+
def _chat_response_to_chat_response_chunk(data: ChatResponse) -> ChatResponseChunk:
|
|
652
658
|
# Preserve original message structure for backward compatibility
|
|
653
|
-
return
|
|
659
|
+
return ChatResponseChunk(id=data.id, choices=data.choices, created=data.created, model=data.model)
|
|
654
660
|
|
|
655
661
|
|
|
656
662
|
GlobalTypeConverter.register_converter(_chat_response_to_chat_response_chunk)
|
|
657
663
|
|
|
658
664
|
|
|
659
|
-
# ========
|
|
660
|
-
def
|
|
665
|
+
# ======== ChatResponseChunk Converters ========
|
|
666
|
+
def _chat_response_chunk_to_string(data: ChatResponseChunk) -> str:
|
|
661
667
|
if data.choices and len(data.choices) > 0:
|
|
662
668
|
choice = data.choices[0]
|
|
663
669
|
if choice.delta and choice.delta.content:
|
|
@@ -667,22 +673,22 @@ def _aiq_chat_response_chunk_to_string(data: AIQChatResponseChunk) -> str:
|
|
|
667
673
|
return ""
|
|
668
674
|
|
|
669
675
|
|
|
670
|
-
GlobalTypeConverter.register_converter(
|
|
676
|
+
GlobalTypeConverter.register_converter(_chat_response_chunk_to_string)
|
|
671
677
|
|
|
672
678
|
|
|
673
|
-
def
|
|
674
|
-
'''Converts a string to an
|
|
679
|
+
def _string_to_nat_chat_response_chunk(data: str) -> ChatResponseChunk:
|
|
680
|
+
'''Converts a string to an ChatResponseChunk object'''
|
|
675
681
|
|
|
676
682
|
# Build and return the response
|
|
677
|
-
return
|
|
683
|
+
return ChatResponseChunk.from_string(data)
|
|
678
684
|
|
|
679
685
|
|
|
680
|
-
GlobalTypeConverter.register_converter(
|
|
686
|
+
GlobalTypeConverter.register_converter(_string_to_nat_chat_response_chunk)
|
|
681
687
|
|
|
682
688
|
|
|
683
689
|
# ======== AINodeMessageChunk Converters ========
|
|
684
|
-
def
|
|
685
|
-
'''Converts LangChain AINodeMessageChunk to
|
|
690
|
+
def _ai_message_chunk_to_nat_chat_response_chunk(data) -> ChatResponseChunk:
|
|
691
|
+
'''Converts LangChain AINodeMessageChunk to ChatResponseChunk'''
|
|
686
692
|
content = ""
|
|
687
693
|
if hasattr(data, 'content') and data.content is not None:
|
|
688
694
|
content = str(data.content)
|
|
@@ -691,4 +697,20 @@ def _ai_message_chunk_to_aiq_chat_response_chunk(data) -> AIQChatResponseChunk:
|
|
|
691
697
|
elif hasattr(data, 'message') and data.message is not None:
|
|
692
698
|
content = str(data.message)
|
|
693
699
|
|
|
694
|
-
return
|
|
700
|
+
return ChatResponseChunk.create_streaming_chunk(content=content, role="assistant", finish_reason=None)
|
|
701
|
+
|
|
702
|
+
|
|
703
|
+
# Compatibility aliases with previous releases
|
|
704
|
+
AIQChatRequest = ChatRequest
|
|
705
|
+
AIQChoiceMessage = ChoiceMessage
|
|
706
|
+
AIQChoiceDelta = ChoiceDelta
|
|
707
|
+
AIQChoice = Choice
|
|
708
|
+
AIQUsage = Usage
|
|
709
|
+
AIQResponseSerializable = ResponseSerializable
|
|
710
|
+
AIQResponseBaseModelOutput = ResponseBaseModelOutput
|
|
711
|
+
AIQResponseBaseModelIntermediate = ResponseBaseModelIntermediate
|
|
712
|
+
AIQChatResponse = ChatResponse
|
|
713
|
+
AIQChatResponseChunk = ChatResponseChunk
|
|
714
|
+
AIQResponseIntermediateStep = ResponseIntermediateStep
|
|
715
|
+
AIQResponsePayloadOutput = ResponsePayloadOutput
|
|
716
|
+
AIQGenerateResponse = GenerateResponse
|
|
@@ -24,8 +24,8 @@ from pydantic import ConfigDict
|
|
|
24
24
|
from pydantic import Field
|
|
25
25
|
from pydantic import SecretStr
|
|
26
26
|
|
|
27
|
-
from
|
|
28
|
-
from
|
|
27
|
+
from nat.data_models.common import BaseModelRegistryTag
|
|
28
|
+
from nat.data_models.common import TypedBaseModel
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
class AuthProviderBaseConfig(TypedBaseModel, BaseModelRegistryTag):
|
|
@@ -19,7 +19,7 @@ from enum import StrEnum
|
|
|
19
19
|
logger = logging.getLogger(__name__)
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
class
|
|
22
|
+
class ComponentEnum(StrEnum):
|
|
23
23
|
# Keep sorted!!!
|
|
24
24
|
AUTHENTICATION_PROVIDER = "auth_provider"
|
|
25
25
|
EMBEDDER_CLIENT = "embedder_client"
|
|
@@ -52,3 +52,7 @@ class ComponentGroup(StrEnum):
|
|
|
52
52
|
MEMORY = "memory"
|
|
53
53
|
OBJECT_STORES = "object_stores"
|
|
54
54
|
RETRIEVERS = "retrievers"
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
# Compatibility aliases with previous releases
|
|
58
|
+
AIQComponentEnum = ComponentEnum
|
|
@@ -20,9 +20,9 @@ from abc import abstractmethod
|
|
|
20
20
|
from pydantic_core import CoreSchema
|
|
21
21
|
from pydantic_core import core_schema
|
|
22
22
|
|
|
23
|
-
from
|
|
24
|
-
from
|
|
25
|
-
from
|
|
23
|
+
from nat.data_models.common import HashableBaseModel
|
|
24
|
+
from nat.data_models.component import ComponentGroup
|
|
25
|
+
from nat.utils.type_utils import override
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
def generate_instance_id(input_object: typing.Any) -> str:
|
|
@@ -43,7 +43,7 @@ class ComponentRefNode(HashableBaseModel):
|
|
|
43
43
|
|
|
44
44
|
Args:
|
|
45
45
|
ref_name (ComponentRef): The name of the component runtime instance.
|
|
46
|
-
component_group (ComponentGroup): The component group in
|
|
46
|
+
component_group (ComponentGroup): The component group in a NAT configuration object.
|
|
47
47
|
"""
|
|
48
48
|
|
|
49
49
|
ref_name: "ComponentRef"
|
|
@@ -70,7 +70,7 @@ class ComponentRef(str, ABC):
|
|
|
70
70
|
"""Provides the component group this ComponentRef object represents.
|
|
71
71
|
|
|
72
72
|
Returns:
|
|
73
|
-
ComponentGroup: A component group of the
|
|
73
|
+
ComponentGroup: A component group of the NAT configuration object
|
|
74
74
|
"""
|
|
75
75
|
|
|
76
76
|
pass
|
|
@@ -82,7 +82,7 @@ class ComponentRef(str, ABC):
|
|
|
82
82
|
|
|
83
83
|
class EmbedderRef(ComponentRef):
|
|
84
84
|
"""
|
|
85
|
-
A reference to an embedder in
|
|
85
|
+
A reference to an embedder in a NAT configuration object.
|
|
86
86
|
"""
|
|
87
87
|
|
|
88
88
|
@property
|
|
@@ -93,7 +93,7 @@ class EmbedderRef(ComponentRef):
|
|
|
93
93
|
|
|
94
94
|
class FunctionRef(ComponentRef):
|
|
95
95
|
"""
|
|
96
|
-
A reference to a function in
|
|
96
|
+
A reference to a function in a NAT configuration object.
|
|
97
97
|
"""
|
|
98
98
|
|
|
99
99
|
@property
|
|
@@ -104,7 +104,7 @@ class FunctionRef(ComponentRef):
|
|
|
104
104
|
|
|
105
105
|
class LLMRef(ComponentRef):
|
|
106
106
|
"""
|
|
107
|
-
A reference to an LLM in
|
|
107
|
+
A reference to an LLM in a NAT configuration object.
|
|
108
108
|
"""
|
|
109
109
|
|
|
110
110
|
@property
|
|
@@ -115,7 +115,7 @@ class LLMRef(ComponentRef):
|
|
|
115
115
|
|
|
116
116
|
class MemoryRef(ComponentRef):
|
|
117
117
|
"""
|
|
118
|
-
A reference to a memory in
|
|
118
|
+
A reference to a memory in a NAT configuration object.
|
|
119
119
|
"""
|
|
120
120
|
|
|
121
121
|
@property
|
|
@@ -126,7 +126,7 @@ class MemoryRef(ComponentRef):
|
|
|
126
126
|
|
|
127
127
|
class ObjectStoreRef(ComponentRef):
|
|
128
128
|
"""
|
|
129
|
-
A reference to an object store in
|
|
129
|
+
A reference to an object store in a NAT configuration object.
|
|
130
130
|
"""
|
|
131
131
|
|
|
132
132
|
@property
|
|
@@ -137,7 +137,7 @@ class ObjectStoreRef(ComponentRef):
|
|
|
137
137
|
|
|
138
138
|
class RetrieverRef(ComponentRef):
|
|
139
139
|
"""
|
|
140
|
-
A reference to a retriever in
|
|
140
|
+
A reference to a retriever in a NAT configuration object.
|
|
141
141
|
"""
|
|
142
142
|
|
|
143
143
|
@property
|
|
@@ -148,7 +148,7 @@ class RetrieverRef(ComponentRef):
|
|
|
148
148
|
|
|
149
149
|
class AuthenticationRef(ComponentRef):
|
|
150
150
|
"""
|
|
151
|
-
A reference to an API Authentication Provider in
|
|
151
|
+
A reference to an API Authentication Provider in a NAT configuration object.
|
|
152
152
|
"""
|
|
153
153
|
|
|
154
154
|
@property
|
|
@@ -25,14 +25,14 @@ from pydantic import ValidationInfo
|
|
|
25
25
|
from pydantic import ValidatorFunctionWrapHandler
|
|
26
26
|
from pydantic import field_validator
|
|
27
27
|
|
|
28
|
-
from
|
|
29
|
-
from
|
|
30
|
-
from
|
|
31
|
-
from
|
|
32
|
-
from
|
|
33
|
-
from
|
|
34
|
-
from
|
|
35
|
-
from
|
|
28
|
+
from nat.data_models.evaluate import EvalConfig
|
|
29
|
+
from nat.data_models.front_end import FrontEndBaseConfig
|
|
30
|
+
from nat.data_models.function import EmptyFunctionConfig
|
|
31
|
+
from nat.data_models.function import FunctionBaseConfig
|
|
32
|
+
from nat.data_models.logging import LoggingBaseConfig
|
|
33
|
+
from nat.data_models.telemetry_exporter import TelemetryExporterBaseConfig
|
|
34
|
+
from nat.data_models.ttc_strategy import TTCStrategyBaseConfig
|
|
35
|
+
from nat.front_ends.fastapi.fastapi_front_end_config import FastApiFrontEndConfig
|
|
36
36
|
|
|
37
37
|
from .authentication import AuthProviderBaseConfig
|
|
38
38
|
from .common import HashableBaseModel
|
|
@@ -47,7 +47,7 @@ logger = logging.getLogger(__name__)
|
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
def _process_validation_error(err: ValidationError, handler: ValidatorFunctionWrapHandler, info: ValidationInfo):
|
|
50
|
-
from
|
|
50
|
+
from nat.cli.type_registry import GlobalTypeRegistry # pylint: disable=cyclic-import
|
|
51
51
|
|
|
52
52
|
new_errors = []
|
|
53
53
|
logged_once = False
|
|
@@ -151,7 +151,7 @@ class TelemetryConfig(BaseModel):
|
|
|
151
151
|
@classmethod
|
|
152
152
|
def rebuild_annotations(cls):
|
|
153
153
|
|
|
154
|
-
from
|
|
154
|
+
from nat.cli.type_registry import GlobalTypeRegistry
|
|
155
155
|
|
|
156
156
|
type_registry = GlobalTypeRegistry.get()
|
|
157
157
|
|
|
@@ -209,7 +209,7 @@ class GeneralConfig(BaseModel):
|
|
|
209
209
|
@classmethod
|
|
210
210
|
def rebuild_annotations(cls):
|
|
211
211
|
|
|
212
|
-
from
|
|
212
|
+
from nat.cli.type_registry import GlobalTypeRegistry
|
|
213
213
|
|
|
214
214
|
type_registry = GlobalTypeRegistry.get()
|
|
215
215
|
|
|
@@ -232,7 +232,7 @@ class GeneralConfig(BaseModel):
|
|
|
232
232
|
return False
|
|
233
233
|
|
|
234
234
|
|
|
235
|
-
class
|
|
235
|
+
class Config(HashableBaseModel):
|
|
236
236
|
|
|
237
237
|
model_config = ConfigDict(extra="forbid")
|
|
238
238
|
|
|
@@ -307,7 +307,7 @@ class AIQConfig(HashableBaseModel):
|
|
|
307
307
|
@classmethod
|
|
308
308
|
def rebuild_annotations(cls):
|
|
309
309
|
|
|
310
|
-
from
|
|
310
|
+
from nat.cli.type_registry import GlobalTypeRegistry
|
|
311
311
|
|
|
312
312
|
type_registry = GlobalTypeRegistry.get()
|
|
313
313
|
|
|
@@ -404,3 +404,7 @@ class AIQConfig(HashableBaseModel):
|
|
|
404
404
|
return cls.model_rebuild(force=True)
|
|
405
405
|
|
|
406
406
|
return False
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
# Compatibility aliases with previous releases
|
|
410
|
+
AIQConfig = Config
|