### Hello World Example Output Source: https://docs.nvidia.com/nemo/agent-toolkit/latest The expected output from running the Hello World example, listing five subspecies of Aardvarks. ```text Workflow Result: ['Here are five subspecies of Aardvarks: 1. Orycteropus afer afer (Southern aardvark) 2. O. a. adametzi Grote, 1921 (Western aardvark) 3. O. a. aethiopicus Sundevall, 1843 4. O. a. angolensis Zukowsky & Haltenorth, 1957 5. O. a. erikssoni Lönnberg, 1906'] ``` -------------------------------- ### Install NeMo Agent Toolkit with uv Source: https://docs.nvidia.com/nemo/agent-toolkit/latest Use uv to install the nvidia-nat package. ```bash uv pip install nvidia-nat ``` -------------------------------- ### Install NeMo Agent Toolkit with LangChain integration (uv) Source: https://docs.nvidia.com/nemo/agent-toolkit/latest Install the nvidia-nat package with the LangChain integration using uv. ```bash uv pip install "nvidia-nat[langchain]" ``` -------------------------------- ### _FastApiFrontEndController.start_server Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/fastapi_front_end_controller/index.html Starts the API server with the specified host and port. ```APIDOC ## POST /start_server ### Description Starts the API server. ### Method POST ### Endpoint /start_server ### Parameters #### Query Parameters - **host** (str) - Required - The host address for the server. - **port** (int) - Required - The port number for the server. ### Response #### Success Response (200) - **message** (str) - Indicates that the server has started successfully. #### Response Example { "message": "Server started successfully" } ``` -------------------------------- ### Install NeMo Agent Toolkit with LangChain integration (pip) Source: https://docs.nvidia.com/nemo/agent-toolkit/latest Install the nvidia-nat package with the LangChain integration using pip. ```bash pip install "nvidia-nat[langchain]" ``` -------------------------------- ### Install NeMo Agent Toolkit with pip Source: https://docs.nvidia.com/nemo/agent-toolkit/latest Use pip to install the nvidia-nat package. ```bash pip install nvidia-nat ``` -------------------------------- ### nat.cli.commands.start Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/index.html Starts services or components within the Nemo Agent Toolkit. ```APIDOC ## nat.cli.commands.start ### Description Starts specified services or components managed by the Nemo Agent Toolkit. ### Method Not specified (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters Not specified in the source text. ### Request Example Not specified in the source text. ### Response Not specified in the source text. ``` -------------------------------- ### Run Hello World Example Source: https://docs.nvidia.com/nemo/agent-toolkit/latest Execute the NeMo Agent Toolkit workflow using the 'nat' CLI with a specified configuration file and input. ```bash nat run --config_file workflow.yml --input "List five subspecies of Aardvarks" ``` -------------------------------- ### StartCommandGroup Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/commands/start/index.html Represents the 'start' command group in the Nemo Agent Toolkit CLI. It inherits from click.Group and provides methods for managing and invoking subcommands related to starting agent processes. ```APIDOC ## StartCommandGroup ### Description Represents the 'start' command group in the Nemo Agent Toolkit CLI. It inherits from click.Group and provides methods for managing and invoking subcommands related to starting agent processes. ### Methods - **invoke_subcommand(ctx: click.Context, cmd_name: str, config_file: pathlib.Path, override: tuple[tuple[str, str], ...], **kwargs) -> int | None** Invokes a subcommand within the 'start' command group. - **get_command(ctx: click.Context, cmd_name: str) -> click.Command | None** Retrieves a specific command from the command group by its name. - **list_commands(ctx: click.Context) -> list[str]** Lists all available commands within the 'start' command group. - **start_command(ctx: click.Context, **kwargs) -> None** The main command function for the 'start' group. This is likely the entry point for starting agent processes. ### Internal Methods (Not directly callable by users) - **_build_params(front_end: nat.cli.type_registry.RegisteredFrontEndInfo) -> list[click.Parameter]** Internal method to build parameters for a given front-end. - **_load_commands() -> dict[str, click.Command] | None** Internal method to load available commands. ``` -------------------------------- ### pre_run Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/console/console_front_end_plugin/index.html Asynchronous method to perform pre-run setup for the console front end plugin. ```APIDOC ## pre_run ### Description Asynchronous method to perform pre-run setup for the console front end plugin. ### Method Asynchronous function call ### Parameters None explicitly documented. ``` -------------------------------- ### register_gemini_generate_content_v1 Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/atof/index.html Installs the Gemini generateContent JSON Schema and LLM extractor for ATOF. ```APIDOC ## register_gemini_generate_content_v1 ### Description Installs the Gemini generateContent JSON Schema and LLM extractor for ATOF. ### Method None (Function Call) ### Parameters None ### Response None (None returned) ### Example ```python import nat.atof nat.atof.register_gemini_generate_content_v1() ``` ``` -------------------------------- ### setup_worker Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/async_jobs/async_job/index.html Setup function to be run in each worker process. This moves each worker into its own process group. ```APIDOC ## setup_worker ### Description Setup function to be run in each worker process. This moves each worker into its own process group. ### Method Worker Setup Function (Dask) ### Endpoint N/A (Worker Setup) ### Parameters None ``` -------------------------------- ### TrajectoryBuilder.start_run Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/index.html Starts a new training run, initializing resources and setting up the environment for trajectory building. It requires a unique run ID and optional metadata. ```APIDOC ## TrajectoryBuilder.start_run ### Description Initialize any resources needed for the trajectory builder. ### Method async ### Parameters #### Path Parameters - **run_id** (str) - Required - The unique identifier for the training run. #### Request Body - **meta** (dict | None) - Optional - Metadata associated with the training run. ### Response #### Success Response (None) Returns None upon successful start of the run. ``` -------------------------------- ### start_command Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/commands/start/index.html Initiates a NAT workflow using a provided frontend configuration. This is the primary function to start a workflow from the command line. ```APIDOC ## start_command ### Description Run a NAT workflow using a front end configuration. ### Method Not applicable (CLI command) ### Endpoint Not applicable (CLI command) ### Parameters This function does not explicitly list parameters in the provided documentation. It is assumed to take configuration details implicitly or through environment variables. ### Request Example Not applicable (CLI command) ### Response #### Success Response None (The function returns None upon successful execution). #### Response Example Not applicable (CLI command) ``` -------------------------------- ### start_run Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/interfaces/index.html Abstract method to start a run, requiring a run ID and optional metadata. Initializes resources for the trajectory builder. ```APIDOC ## start_run ### Description Initialize any resources needed for the trajectory builder. ### Method abstractmethod ### Parameters #### Path Parameters - **run_id** (str) - Required - The unique identifier for the training run. - **meta** (dict | None) - Optional - Metadata associated with the training run. ### Returns - **None** ``` -------------------------------- ### setup_worker Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/async_jobs/async_job/index.html Setup function to be run in each worker process to move workers into their own process groups, preventing premature exits during graceful cluster shutdown. ```APIDOC ## setup_worker ### Description Setup function to be run in each worker process. This moves each worker into its own process group. This fixes an issue where a `Ctrl-C` in the terminal sends a `SIGINT` to all workers, which then causes the workers to exit before the main process can shut down the cluster gracefully. ### Method N/A (Worker Setup Function) ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) None #### Response Example None ``` -------------------------------- ### Example Enumeration Definition Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/data_models/span/index.html Demonstrates how to define an enumeration class using Python's Enum. ```python class Color(Enum): RED = 1 BLUE = 2 GREEN = 3 ``` -------------------------------- ### create_command Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/commands/workflow/workflow_commands/index.html Creates a new NAT workflow using provided templates. It allows for immediate installation and includes a description for the workflow's docstring. ```APIDOC ## create_command ### Description Create a new NAT workflow using templates. This command allows specifying the workflow name, whether to install it immediately, the directory for creation, and an initial description. ### Method Not applicable (CLI command) ### Parameters #### Arguments - **workflow_name** (str) - Required - The name of the new workflow. - **install** (bool) - Required - Whether to install the workflow package immediately. - **workflow_dir** (str) - Required - The directory to create the workflow package. - **description** (str) - Required - Description to pre-populate the workflow docstring. ``` -------------------------------- ### NeMo Agent Toolkit Workflow Configuration Source: https://docs.nvidia.com/nemo/agent-toolkit/latest Define agents, tools, and workflows in a YAML file. This example configures a Wikipedia search tool, an LLM, and a ReAct agent. ```yaml functions: # Add a tool to search wikipedia wikipedia_search: _type: wiki_search max_results: 2 llms: # Tell NeMo Agent Toolkit which LLM to use for the agent nim_llm: _type: nim model_name: meta/llama-3.1-70b-instruct temperature: 0.0 workflow: # Use an agent that 'reasons' and 'acts' _type: react_agent # Give it access to our wikipedia search tool tool_names: [wikipedia_search] # Tell it which LLM to use llm_name: nim_llm # Make it verbose verbose: true # Retry up to 3 times parse_agent_response_max_retries: 3 ``` -------------------------------- ### Registering a CLI Plugin in pyproject.toml Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/plugin_loader/index.html Example of how to register a CLI command plugin using Python entry points in a pyproject.toml file. This allows the plugin loader to discover and load the commands. ```toml [project.entry-points.'nat.cli'] mcp = "nat.plugins.mcp.cli.commands:mcp_command" ``` -------------------------------- ### Example of single_output_type Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/builder/function_base/index.html Illustrates how to retrieve the single output type of a function. This is determined by the function's generic type parameters. ```python def my_function(input: int) -> list[str]: pass # The single_output_type is list[str] ``` -------------------------------- ### Example of single_output_class Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/builder/function_base/index.html Demonstrates how to get the Python class of the output type, stripping generic or annotation information. This is useful for instance checking. ```python def my_function(input: int) -> list[str]: pass # The single_output_class is list ``` -------------------------------- ### Example of single_output_schema Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/builder/function_base/index.html Shows how to obtain the Pydantic model schema for validating single outputs. If the output type is already a Pydantic model, it's returned directly. ```python from pydantic import BaseModel class SingleOutputSchema(BaseModel): value: list[str] # If a function's output is list[str], its single_output_schema would be SingleOutputSchema ``` -------------------------------- ### GET /executions/{id} Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/http_interactive_runner/index.html Polls for the status and results of a specific execution. This endpoint is intended to be called by clients polling for updates after an initial execution has been started, particularly when the execution requires interaction or OAuth. ```APIDOC ## GET /executions/{id} ### Description Retrieves the current status and outcome of a specific workflow execution identified by its ID. This endpoint is used for polling the state of an execution, especially when it has been started via `start_non_streaming()` and requires client interaction or authentication. ### Method GET ### Endpoint /executions/{id} ### Parameters #### Path Parameters - **id** (string) - Required - The unique identifier of the execution to query. ### Response #### Success Response (200 OK) - **execution_id** (string) - The ID of the execution. - **status** (string) - The current status of the execution (e.g., 'RUNNING', 'COMPLETED', 'NEEDS_INTERACTION', 'FAILED'). - **result** (object, optional) - The final result of the workflow if completed. - **error** (object, optional) - Details about any error if the execution failed. #### Response Example (200 OK - Running) ```json { "execution_id": "abc123xyz789", "status": "RUNNING" } ``` #### Response Example (200 OK - Completed) ```json { "execution_id": "abc123xyz789", "status": "COMPLETED", "result": { "output": "Final workflow result." } } ``` ``` -------------------------------- ### find_package_root() Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/commands/workflow/workflow_commands/index.html Locates the root directory of an installed Python package, particularly useful for packages installed with the 'editable' option. This function helps in resolving the installation path of a given package. ```APIDOC ## find_package_root() ### Description Find the root directory for a python package installed with the “editable” option. ### Args - **package_name** (str): The python package name as it appears when importing it into a python script. ### Returns - **pathlib.Path**: Posix path pointing to the package root. - **None**: If the package root cannot be found. ``` -------------------------------- ### finetuning_main Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/finetuning_runtime/index.html Serves as the main entry point for the finetuning runtime. It accepts a FinetuneRunConfig object that contains all necessary settings for the finetuning job. ```APIDOC ## finetuning_main ### Description Main entry point for finetuning runtime. ### Method Asynchronous function call ### Parameters #### Arguments - **run_config** (nat.data_models.finetuning.FinetuneRunConfig) - Required - FinetuneRunConfig object containing finetuning settings. ### Response Returns None upon completion. ``` -------------------------------- ### Register Gemini Generate Content V1 Extractor Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/atof/extractors/index.html Installs the Gemini generateContent JSON Schema and LLM extractor. This function is idempotent and should be called once at process startup. ```python register_gemini_generate_content_v1() ``` -------------------------------- ### Get Enum Length and List Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/llm/utils/env_config_value/index.html Illustrates how to get the number of members in an enum and convert it to a list. ```python len(Color) ``` ```python list(Color) ``` -------------------------------- ### initialize Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/interfaces/index.html Asynchronously initializes any resources needed for the trainer adapter. This is an abstract method of TrainerAdapter. ```APIDOC ## initialize ### Description Asynchronously initialize any resources needed for the trainer adapter. ### Method async ### Parameters #### Arguments - **run_config** (nat.data_models.finetuning.FinetuneConfig) - Description: The finetuning configuration. ### Returns - **None** ``` -------------------------------- ### TrainerAdapter.initialize Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/interfaces/trainer_adapter/index.html Asynchronously initializes any resources needed for the trainer adapter. This method requires a FinetuneConfig object. ```APIDOC ## TrainerAdapter.initialize ### Description Asynchronously initialize any resources needed for the trainer adapter. ### Method Asynchronous method (async) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **run_config** (nat.data_models.finetuning.FinetuneConfig) - Required - Configuration for the fine-tuning run. ### Request Example ```json { "run_config": { ... } } ``` ### Response #### Success Response (None) Returns None upon successful initialization. #### Response Example ```json null ``` ``` -------------------------------- ### record_invocation_start Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/telemetry_hook/index.html Stashes the session ID, start time, and invoked command on the Click context object. This function is safe to call unconditionally and simplifies call sites by always performing the bookkeeping, even when telemetry is disabled. ```APIDOC ## record_invocation_start ### Description Stashes the session ID, start time, and invoked command on `ctx.obj`. This function is safe to call unconditionally. It also stashes the root Click group to validate subcommand names, acting as a privacy boundary. ### Parameters * `_ctx` (click.Context) - The Click context object to attach telemetry data to. ### Returns * None ``` -------------------------------- ### run Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/interfaces/finetuning_runner/index.html Initiates and runs the complete finetuning workflow for a specified number of epochs asynchronously. Returns the status of all training jobs. ```APIDOC ## run ### Description Run the complete finetuning workflow for the specified number of epochs. ### Method async ### Parameters #### Path Parameters - **num_epochs** (int) - Required - Number of epochs to train. ### Returns - **list[nat.data_models.finetuning.TrainingJobStatus]** - Status of all training jobs. ``` -------------------------------- ### GET Streaming Raw Endpoint Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/routes/generate/index.html Builds a raw-streaming GET handler for generation tasks. This endpoint is suitable for scenarios where data needs to be streamed back in its raw format. ```APIDOC ## GET /generate/raw ### Description Builds a raw-streaming GET handler. This endpoint is designed for retrieving generation results in a raw, streamed format. ### Method GET ### Endpoint /generate/raw ### Parameters #### Query Parameters - **session_manager** (nat.runtime.session.SessionManager) - Required - Manages the session for the request. - **streaming** (bool) - Required - If true, enables streaming of results. - **result_type** (type | None) - Optional - Specifies the type of the result. - **output_type** (type | None) - Optional - Specifies the type of the output. ### Response #### Success Response (200) - The response will be a stream of raw data relevant to the generation task. ``` -------------------------------- ### setup_logging Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/entrypoint/index.html Configures the logging system for the NAT CLI with a specified log level. This function is essential for controlling the verbosity of output during CLI operations. ```APIDOC ## setup_logging ### Description Configure logging with the specified level. ### Parameters #### Arguments - **log_level** (str) - The desired logging level (e.g., 'INFO', 'DEBUG'). ``` -------------------------------- ### EvalDatasetJsonConfig.parser Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/data_models/dataset_handler/index.html Static method to get the parser for EvalDatasetJsonConfig. ```APIDOC ## Static Method EvalDatasetJsonConfig.parser() Returns a tuple containing the parser callable and a dictionary of parsing arguments. ``` -------------------------------- ### get_streaming_raw_endpoint Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/routes/generate/index.html Builds a raw-streaming GET handler for generating content. ```APIDOC ## get_streaming_raw_endpoint ### Description Builds a raw-streaming GET handler. ### Method GET ### Endpoint /generate ### Parameters #### Query Parameters - **session_manager** (object) - Required - Manages user sessions. ### Request Example ```json { "query": "What is the weather today?" } ``` ### Response #### Success Response (200) - **stream** (StreamingResponse) - A stream of generated content. ``` -------------------------------- ### initialize Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/interfaces/index.html Asynchronously initializes any resources needed for the trajectory builder. It takes a FinetuneConfig object as input. ```APIDOC ## initialize ### Description Asynchronously initialize any resources needed for the trajectory builder. ### Method async ### Parameters #### Request Body - **_run_config** (nat.data_models.finetuning.FinetuneConfig) - Required - Configuration for the finetuning process. ### Returns - **None** ``` -------------------------------- ### Get Jobs by Status Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/async_jobs/job_store/index.html Retrieves all jobs that match a specific status. ```APIDOC ## async get_jobs_by_status(status: str | JobStatus) ### Description Retrieve all jobs that have a specific status. ### Parameters #### Query Parameters - **status** (str | JobStatus) - Required - The status to filter jobs by. ### Returns #### Success Response - **list[JobInfo]** - A list of JobInfo objects matching the specified status. ``` -------------------------------- ### Trainer.run Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/interfaces/index.html Executes the complete finetuning workflow for a specified number of epochs. It returns a list of training job statuses. ```APIDOC ## Trainer.run ### Description Runs the complete finetuning workflow for the specified number of epochs. ### Method POST (inferred from async nature and job submission) ### Endpoint /nat/finetuning/interfaces/run ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **num_epochs** (int) - Required - Number of epochs to train ### Request Example ```json { "num_epochs": 5 } ``` ### Response #### Success Response (200) - **list[TrainingJobStatus]** (array) - Status of all training jobs #### Response Example ```json [ { "job_id": "abcde12345", "status": "COMPLETED" }, { "job_id": "fghij67890", "status": "RUNNING" } ] ``` ``` -------------------------------- ### Get Last Job Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/async_jobs/job_store/index.html Retrieves the most recently created job from the store. ```APIDOC ## async get_last_job() ### Description Retrieve the most recently created job. ### Returns #### Success Response - **JobInfo** or **None** - The JobInfo object for the most recently created job, or None if no jobs exist in the store. ``` -------------------------------- ### initialize Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/interfaces/finetuning_runner/index.html Initializes the finetuning runner and its associated components, including the TrajectoryBuilder and TrainerAdapter. It also verifies connectivity to backend services. ```APIDOC ## initialize ### Description Initialize the runner and its components. This should: - Initialize the TrajectoryBuilder - Initialize the TrainerAdapter - Verify connectivity to backend services ### Method async ### Parameters #### Path Parameters - **run_config** (nat.data_models.finetuning.FinetuneConfig) - Required - Configuration for the finetuning process. ### Returns - **None** ``` -------------------------------- ### Getting Enum Length Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/data_models/span/index.html Shows how to determine the number of members in an enumeration. ```python len(Color) ``` -------------------------------- ### nat.cli.entrypoint Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/index.html The main entry point for the Nemo Agent Toolkit CLI. ```APIDOC ## nat.cli.entrypoint ### Description Serves as the primary entry point for interacting with the Nemo Agent Toolkit via the command-line interface. ### Method Not specified (CLI entry point) ### Endpoint Not applicable (CLI entry point) ### Parameters Not specified in the source text. ### Request Example Not specified in the source text. ### Response Not specified in the source text. ``` -------------------------------- ### Get Function Group Configuration Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/builder/function/index.html Retrieves the configuration for the function group. ```APIDOC ## Get Configuration ### Description Returns the configuration for the function group. ### Method GET ### Endpoint `/config` ### Response #### Success Response (200) - **config** (FunctionGroupBaseConfig) - The configuration object for the function group. ``` -------------------------------- ### run_finetuning_sync Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/finetuning_runtime/index.html Provides a synchronous wrapper for running the finetuning process. It takes a FinetuneRunConfig object to configure and execute the finetuning job. ```APIDOC ## run_finetuning_sync ### Description Synchronous wrapper for running finetuning. ### Method Synchronous function call ### Parameters #### Arguments - **run_config** (nat.data_models.finetuning.FinetuneRunConfig) - Required - FinetuneRunConfig object containing finetuning settings. ### Response Returns None upon completion. ``` -------------------------------- ### cli Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/entrypoint/index.html The main entrypoint for the NAT CLI. It initializes the command-line interface, processes context, and handles logging levels. ```APIDOC ## cli ### Description Main entrypoint for the NAT CLI. ### Parameters #### Arguments - **ctx** (click.Context) - The Click context object. - **log_level** (str) - The desired logging level for the CLI session. ``` -------------------------------- ### register_anthropic_messages_v1 Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/atof/index.html Installs the Anthropic Messages JSON Schema and LLM extractor for ATOF. ```APIDOC ## register_anthropic_messages_v1 ### Description Installs the Anthropic Messages JSON Schema and LLM extractor for ATOF. ### Method None (Function Call) ### Parameters None ### Response None (None returned) ### Example ```python import nat.atof nat.atof.register_anthropic_messages_v1() ``` ``` -------------------------------- ### finetune_command Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/commands/finetune/index.html Runs the finetuning process using a specified configuration file and dataset. This command orchestrates the loading of configurations, initialization of the finetuning runner, evaluation, training submission, and progress monitoring. ```APIDOC ## finetune_command ### Description Runs finetuning based on the configuration file. This command loads the configuration, initializes the finetuning runner, runs evaluation to collect trajectories, submits trajectories for training, and monitors training progress. ### Method CLI Command ### Parameters #### Path Parameters - **config_file** (pathlib.Path) - Required - Path to the configuration file for finetuning. - **dataset** (pathlib.Path) - Required - Path to the dataset for finetuning. - **validation_dataset** (pathlib.Path) - Optional - Path to the validation dataset. - **validation_config_file** (pathlib.Path) - Optional - Path to the validation configuration file. #### Query Parameters - **result_json_path** (str) - Optional - Path to save the result JSON file. - **endpoint** (str) - Optional - The endpoint for submitting training jobs. - **endpoint_timeout** (int) - Optional - Timeout duration for the endpoint in seconds. - **validation_interval** (int) - Optional - Interval for running validation during training. #### Request Body - **processors** (tuple) - Required - Processors to be used for finetuning. - **override** (tuple[tuple[str, str], ...]) - Optional - Overrides for configuration settings. ``` -------------------------------- ### _static_ get_dynamo_field_names Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/llm/dynamo_llm/index.html Gets the set of Dynamo-specific field names for model_dump exclusion. ```APIDOC ## _static_ get_dynamo_field_names ### Description Get the set of Dynamo-specific field names for model_dump exclusion. Use this when building config dicts for framework clients to exclude Dynamo-specific parameters that should not be passed to the underlying client. ### Method staticmethod ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python config_dict = config.model_dump( exclude={"type", "thinking", *DynamoModelConfig.get_dynamo_field_names()}, ... ) ``` ### Response #### Success Response (200) - **return value** (frozenset[str]) - A frozenset of Dynamo-specific field names. #### Response Example None ``` -------------------------------- ### Get Registered Retriever Providers Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/type_registry/index.html Retrieves a list of all registered retriever providers. ```APIDOC ## get_registered_retriever_providers ### Description Retrieves a list of all registered retriever providers. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Response #### Success Response (200) - **list[RegisteredInfo[nat.data_models.retriever.RetrieverBaseConfig]]** - A list containing information about each registered retriever provider. ``` -------------------------------- ### Construct UserInfo with Basic User Credentials Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/data_models/user_info/index.html Use this to create a UserInfo object with username and password. Ensure the password is a SecretStr for security. ```python UserInfo(basic_user=BasicUserInfo(username="alice", password="s3cret")) ``` -------------------------------- ### Get Retriever Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/builder/workflow_builder/index.html Retrieves a retriever component, optionally specifying a wrapper type. ```APIDOC ## get_retriever ### Description Retrieves a retriever component, optionally specifying a wrapper type. ### Method GET (implied) ### Endpoint /api/nat/builder/workflow_builder/retriever ### Parameters #### Path Parameters None #### Query Parameters * **retriever_name** (string | RetrieverRef) - Required - The name or reference of the retriever. * **wrapper_type** (LLMFrameworkEnum) - Optional - The framework enum to specify the wrapper type. ### Request Example ```json { "retriever_name": "my_retriever", "wrapper_type": "openai" } ``` ### Response #### Success Response (200) * **Retriever** (object) - The retriever component. ``` -------------------------------- ### JobStore Initialization Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/async_jobs/index.html Initializes the JobStore for tracking and managing jobs. ```APIDOC ## JobStore ### Description Tracks and manages jobs submitted to the Dask scheduler, along with persisting job metadata in a database. ### Initialization ```python JobStore(_scheduler_address: str, _db_engine: Optional[AsyncEngine] = None, _db_url: Optional[str] = None) ``` ### Parameters - **_scheduler_address** (str) - The address of the Dask scheduler. - **_db_engine** (Optional[AsyncEngine]) - An optional SQLAlchemy AsyncEngine instance. - **_db_url** (Optional[str]) - An optional database URL for persistence. ``` -------------------------------- ### Get TTC Strategy Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/type_registry/index.html Retrieves a registered TTC strategy based on its configuration type. ```APIDOC ## get_ttc_strategy ### Description Retrieves a registered TTC strategy based on its configuration type. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config_type** (type[nat.data_models.retriever.RetrieverBaseConfig]) - Required - The configuration type of the TTC strategy. ``` -------------------------------- ### Trainer.initialize Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/index.html Asynchronously initializes the runner and its components, including the TrajectoryBuilder and TrainerAdapter, and verifies connectivity to backend services. ```APIDOC ## async initialize ### Description Initialize the runner and its components. This should: - Initialize the TrajectoryBuilder - Initialize the TrainerAdapter - Verify connectivity to backend services ### Method async ### Parameters - **run_config**: Configuration for the finetuning run. ``` -------------------------------- ### Get Tool Wrapper Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/type_registry/index.html Retrieves a registered tool wrapper based on the LLM framework. ```APIDOC ## get_tool_wrapper ### Description Retrieves a registered tool wrapper based on the LLM framework. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **llm_framework** (str) - Required - The LLM framework for which to retrieve the tool wrapper. ``` -------------------------------- ### Get Retriever Provider Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/type_registry/index.html Retrieves a registered retriever provider based on its configuration type. ```APIDOC ## get_retriever_provider ### Description Retrieves a registered retriever provider based on its configuration type. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **config_type** (type[nat.data_models.retriever.RetrieverBaseConfig]) - Required - The configuration type of the retriever provider to retrieve. ``` -------------------------------- ### JobStore Configuration and Session Management Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/async_jobs/index.html Details the parameters required for configuring the JobStore, such as scheduler address and database connection details. It also explains the async context manager for managing database sessions and transactions. ```APIDOC ## JobStore Parameters ### Description Parameters for configuring the JobStore, including the Dask scheduler address and database connection settings. ### Parameters #### Path Parameters - **scheduler_address** (str) - Required - The address of the Dask scheduler. - **db_engine** (AsyncEngine | None) - Optional - The database engine for the job store. Defaults to None. - **db_url** (str | None) - Optional - The database URL to connect to, used when db_engine is not provided. Refer to: https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls. Defaults to None. ### Constants - **MIN_EXPIRY**: Minimum expiry time for jobs. - **MAX_EXPIRY**: Maximum expiry time for jobs. - **DEFAULT_EXPIRY**: Default expiry time for jobs. - **ACTIVE_STATUS**: Status indicating an active job. ## _async_ session() ### Description Provides an asynchronous context manager for a SQLAlchemy session with automatic transaction management. It creates a new session, begins a transaction, commits on success, and rolls back on exception. ### Method Async Context Manager ### Yields AsyncSession - An active SQLAlchemy async session with an open transaction. ## ensure_job_id(job_id: str | None) ### Description Ensures that a job ID is provided, generating a new one if necessary. If a job ID is supplied, it is returned without modification. ### Method Function ### Parameters #### Path Parameters - **job_id** (str | None) - Optional - The job ID to ensure. If None, a new ID will be generated. Defaults to None. ``` -------------------------------- ### Config.print_summary Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/data_models/config/index.html Prints a summary of the current configuration to the specified output stream. ```APIDOC ## Config.print_summary ### Description Prints a summary of the configuration. ### Method N/A (This is a method call, not an HTTP endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python config.print_summary(stream=sys.stdout) ``` ### Response #### Success Response (200) None (This method prints to a stream, it does not return a value in the typical sense). #### Response Example None ``` -------------------------------- ### Get Object Store Configuration Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/builder/workflow_builder/index.html Retrieves the configuration for a specified object store component. ```APIDOC ## get_object_store_config ### Description Retrieves the configuration for a specified object store component. ### Method GET (implied) ### Endpoint /api/nat/builder/workflow_builder/object_store_config ### Parameters #### Path Parameters None #### Query Parameters * **object_store_name** (string | ObjectStoreRef) - Required - The name or reference of the object store. ### Request Example ```json { "object_store_name": "my_object_store" } ``` ### Response #### Success Response (200) * **ObjectStoreBaseConfig** (object) - The configuration object for the object store. ``` -------------------------------- ### Get Object Store Client Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/builder/workflow_builder/index.html Retrieves the client for a specified object store component. ```APIDOC ## get_object_store_client ### Description Retrieves the client for a specified object store component. ### Method GET (implied) ### Endpoint /api/nat/builder/workflow_builder/object_store_client ### Parameters #### Path Parameters None #### Query Parameters * **object_store_name** (string | ObjectStoreRef) - Required - The name or reference of the object store. ### Request Example ```json { "object_store_name": "my_object_store" } ``` ### Response #### Success Response (200) * **ObjectStore** (object) - An interface to the object store client. ``` -------------------------------- ### run_finetuning Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/finetuning/finetuning_runtime/index.html Runs the finetuning process asynchronously using a provided Trainer instance. This function orchestrates the training based on the configuration provided by the runner. ```APIDOC ## run_finetuning ### Description Runs finetuning based on the provided configuration. ### Method Asynchronous function call ### Parameters #### Arguments - **runner** (nat.finetuning.interfaces.finetuning_runner.Trainer) - Required - An instance of the Trainer to run finetuning with. ### Response Returns None upon completion. ``` -------------------------------- ### get_streaming_endpoint Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/routes/common_utils/index.html Builds a handler for a streaming GET endpoint, supporting various result and output types. ```APIDOC ## get_streaming_endpoint ### Description Build a streaming GET handler. ### Method Not applicable (utility for building handlers) ### Parameters - **_worker** (Any) - The worker object. - **_session_manager** (nat.runtime.session.SessionManager) - The session manager instance. - **_streaming** (bool) - Flag indicating if the endpoint should stream. - **_result_type** (type | None) - The expected type of the result. - **_output_type** (type | None) - The expected type of the output. ``` -------------------------------- ### Finetuning Data Models Overview Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/data_models/finetuning/index.html This section provides an overview of the data models available for finetuning. These models define the configurations and structures used throughout the finetuning process. ```APIDOC ## Data Models for Finetuning This page documents the classes used for configuring and representing data during the finetuning process. ### Classes - **`RewardFunctionConfig`**: Configuration for the reward function. - **`TrainerConfig`**: Base configuration for the Trainer. - **`TrajectoryBuilderConfig`**: Configuration for the trajectory collector. - **`TrainerAdapterConfig`**: Configuration for the trainer adapter. - **`TrainingJobRef`**: A reference to a training job. - **`TrainingStatusEnum`**: Enum where members are also (and must be) strings, representing training job status. - **`TrainingJobStatus`**: The status of a training job. - **`EpisodeItemRole`**: Enum where members are also (and must be) strings, defining roles within an episode item. - **`EpisodeItem`**: A single step in an episode. - **`OpenAIMessage`**: A message in the OpenAI chat format. - **`DPOItem`**: A single step in an episode for DPO training. - **`Trajectory`**: A trajectory is a sequence of states, actions, and rewards. - **`TrajectoryCollection`**: A collection of trajectories. - **`CurriculumLearningConfig`**: Configuration for curriculum learning in fine-tuning. - **`FinetuneRunConfig`**: CLI Args for running finetuning and configuring. - **`FinetuneConfig`**: Parameters used for a Trainer run. ``` -------------------------------- ### Get Job Status Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/async_jobs/job_store/index.html Retrieves the current status of a specific job using its unique identifier. ```APIDOC ## async get_status(job_id: str) ### Description Get the current status of a specific job. ### Parameters #### Path Parameters - **job_id** (str) - Required - The unique identifier of the job. ### Returns #### Success Response - **JobStatus** - The current status of the job, or JobStatus.NOT_FOUND if the job does not exist in the store. ``` -------------------------------- ### post_streaming_atif_endpoint Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/routes/generate/index.html Builds an experimental POST handler that streams ATIF-formatted steps. ```APIDOC ## post_streaming_atif_endpoint ### Description Builds an experimental POST handler that streams ATIF-formatted steps. ### Method POST ### Endpoint /generate/atif ### Parameters #### Request Body - **worker** (object) - Required - The worker instance to use for generation. ### Request Example ```json { "prompt": "Plan a trip to Paris." } ``` ### Response #### Success Response (200) - **stream** (StreamingResponse) - A stream of ATIF-formatted steps. ``` -------------------------------- ### get Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/execution_store/index.html Retrieves an execution record by its ID. Returns the ExecutionRecord if found, otherwise returns None. ```APIDOC ## get ### Description Retrieve an execution record by its ID. ### Method GET ### Endpoint /executions/{execution_id} ### Parameters #### Path Parameters - **execution_id** (string) - Required - The unique identifier of the execution to retrieve. ### Response #### Success Response (200) - **execution**: object - The ExecutionRecord if found. #### Error Response (404) - **message**: string - "Execution not found." ### Response Example ```json { "execution_id": "exec_12345", "status": "running", "result": null } ``` ``` -------------------------------- ### DynamoPrefixContext._get_or_create_depth_map Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/llm/dynamo_llm/index.html Gets or creates the depth to prefix ID mapping for the current context. This is an internal helper method. ```APIDOC ## DynamoPrefixContext._get_or_create_depth_map ### Description Get or create the depth -> prefix_id mapping for this context. This is an internal helper method. ### Method Class Method ### Endpoint (N/A - This is a Python class method, not an HTTP endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters None ### Request Example ```python # This is an internal method, direct usage is not recommended. # Example of how it might be called internally: depth_map = DynamoPrefixContext._get_or_create_depth_map() ``` ### Response #### Success Response * **depth_map** (dict[int, str]) - A dictionary mapping call stack depth to prefix IDs. #### Response Example ```json { "example": { "0": "eval-q001-abc123", "1": "nested-prefix-id" } } ``` ### Error Handling (Details not specified in source) ``` -------------------------------- ### get_single_endpoint Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/front_ends/fastapi/routes/common_utils/index.html Builds a handler for a single-response GET endpoint, suitable for use with Dask workers and session management. ```APIDOC ## get_single_endpoint ### Description Build a single-response GET handler. ### Method Not applicable (utility for building handlers) ### Parameters - **_worker** (Any) - The worker object. - **_session_manager** (nat.runtime.session.SessionManager) - The session manager instance. - **_result_type** (type | None) - The expected type of the result. ``` -------------------------------- ### WorkflowRuntimeMetrics Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/data_models/evaluate_runtime/index.html Summarizes workflow runtimes across evaluation examples, focusing on p90, p95, and p99 latency. ```APIDOC ## Class WorkflowRuntimeMetrics ### Description Summarizes workflow runtimes across evaluation examples, focusing on p90, p95, and p99 latency. Create a new model by parsing and validating input data from keyword arguments. Raises [`ValidationError`](https://docs.pydantic.dev/latest/api/error_types/#pydantic_core.ValidationError) if the input data cannot be validated to form a valid model. `self` is explicitly positional-only to allow `self` as a field name. ### Attributes - **p90** (float) - The 90th percentile workflow runtime. - **p95** (float) - The 95th percentile workflow runtime. - **p99** (float) - The 99th percentile workflow runtime. ``` -------------------------------- ### MultiLLMPlanner.ainvoke Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/experimental/test_time_compute/search/multi_llm_planner/index.html Asynchronously generates a list of PlanningItems by querying each LLM bound to the planner. It allows for parallel plan generation and can optionally use an original prompt and agent context. ```APIDOC ## ainvoke ### Description Asynchronously generates a list of PlanningItems by querying each LLM bound to the planner. Each LLM produces a set number of plans. ### Method async def ainvoke( self, items: list[nat.experimental.test_time_compute.models.ttc_item.TTCItem], original_prompt: str | None = None, agent_context: str | None = None, **kwargs_ ) -> list[nat.experimental.test_time_compute.models.ttc_item.TTCItem] ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **items** (list[nat.experimental.test_time_compute.models.ttc_item.TTCItem]) - Required - A list of TTCItems to process. - **original_prompt** (str | None) - Optional - The original prompt used for generation. - **agent_context** (str | None) - Optional - The context of the agent. - **kwargs_** - Additional keyword arguments. ### Request Example ```json { "items": [ { "id": "item1", "prompt": "Plan for task A" } ], "original_prompt": "User request: complete task A", "agent_context": "User is logged in" } ``` ### Response #### Success Response (200) - **list[nat.experimental.test_time_compute.models.ttc_item.TTCItem]** - A list of generated TTCItems representing the plans. ``` -------------------------------- ### InferenceMetricsModel Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/data_models/evaluate_runtime/index.html Represents inference metrics for evaluation examples, including counts, mean, and various interval statistics. ```APIDOC ## Class InferenceMetricsModel ### Description Represents inference metrics for evaluation examples, including counts, mean, and various interval statistics. ### Attributes - **n** (int) - The total number of examples. - **mean** (float) - The average value. - **ninetieth_interval** (tuple[float, float]) - The 90th percentile confidence interval. - **ninety_fifth_interval** (tuple[float, float]) - The 95th percentile confidence interval. - **ninety_ninth_interval** (tuple[float, float]) - The 99th percentile confidence interval. - **p90** (float) - The 90th percentile value. - **p95** (float) - The 95th percentile value. - **p99** (float) - The 99th percentile value. ``` -------------------------------- ### _create_httpx_client_with_dynamo_hooks Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/llm/dynamo_llm/index.html Creates an httpx.AsyncClient. If config.enable_nvext_hints is True, it injects Dynamo hints via a custom transport. ```APIDOC ## _create_httpx_client_with_dynamo_hooks ### Description Creates an httpx.AsyncClient with Dynamo hint injection capabilities when `config.enable_nvext_hints` is enabled. ### Function Signature `_create_httpx_client_with_dynamo_hooks() -> httpx.AsyncClient` ### Returns - `httpx.AsyncClient`: An asynchronous HTTP client instance configured with Dynamo hooks. ``` -------------------------------- ### _create_http_client Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/llm/utils/http_client/index.html Internal function to create an httpx client (sync or async) based on LLM configuration. ```APIDOC ## _create_http_client ### Description Create an httpx client with timeout and verify setting based on LLM configuration parameters. ### Method Internal Function ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```python # This is an internal function and not intended for direct use. # Example usage within the library: from nat.llm.utils.http_client import _create_http_client from nat.data_models.llm import LLMBaseConfig llm_config = LLMBaseConfig(...) # To create an async client: async_client = _create_http_client(llm_config, _use_async=True) # To create a sync client: sync_client = _create_http_client(llm_config, _use_async=False) ``` ### Response #### Success Response (200) An httpx.AsyncClient or httpx.Client instance. #### Response Example ```python # Returns an httpx.Client or httpx.AsyncClient object # or ``` ``` -------------------------------- ### get_version Source: https://docs.nvidia.com/nemo/agent-toolkit/latest/api/nat/cli/entrypoint/index.html Retrieves the current version of the NAT CLI. This function is useful for verifying the installed version or for reporting purposes. ```APIDOC ## get_version ### Description Get the version of the NAT CLI. ### Parameters This function takes no parameters. ```