Add E2E test for the simple calculator HITL example#984
Add E2E test for the simple calculator HITL example#984rapids-bot[bot] merged 14 commits intoNVIDIA:release/1.3from
Conversation
Signed-off-by: David Gardner <dagardner@nvidia.com>
…e exceptions without messages Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
Signed-off-by: David Gardner <dagardner@nvidia.com>
WalkthroughAdds a prompt field validator to HITLApprovalFnConfig to strip whitespace after validation. Adds a new async, parametrized integration test that runs the NAT CLI for the simple calculator HITL example, supplies confirmation via stdin, and asserts exit code and expected outputs. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (4)**/*.{py,yaml,yml}📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)
Files:
**/*.py📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)
Files:
**/*⚙️ CodeRabbit configuration file
Files:
examples/**/*⚙️ CodeRabbit configuration file
Files:
🧬 Code graph analysis (1)examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py (2)
🪛 Ruff (0.14.0)examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py38-38: (S603) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Signed-off-by: David Gardner <dagardner@nvidia.com>
…to david-simple-calc-hitl Signed-off-by: David Gardner <dagardner@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
examples/HITL/por_to_jiratickets/README.md (1)
81-84: Fix README reference for HITL approval function
Replace the path tohitl_approval_tool.pyinstead ofjira_tickets_tool.pyin the example documentation.
🧹 Nitpick comments (5)
examples/HITL/por_to_jiratickets/README.md (1)
20-21: Brand casing consistency: “NeMo Agent Toolkit”.Use “NeMo Agent Toolkit” (capital T) in docs to match naming guidance.
As per coding guidelines
Also applies to: 53-55
examples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.py (1)
41-58: Prompt trimming LGTM; consider minor robustness and typing.
- Move
import reto module scope.- Guard
response.content.textto avoid attr/None errors.- Add return type + function docstring per guidelines.
As per coding guidelines
@@ -import re +import re @@ -@register_function(config_type=HITLApprovalFnConfig) -async def hitl_approval_function(config: HITLApprovalFnConfig, builder: Builder): +@register_function(config_type=HITLApprovalFnConfig) +async def hitl_approval_function(config: HITLApprovalFnConfig, builder: Builder) -> "AsyncGenerator[FunctionInfo, None]": + """Prompt the user for approval and return True only on an explicit 'yes'.""" @@ - prompt = f"{config.prompt.strip()} Please confirm if you would like to proceed. Respond with 'yes' or 'no'." + prompt = f"{config.prompt.strip()} Please confirm if you would like to proceed. Respond with 'yes' or 'no'." @@ - response: InteractionResponse = await user_input_manager.prompt_user_input(human_prompt_text) - response_str = response.content.text.lower() # type: ignore + response: InteractionResponse = await user_input_manager.prompt_user_input(human_prompt_text) + response_text = getattr(getattr(response, "content", None), "text", "") or "" + response_str = response_text.lower() @@ yield FunctionInfo.from_fn(_arun, description=("This function will be used to get the user's response to the prompt"))Add at top of file (imports section):
+from typing import AsyncGeneratorexamples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py (3)
35-38: Fix typo in comment.“usign” → “using”.
-# Use subprocess to run the NAT CLI rather than usign the API for two reasons: +# Use subprocess to run the NAT CLI rather than using the API for two reasons:
38-41: Harden subprocess invocation and input.
- Remove superfluous quotes around the --input value (quotes are for shell parsing).
- Set shell=False explicitly, and pin encoding for deterministic behavior.
Also OK per Ruff S603: no untrusted input and shell=False.
-cmd = ["nat", "run", "--config_file", str(config_file.absolute()), "--input", '"Is 2 * 4 greater than 5?"'] -proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) +cmd = ["nat", "run", "--config_file", str(config_file.absolute()), "--input", "Is 2 * 4 greater than 5?"] +proc = subprocess.Popen( + cmd, + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + text=True, + encoding="utf-8", + errors="replace", + shell=False, +)
44-47: Make result assertion robust (escape regex, search both streams).“Workflow Result:” may be on stdout depending on env/log config; escape expected_result to avoid regex pitfalls.
-assert re.search(f"Workflow Result:.*{expected_result}", stderr, (re.IGNORECASE | re.MULTILINE | re.DOTALL)) is not None, \ - f"Expected result '{expected_result}' not found in stderr: {stderr}" +pattern = r"Workflow Result:.*" + re.escape(expected_result) +combined = (stdout or "") + (stderr or "") +assert re.search(pattern, combined, re.IGNORECASE | re.MULTILINE | re.DOTALL) is not None, \ + f"Expected result '{expected_result}' not found.\nstdout:\n{stdout}\n\nstderr:\n{stderr}"
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
examples/HITL/por_to_jiratickets/README.md(1 hunks)examples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.py(1 hunks)examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/README.@(md|ipynb)
📄 CodeRabbit inference engine (.cursor/rules/general.mdc)
Ensure READMEs follow the naming convention; avoid deprecated names; use “NeMo Agent Toolkit” (capital T) in headings
Files:
examples/HITL/por_to_jiratickets/README.md
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
examples/HITL/por_to_jiratickets/README.mdexamples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.pyexamples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.py
examples/**/*
⚙️ CodeRabbit configuration file
examples/**/*: - This directory contains example code and usage scenarios for the toolkit, at a minimum an example should
contain a README.md or file README.ipynb.
- If an example contains Python code, it should be placed in a subdirectory named
src/and should
contain apyproject.tomlfile. Optionally, it might also contain scripts in ascripts/directory.- If an example contains YAML files, they should be placed in a subdirectory named
configs/. - If an example contains sample data files, they should be placed in a subdirectory nameddata/, and should
be checked into git-lfs.
Files:
examples/HITL/por_to_jiratickets/README.mdexamples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.pyexamples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.py
**/*.{py,yaml,yml}
📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)
**/*.{py,yaml,yml}: Configure response_seq as a list of strings; values cycle per call, and [] yields an empty string.
Configure delay_ms to inject per-call artificial latency in milliseconds for nat_test_llm.
Files:
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.pyexamples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.py
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)
**/*.py: Programmatic use: create TestLLMConfig(response_seq=[...], delay_ms=...), add with builder.add_llm("", cfg).
When retrieving the test LLM wrapper, use builder.get_llm(name, wrapper_type=LLMFrameworkEnum.) and call the framework’s method (e.g., ainvoke, achat, call).
**/*.py: In code comments/identifiers use NAT abbreviations as specified: nat for API namespace/CLI, nvidia-nat for package name, NAT for env var prefixes; do not use these abbreviations in documentation
Follow PEP 20 and PEP 8; run yapf with column_limit=120; use 4-space indentation; end files with a single trailing newline
Run ruff check --fix as linter (not formatter) using pyproject.toml config; fix warnings unless explicitly ignored
Respect naming: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
Treat pyright warnings as errors during development
Exception handling: use bare raise to re-raise; log with logger.error() when re-raising to avoid duplicate stack traces; use logger.exception() when catching without re-raising
Provide Google-style docstrings for every public module, class, function, and CLI command; first line concise and ending with a period; surround code entities with backticks
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work; profile CPU-heavy paths with cProfile or mprof before optimizing; cache expensive computations with functools.lru_cache or external cache; leverage NumPy vectorized operations when beneficial
Files:
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.pyexamples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.py
🧬 Code graph analysis (1)
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py (2)
packages/nvidia_nat_test/src/nat/test/utils.py (1)
locate_example_config(56-67)examples/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.py (2)
retry_react_agent(55-221)RetryReactAgentConfig(36-51)
🪛 Ruff (0.14.0)
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
39-39: subprocess call: check for execution of untrusted input
(S603)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: CI Pipeline / Check
🔇 Additional comments (1)
examples/HITL/por_to_jiratickets/README.md (1)
91-91: Whitespace trim fix is correct.Using config.prompt.strip() prevents stray newlines in the HITL prompt.
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
Outdated
Show resolved
Hide resolved
…tor_hitl.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: David Gardner <96306125+dagardner-nv@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py (2)
28-28: Add return type hint for completeness.Per coding guidelines, all functions should include return type hints. Test functions implicitly return
None.Apply this diff:
-def test_hitl_workflow(response: str, expected_result: str): +def test_hitl_workflow(response: str, expected_result: str) -> None:As per coding guidelines.
45-46: Escape expected_result in regex pattern for robustness.The current pattern interpolates
expected_resultdirectly without escaping, which works for the current test values but would break if a future test case includes regex metacharacters (e.g., "2+2=4" where+is a regex quantifier).Apply this diff:
- assert re.search(f"Workflow Result:.*{expected_result}", stderr, (re.IGNORECASE | re.MULTILINE | re.DOTALL)) is not None, \ + assert re.search(f"Workflow Result:.*{re.escape(expected_result)}", stderr, (re.IGNORECASE | re.MULTILINE | re.DOTALL)) is not None, \ f"Expected result '{expected_result}' not found in stderr: {stderr}"
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{py,yaml,yml}
📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)
**/*.{py,yaml,yml}: Configure response_seq as a list of strings; values cycle per call, and [] yields an empty string.
Configure delay_ms to inject per-call artificial latency in milliseconds for nat_test_llm.
Files:
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)
**/*.py: Programmatic use: create TestLLMConfig(response_seq=[...], delay_ms=...), add with builder.add_llm("", cfg).
When retrieving the test LLM wrapper, use builder.get_llm(name, wrapper_type=LLMFrameworkEnum.) and call the framework’s method (e.g., ainvoke, achat, call).
**/*.py: In code comments/identifiers use NAT abbreviations as specified: nat for API namespace/CLI, nvidia-nat for package name, NAT for env var prefixes; do not use these abbreviations in documentation
Follow PEP 20 and PEP 8; run yapf with column_limit=120; use 4-space indentation; end files with a single trailing newline
Run ruff check --fix as linter (not formatter) using pyproject.toml config; fix warnings unless explicitly ignored
Respect naming: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
Treat pyright warnings as errors during development
Exception handling: use bare raise to re-raise; log with logger.error() when re-raising to avoid duplicate stack traces; use logger.exception() when catching without re-raising
Provide Google-style docstrings for every public module, class, function, and CLI command; first line concise and ending with a period; surround code entities with backticks
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work; profile CPU-heavy paths with cProfile or mprof before optimizing; cache expensive computations with functools.lru_cache or external cache; leverage NumPy vectorized operations when beneficial
Files:
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
examples/**/*
⚙️ CodeRabbit configuration file
examples/**/*: - This directory contains example code and usage scenarios for the toolkit, at a minimum an example should
contain a README.md or file README.ipynb.
- If an example contains Python code, it should be placed in a subdirectory named
src/and should
contain apyproject.tomlfile. Optionally, it might also contain scripts in ascripts/directory.- If an example contains YAML files, they should be placed in a subdirectory named
configs/. - If an example contains sample data files, they should be placed in a subdirectory nameddata/, and should
be checked into git-lfs.
Files:
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
🧬 Code graph analysis (1)
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py (2)
packages/nvidia_nat_test/src/nat/test/utils.py (1)
locate_example_config(56-67)examples/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.py (2)
retry_react_agent(55-221)RetryReactAgentConfig(36-51)
🪛 Ruff (0.14.0)
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
38-38: subprocess call: check for execution of untrusted input
(S603)
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
Outdated
Show resolved
Hide resolved
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
Show resolved
Hide resolved
Signed-off-by: David Gardner <dagardner@nvidia.com>
…tor_hitl.py Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: David Gardner <96306125+dagardner-nv@users.noreply.github.com>
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (1)
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py (1)
37-37: Remove literal double quotes from the--inputargument value.The command construction still includes literal double quotes that will be passed as part of the input string to the NAT CLI. Since the command is passed as a list to
subprocess.Popen(not usingshell=True), shell quote processing doesn't occur, and the quotes become part of the actual input value. This issue was flagged in a previous review but remains unresolved.Apply this diff:
- cmd = ["nat", "run", "--config_file", str(config_file.absolute()), "--input", '"Is 2 * 4 greater than 5?"'] + cmd = ["nat", "run", "--config_file", str(config_file.absolute()), "--input", "Is 2 * 4 greater than 5?"]
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
examples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.py(2 hunks)examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{py,yaml,yml}
📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)
**/*.{py,yaml,yml}: Configure response_seq as a list of strings; values cycle per call, and [] yields an empty string.
Configure delay_ms to inject per-call artificial latency in milliseconds for nat_test_llm.
Files:
examples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.pyexamples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
**/*.py
📄 CodeRabbit inference engine (.cursor/rules/nat-test-llm.mdc)
**/*.py: Programmatic use: create TestLLMConfig(response_seq=[...], delay_ms=...), add with builder.add_llm("", cfg).
When retrieving the test LLM wrapper, use builder.get_llm(name, wrapper_type=LLMFrameworkEnum.) and call the framework’s method (e.g., ainvoke, achat, call).
**/*.py: In code comments/identifiers use NAT abbreviations as specified: nat for API namespace/CLI, nvidia-nat for package name, NAT for env var prefixes; do not use these abbreviations in documentation
Follow PEP 20 and PEP 8; run yapf with column_limit=120; use 4-space indentation; end files with a single trailing newline
Run ruff check --fix as linter (not formatter) using pyproject.toml config; fix warnings unless explicitly ignored
Respect naming: snake_case for functions/variables, PascalCase for classes, UPPER_CASE for constants
Treat pyright warnings as errors during development
Exception handling: use bare raise to re-raise; log with logger.error() when re-raising to avoid duplicate stack traces; use logger.exception() when catching without re-raising
Provide Google-style docstrings for every public module, class, function, and CLI command; first line concise and ending with a period; surround code entities with backticks
Validate and sanitize all user input, especially in web or CLI interfaces
Prefer httpx with SSL verification enabled by default and follow OWASP Top-10 recommendations
Use async/await for I/O-bound work; profile CPU-heavy paths with cProfile or mprof before optimizing; cache expensive computations with functools.lru_cache or external cache; leverage NumPy vectorized operations when beneficial
Files:
examples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.pyexamples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
**/*
⚙️ CodeRabbit configuration file
**/*: # Code Review Instructions
- Ensure the code follows best practices and coding standards. - For Python code, follow
PEP 20 and
PEP 8 for style guidelines.- Check for security vulnerabilities and potential issues. - Python methods should use type hints for all parameters and return values.
Example:def my_function(param1: int, param2: str) -> bool: pass- For Python exception handling, ensure proper stack trace preservation:
- When re-raising exceptions: use bare
raisestatements to maintain the original stack trace,
and uselogger.error()(notlogger.exception()) to avoid duplicate stack trace output.- When catching and logging exceptions without re-raising: always use
logger.exception()
to capture the full stack trace information.Documentation Review Instructions - Verify that documentation and comments are clear and comprehensive. - Verify that the documentation doesn't contain any TODOs, FIXMEs or placeholder text like "lorem ipsum". - Verify that the documentation doesn't contain any offensive or outdated terms. - Verify that documentation and comments are free of spelling mistakes, ensure the documentation doesn't contain any
words listed in the
ci/vale/styles/config/vocabularies/nat/reject.txtfile, words that might appear to be
spelling mistakes but are listed in theci/vale/styles/config/vocabularies/nat/accept.txtfile are OK.Misc. - All code (except .mdc files that contain Cursor rules) should be licensed under the Apache License 2.0,
and should contain an Apache License 2.0 header comment at the top of each file.
- Confirm that copyright years are up-to date whenever a file is changed.
Files:
examples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.pyexamples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
examples/**/*
⚙️ CodeRabbit configuration file
examples/**/*: - This directory contains example code and usage scenarios for the toolkit, at a minimum an example should
contain a README.md or file README.ipynb.
- If an example contains Python code, it should be placed in a subdirectory named
src/and should
contain apyproject.tomlfile. Optionally, it might also contain scripts in ascripts/directory.- If an example contains YAML files, they should be placed in a subdirectory named
configs/. - If an example contains sample data files, they should be placed in a subdirectory nameddata/, and should
be checked into git-lfs.
Files:
examples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.pyexamples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
🧬 Code graph analysis (1)
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py (2)
packages/nvidia_nat_test/src/nat/test/utils.py (1)
locate_example_config(56-67)examples/HITL/simple_calculator_hitl/src/nat_simple_calculator_hitl/retry_react_agent.py (2)
retry_react_agent(55-221)RetryReactAgentConfig(36-51)
🪛 Ruff (0.14.0)
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
38-38: subprocess call: check for execution of untrusted input
(S603)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: CI Pipeline / Check
🔇 Additional comments (2)
examples/HITL/por_to_jiratickets/src/nat_por_to_jiratickets/hitl_approval_tool.py (1)
19-19: LGTM! Field validator correctly strips whitespace from prompt.The addition of the
field_validatorfor thepromptfield properly addresses the issue mentioned in the PR objectives where an extra\nwas being inserted in the HITL prompt. The implementation follows Pydantic 2.x best practices usingmode="after"and@classmethoddecorator.Also applies to: 40-43
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py (1)
38-38: Subprocess security warning is a false positive.The static analysis tool flags this line with S603 (subprocess call with untrusted input). However, all command elements are either literals or controlled paths from
locate_example_config, so there's no actual security risk here. This warning can be safely ignored in this context.
examples/HITL/simple_calculator_hitl/tests/test_simple_calculator_hitl.py
Show resolved
Hide resolved
Signed-off-by: David Gardner <dagardner@nvidia.com>
…-nv/AIQtoolkit into david-simple-calc-hitl Signed-off-by: David Gardner <dagardner@nvidia.com>
|
/merge |
Description
\nwas being inserted int the HITL prompt due the was the prompt was defined in the YAML.By Submitting this PR I confirm:
Summary by CodeRabbit
Bug Fixes
Tests