Skip to content

Conversation

@nv-pranjald
Copy link

@nv-pranjald nv-pranjald commented Jan 14, 2026

Description

Closes

By Submitting this PR I confirm:

  • I am familiar with the Contributing Guidelines.
  • We require that all contributors "sign-off" on their commits. This certifies that the contribution is your original work, or you have rights to submit it under the same license, or a compatible license.
    • Any contribution which contains commits that are not Signed-Off will not be accepted.
  • When the PR is ready for review, new or existing tests cover these changes.
  • When the PR is ready for review, the documentation is up to date with these changes.

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced NVIDIA RAG Plugin with semantic search and query functionality for NeMo Agent Toolkit.
    • Added vector database integration with embedding endpoints and knowledge base support.
  • Documentation

    • Added comprehensive README with setup, configuration, and troubleshooting guidance.
    • Included sample YAML configurations and usage examples.

✏️ Tip: You can customize this high-level summary in your review settings.

- Move nvidia_rag wheel to vendor/ directory
- Update pyproject.toml to use relative path for vendored dependency
- Add comprehensive README with installation and usage instructions
@nv-pranjald nv-pranjald requested a review from a team as a code owner January 14, 2026 16:06
@copy-pr-bot
Copy link

copy-pr-bot bot commented Jan 14, 2026

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

Walkthrough

Introduces a complete NVIDIA NAT RAG Plugin package for NeMo Agent Toolkit, including Apache 2.0 licensing, comprehensive documentation, packaging configuration, and implementations of semantic search and query tools that integrate with NVIDIA RAG and vector databases.

Changes

Cohort / File(s) Summary
Documentation & Licensing
LICENSE.md, README.md, src/nat/meta/pypi.md
New documentation files covering Apache 2.0 license terms, installation/usage guides, prerequisites, configuration examples, and PyPI package description for the RAG plugin.
Packaging Configuration
pyproject.toml
New Python packaging metadata including project dependencies, build system configuration, version management via setuptools_scm, entry point registration for nat.components, and workspace vendor paths.
RAG Plugin Core
src/nat/plugins/rag/__init__.py, src/nat/plugins/rag/rag_functions.py, src/nat/plugins/rag/register.py
New RAG plugin implementation with two public tool configs (NvidiaRAGQueryConfig, NvidiaRAGSearchConfig) and corresponding registered async functions (nvidia_rag_query, nvidia_rag_search) for vector database querying and semantic search.
RAG Configuration
src/nat/plugins/rag/configs/config.yml
New sample YAML workflow configuration defining RAG tools, Nim-based LLM, and reactive agent setup with retry policies.

Sequence Diagram(s)

sequenceDiagram
    participant Workflow as NeMo Workflow
    participant Tool as RAG Tool<br/>(rag_query)
    participant RAGClient as NvidiaRAG Client
    participant VDB as Vector Database
    participant LLM as LLM

    Workflow->>Tool: invoke with query config
    Tool->>RAGClient: initialize from YAML config
    RAGClient->>VDB: connect to vector DB
    Workflow->>Tool: send user query
    Tool->>RAGClient: execute query
    RAGClient->>VDB: semantic search + retrieval
    VDB-->>RAGClient: matching documents/context
    RAGClient->>LLM: prompt with retrieved context + query
    LLM-->>RAGClient: generated response (streaming JSON)
    RAGClient-->>Tool: aggregated response chunks
    Tool-->>Workflow: final generated content
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title check ❓ Inconclusive The title uses 'draft:' prefix and non-standard case, making it unclear if this is the final intended title or a work-in-progress placeholder. Remove the 'draft:' prefix and use consistent casing (e.g., 'Add NVIDIA NAT RAG plugin' or 'feat: add NVIDIA NAT RAG plugin') for a clear, descriptive title in imperative mood.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🤖 Fix all issues with AI agents
In `@packages/nvidia_nat_rag/pyproject.toml`:
- Around line 16-18: Add "nvidia-nat-rag" to the dependencies list in
packages/nvidia_nat_all/pyproject.toml: locate the [project].dependencies array
and insert the package name "nvidia-nat-rag" into the sorted list so it appears
between "nvidia-nat-profiling" and "nvidia-nat-redis", preserving the existing
formatting and quoting style used for other dependency entries.
- Around line 19-27: The dependency entry "langchain_classic" is missing a
minimum version; update the dependencies list by replacing "langchain_classic"
with a pinned minimum using the ~= format (e.g., "langchain_classic~=X.Y") per
the file's guideline comment so all packages have a defined minimum version and
remain sorted with the other entries.

In `@packages/nvidia_nat_rag/README.md`:
- Around line 1-3: Add the SPDX Apache-2.0 license header to the top of the
README and update the title to avoid the "NAT" acronym; change "NVIDIA NAT RAG
Plugin" to "NVIDIA NeMo Agent Toolkit RAG Plugin" (or use the package reference
`nvidia-nat-rag` in backticks when mentioning the package) so the file includes
the required license header and follows naming conventions.

In `@packages/nvidia_nat_rag/src/nat/meta/pypi.md`:
- Around line 1-35: Add the standard SPDX Apache-2.0 header to the very top of
packages/nvidia_nat_rag/src/nat/meta/pypi.md (so every file begins with the
required license marker), and update the phrase "Add the RAG tools to your NAT
workflow configuration" to spell out "NeMo Agent Toolkit" or use a code literal
(e.g., `nat`)—ensure the usage is consistent with other docs and the YAML
example remains unchanged.

In `@packages/nvidia_nat_rag/src/nat/plugins/rag/configs/config.yml`:
- Around line 1-6: Add the SPDX Apache-2.0 license header to the top of
config.yml: insert the standard single-line SPDX identifier
"SPDX-License-Identifier: Apache-2.0" (and optionally the full Apache-2.0 header
block if your project prefers) as the first line(s) of the YAML file so the file
complies with the repository's licensing guidelines.

In `@packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py`:
- Around line 117-119: In the except block in the RAG query function (the except
Exception as e: that currently calls logger.error and returns an error string),
replace logger.error(...) with logger.exception(...) so the full stack trace is
captured while still returning the error string; keep the returned message
unchanged and do not re-raise the exception.
- Around line 206-208: Replace the logger.error(...) call in the except block
that catches "except Exception as e" in
packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py with
logger.exception(...) so the full stack trace is recorded (keep returning the
same user-facing string), and apply the same change in the nvidia_rag_query
handler where a generic Exception is caught; use logger.exception(logger
message, exc_info=True) semantics so the exception and traceback are logged
while still returning the existing error message to the caller.
- Around line 196-204: Remove the stray debug print and fix metadata
access/unused vars in the citation formatting code: delete the
print(description) call, replace the brittle getattr(citation, "metadata",
{}).description with safe access (e.g., metadata = getattr(citation, "metadata",
{}) and then metadata.get("description") or getattr(metadata, "description",
None) depending on whether metadata can be a dict or object), and either use the
previously-read content variable in the output or remove the unused content =
getattr(citation, "content", "") assignment; ensure results.append uses the
chosen field(s) (description or content) after null/empty checks.
🧹 Nitpick comments (3)
packages/nvidia_nat_rag/README.md (2)

55-58: Add language specifier to fenced code block.

The code block showing the sample config file path should have a language specifier for proper rendering.

Suggested fix
-```
+```text
 packages/nvidia_nat_rag/src/nat/plugins/rag/configs/config.yml
</details>

---

`176-196`: **Add language specifier to directory structure code block.**

The directory structure block should have a language specifier (e.g., `text` or `plaintext`).



<details>
<summary>Suggested fix</summary>

```diff
-```
+```text
 packages/nvidia_nat_rag/
 ├── LICENSE.md
 ...
packages/nvidia_nat_rag/src/nat/plugins/rag/register.py (1)

1-19: Consider adding a module-level docstring.

Per coding guidelines, public modules should have Google-style docstrings. A brief module docstring would clarify the purpose of this registration entry point.

📝 Suggested addition
 # SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
 # SPDX-License-Identifier: Apache-2.0
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
 # You may obtain a copy of the License at
 #
 # http://www.apache.org/licenses/LICENSE-2.0
 #
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
+"""Registration entry point for NVIDIA RAG plugin tools.
+
+This module is loaded via the `nat.components` entry point to register
+the RAG query and search tools with NeMo Agent Toolkit.
+"""

 # flake8: noqa

 # Import all functions to register them with NAT
 from nat.plugins.rag import rag_functions
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0b721cc and b0527a0.

📒 Files selected for processing (9)
  • packages/nvidia_nat_rag/LICENSE.md
  • packages/nvidia_nat_rag/README.md
  • packages/nvidia_nat_rag/pyproject.toml
  • packages/nvidia_nat_rag/src/nat/meta/pypi.md
  • packages/nvidia_nat_rag/src/nat/plugins/rag/__init__.py
  • packages/nvidia_nat_rag/src/nat/plugins/rag/configs/config.yml
  • packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py
  • packages/nvidia_nat_rag/src/nat/plugins/rag/register.py
  • packages/nvidia_nat_rag/vendor/nvidia_rag-2.4.0.dev0-py3-none-any.whl
🧰 Additional context used
📓 Path-based instructions (10)
**/*.{md,mdx}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{md,mdx}: Use 'NVIDIA NeMo Agent toolkit' for full name (first use), 'NeMo Agent toolkit' or 'the toolkit' for subsequent references, and 'Toolkit' (capital T) in titles/headings, 'toolkit' (lowercase t) in body text
Never use deprecated names: 'Agent Intelligence toolkit', 'aiqtoolkit', 'AgentIQ', 'AIQ', or 'aiq' in documentation; update any occurrences unless intentionally referring to deprecated versions or implementing compatibility layers

Files:

  • packages/nvidia_nat_rag/README.md
  • packages/nvidia_nat_rag/LICENSE.md
  • packages/nvidia_nat_rag/src/nat/meta/pypi.md
**/*.{md,mdx,rst}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{md,mdx,rst}: Documentation must be clear, comprehensive, and free of TODOs, FIXMEs, placeholder text, offensive or outdated terms, and spelling mistakes
Do not use words listed in 'ci/vale/styles/config/vocabularies/nat/reject.txt' in documentation
Words listed in 'ci/vale/styles/config/vocabularies/nat/accept.txt' are acceptable even if they appear to be spelling mistakes

Files:

  • packages/nvidia_nat_rag/README.md
  • packages/nvidia_nat_rag/LICENSE.md
  • packages/nvidia_nat_rag/src/nat/meta/pypi.md
**/*.{py,js,ts,tsx,jsx,sh,yaml,yml,json,toml,md,mdx,rst}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.{py,js,ts,tsx,jsx,sh,yaml,yml,json,toml,md,mdx,rst}: Every file must start with the standard SPDX Apache-2.0 header
Confirm that copyright years are up-to-date whenever a file is changed
All source files must include the SPDX Apache-2.0 header template

Files:

  • packages/nvidia_nat_rag/README.md
  • packages/nvidia_nat_rag/src/nat/plugins/rag/__init__.py
  • packages/nvidia_nat_rag/LICENSE.md
  • packages/nvidia_nat_rag/src/nat/plugins/rag/configs/config.yml
  • packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py
  • packages/nvidia_nat_rag/src/nat/plugins/rag/register.py
  • packages/nvidia_nat_rag/src/nat/meta/pypi.md
  • packages/nvidia_nat_rag/pyproject.toml
**/*.{py,md,mdx,rst}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Version numbers are derived automatically by 'setuptools-scm'; never hard-code them in code or docs

Files:

  • packages/nvidia_nat_rag/README.md
  • packages/nvidia_nat_rag/src/nat/plugins/rag/__init__.py
  • packages/nvidia_nat_rag/LICENSE.md
  • packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py
  • packages/nvidia_nat_rag/src/nat/plugins/rag/register.py
  • packages/nvidia_nat_rag/src/nat/meta/pypi.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 (except for return values of None,
    in that situation no return type hint is needed).
    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 raise statements to maintain the original stack trace,
      and use logger.error() (not logger.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.txt file, words that might appear to be
spelling mistakes but are listed in the ci/vale/styles/config/vocabularies/nat/accept.txt file are OK.

  • Documentation in Markdown files should not contain usage of a possessive 's with inanimate objects
    (ex: "the system's performance" should be "the performance of the system").
  • Documentation in Markdown files should not use NAT as an acronym, always spell out NeMo Agent Toolkit.
    The exception to this rule is when referring to package names or code identifiers that contain "nat", th...

Files:

  • packages/nvidia_nat_rag/README.md
  • packages/nvidia_nat_rag/src/nat/plugins/rag/__init__.py
  • packages/nvidia_nat_rag/LICENSE.md
  • packages/nvidia_nat_rag/src/nat/plugins/rag/configs/config.yml
  • packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py
  • packages/nvidia_nat_rag/src/nat/plugins/rag/register.py
  • packages/nvidia_nat_rag/src/nat/meta/pypi.md
  • packages/nvidia_nat_rag/pyproject.toml
packages/**/*

⚙️ CodeRabbit configuration file

packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain a pyproject.toml file. - The pyproject.toml file should declare a dependency on nvidia-nat or another package with a name starting
with nvidia-nat-. This dependency should be declared using ~=<version>, and the version should be a two
digit version (ex: ~=1.0).

  • Not all packages contain Python code, if they do they should also contain their own set of tests, in a
    tests/ directory at the same level as the pyproject.toml file.
  • When adding a new package, that new package name (as defined in the pyproject.toml file) should
    be added as a dependency to the nvidia-nat-all package in packages/nvidia_nat_all/pyproject.toml

Files:

  • packages/nvidia_nat_rag/README.md
  • packages/nvidia_nat_rag/src/nat/plugins/rag/__init__.py
  • packages/nvidia_nat_rag/LICENSE.md
  • packages/nvidia_nat_rag/src/nat/plugins/rag/configs/config.yml
  • packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py
  • packages/nvidia_nat_rag/src/nat/plugins/rag/register.py
  • packages/nvidia_nat_rag/src/nat/meta/pypi.md
  • packages/nvidia_nat_rag/pyproject.toml
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

**/*.py: Follow PEP 20 and PEP 8 for Python style guidelines
Run yapf with PEP 8 base and 'column_limit = 120' for code formatting
Use 'ruff check --fix' for linting with configuration from 'pyproject.toml', fix warnings unless explicitly ignored
Use snake_case for functions and variables, PascalCase for classes, UPPER_CASE for constants
All public APIs require Python 3.11+ type hints on parameters and return values
Prefer 'collections.abc' / 'typing' abstractions (e.g., 'Sequence' over 'list') for type hints
Use 'typing.Annotated' for units or extra metadata when useful
Treat 'pyright' warnings (configured in 'pyproject.toml') as errors during development
Preserve stack traces and prevent duplicate logging when handling exceptions; use bare 'raise' statements when re-raising, and use 'logger.error()' for logging (not 'logger.exception()') to avoid duplicate stack trace output
When catching and logging exceptions without re-raising, always use 'logger.exception()' (equivalent to 'logger.error(exc_info=True)') to capture full stack trace information
Pydantic models using 'SecretStr', 'SerializableSecretStr', or 'OptionalSecretStr' should use 'default=None' for optional fields and 'default_factory=lambda: SerializableSecretStr("")' for non-optional fields to avoid initialization bugs
Provide Google-style docstrings for every public module, class, function and CLI command
The first line of docstrings must be a concise description ending with a period
Surround code entities in docstrings with backticks to avoid Vale false-positives
Validate and sanitise 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 (HTTP, DB, file reads)
Cache expensive computations with 'functools.lru_cache' or an external cache when appropriate
Leverage NumPy vectorised operations whenever beneficial and feasible

Files:

  • packages/nvidia_nat_rag/src/nat/plugins/rag/__init__.py
  • packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py
  • packages/nvidia_nat_rag/src/nat/plugins/rag/register.py
**/*.{py,yaml,yml,json,toml}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Indent with 4 spaces (never tabs) and ensure every file ends with a single newline

Files:

  • packages/nvidia_nat_rag/src/nat/plugins/rag/__init__.py
  • packages/nvidia_nat_rag/src/nat/plugins/rag/configs/config.yml
  • packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py
  • packages/nvidia_nat_rag/src/nat/plugins/rag/register.py
  • packages/nvidia_nat_rag/pyproject.toml
packages/*/pyproject.toml

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Each package in 'packages/' should contain a 'pyproject.toml' file with a dependency on 'nvidia-nat' or another package with name starting with 'nvidia-nat-'

Files:

  • packages/nvidia_nat_rag/pyproject.toml
{pyproject.toml,packages/*/pyproject.toml}

📄 CodeRabbit inference engine (.cursor/rules/general.mdc)

Package dependencies should use '=' format with two-digit versions (e.g., '=1.0')

Files:

  • packages/nvidia_nat_rag/pyproject.toml
🧠 Learnings (8)
📓 Common learnings
Learnt from: mnajafian-nv
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 1324
File: examples/config_inheritance/pyproject.toml:15-15
Timestamp: 2026-01-05T16:32:00.641Z
Learning: In the NVIDIA/NeMo-Agent-Toolkit repository, the develop branch may reference unreleased versions of nvidia-nat (e.g., 1.5) in pyproject.toml dependency specifications even before those versions are published to PyPI. This is intentional pre-release version management, and the workspace dependencies use editable local installs (e.g., `nvidia-nat = { path = "../..", editable = true }`) to ensure development works correctly with the local sources.
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2026-01-05T15:46:49.676Z
Learning: Use technical identifiers: 'nat' for API namespace and CLI tool, 'nvidia-nat' for package name, 'NAT_' prefix for environment variables, 'NeMo-Agent-Toolkit' for URLs and directory names
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2026-01-05T15:46:49.676Z
Learning: Applies to **/*.{md,mdx} : Use 'NVIDIA NeMo Agent toolkit' for full name (first use), 'NeMo Agent toolkit' or 'the toolkit' for subsequent references, and 'Toolkit' (capital T) in titles/headings, 'toolkit' (lowercase t) in body text
📚 Learning: 2026-01-05T16:32:00.641Z
Learnt from: mnajafian-nv
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 1324
File: examples/config_inheritance/pyproject.toml:15-15
Timestamp: 2026-01-05T16:32:00.641Z
Learning: In the NVIDIA/NeMo-Agent-Toolkit repository, the develop branch may reference unreleased versions of nvidia-nat (e.g., 1.5) in pyproject.toml dependency specifications even before those versions are published to PyPI. This is intentional pre-release version management, and the workspace dependencies use editable local installs (e.g., `nvidia-nat = { path = "../..", editable = true }`) to ensure development works correctly with the local sources.

Applied to files:

  • packages/nvidia_nat_rag/README.md
  • packages/nvidia_nat_rag/src/nat/meta/pypi.md
  • packages/nvidia_nat_rag/pyproject.toml
📚 Learning: 2026-01-05T15:46:49.676Z
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2026-01-05T15:46:49.676Z
Learning: Applies to packages/*/pyproject.toml : Each package in 'packages/' should contain a 'pyproject.toml' file with a dependency on 'nvidia-nat' or another package with name starting with 'nvidia-nat-'

Applied to files:

  • packages/nvidia_nat_rag/src/nat/plugins/rag/__init__.py
  • packages/nvidia_nat_rag/src/nat/meta/pypi.md
  • packages/nvidia_nat_rag/pyproject.toml
📚 Learning: 2026-01-05T15:46:49.676Z
Learnt from: CR
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2026-01-05T15:46:49.676Z
Learning: Use technical identifiers: 'nat' for API namespace and CLI tool, 'nvidia-nat' for package name, 'NAT_' prefix for environment variables, 'NeMo-Agent-Toolkit' for URLs and directory names

Applied to files:

  • packages/nvidia_nat_rag/src/nat/plugins/rag/__init__.py
  • packages/nvidia_nat_rag/src/nat/meta/pypi.md
  • packages/nvidia_nat_rag/pyproject.toml
📚 Learning: 2025-12-03T18:42:23.494Z
Learnt from: AnuradhaKaruppiah
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 1147
File: packages/nvidia_nat_a2a/pyproject.toml:1-10
Timestamp: 2025-12-03T18:42:23.494Z
Learning: In the packages/ directory, pyproject.toml files typically do not include SPDX license headers. Out of 34 packages, only nvidia_nat_strands is an exception. This pattern differs from the requirement for SPDX headers in source code files (.py, .js, .ts, etc.).

Applied to files:

  • packages/nvidia_nat_rag/LICENSE.md
  • packages/nvidia_nat_rag/pyproject.toml
📚 Learning: 2025-12-12T20:49:44.305Z
Learnt from: zterek
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 1243
File: examples/risk_and_security/retail_agent/src/nat_retail_agent/configs/red-teaming.yml:1-98
Timestamp: 2025-12-12T20:49:44.305Z
Learning: In the NVIDIA/NeMo-Agent-Toolkit repository, YAML files generally use 2-space indentation. When reviewing YAML, prefer 2-space indentation to match the existing style over a 4-space guideline until a repo-wide standardization is performed. This applies to YAML configuration files (e.g., red-teaming.yml) and, more broadly, all *.yml files in the project.

Applied to files:

  • packages/nvidia_nat_rag/src/nat/plugins/rag/configs/config.yml
📚 Learning: 2025-09-15T21:26:29.430Z
Learnt from: saglave
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 726
File: examples/frameworks/adk_demo/src/nat_adk_demo/weather_update_tool.py:0-0
Timestamp: 2025-09-15T21:26:29.430Z
Learning: In NAT's ADK integration, the docstring of registered functions serves as the tool description sent to the LLM, not standard Python function documentation. The docstring should describe the logical tool interface (parameters the LLM will provide) rather than the NAT framework wrapper parameters like tool_config and builder.

Applied to files:

  • packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py
  • packages/nvidia_nat_rag/src/nat/meta/pypi.md
📚 Learning: 2025-11-10T21:26:35.059Z
Learnt from: jiaxiangr
Repo: NVIDIA/NeMo-Agent-Toolkit PR: 974
File: packages/nvidia_nat_all/pyproject.toml:39-39
Timestamp: 2025-11-10T21:26:35.059Z
Learning: In packages/nvidia_nat_all/pyproject.toml, workspace dependencies (nvidia-nat-* plugin packages) should NOT have version constraints because they are managed as workspace dependencies. Version constraints are only applied to the base nvidia-nat package and external dependencies, not to internal workspace packages.

Applied to files:

  • packages/nvidia_nat_rag/pyproject.toml
🧬 Code graph analysis (1)
packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py (3)
src/nat/builder/builder.py (1)
  • Builder (84-811)
src/nat/builder/function_info.py (2)
  • FunctionInfo (290-625)
  • from_fn (552-625)
src/nat/data_models/function.py (1)
  • FunctionBaseConfig (26-36)
🪛 LanguageTool
packages/nvidia_nat_rag/LICENSE.md

[style] ~161-~161: ‘any and all’ might be wordy. Consider a shorter alternative.
Context: ...ge, computer failure or malfunction, or any and all other commercial damages or losses), ev...

(EN_WORDINESS_PREMIUM_ANY_AND_ALL)

🪛 markdownlint-cli2 (0.18.1)
packages/nvidia_nat_rag/README.md

56-56: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


178-178: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

packages/nvidia_nat_rag/LICENSE.md

56-56: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


178-178: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🪛 Ruff (0.14.11)
packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py

61-61: Unused function argument: builder

(ARG001)


117-117: Do not catch blind exception: Exception

(BLE001)


118-118: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


119-119: Use explicit conversion flag

Replace with conversion flag

(RUF010)


159-159: Unused function argument: builder

(ARG001)


197-197: Local variable content is assigned to but never used

Remove assignment to unused variable content

(F841)


206-206: Do not catch blind exception: Exception

(BLE001)


207-207: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


208-208: Use explicit conversion flag

Replace with conversion flag

(RUF010)

🔇 Additional comments (7)
packages/nvidia_nat_rag/LICENSE.md (1)

1-190: License file is correct.

Standard Apache License 2.0 text with appropriate copyright years (2025-2026). The static analysis hints about code blocks and wordiness are false positives—this is standard license text that should not be modified.

packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py (2)

61-69: Unused builder parameter is acceptable for this registration pattern.

The builder parameter is required by the @register_function decorator interface but not used in this implementation. This is acceptable as it follows the NAT framework's registration pattern where the builder may be needed by other registered functions.


32-57: Configuration classes are well-structured.

The NvidiaRAGQueryConfig properly extends FunctionBaseConfig with appropriate field definitions, defaults, and descriptions. Type hints are correct.

packages/nvidia_nat_rag/src/nat/plugins/rag/__init__.py (1)

1-16: LGTM!

Proper SPDX license header and module docstring. The package initializer correctly serves as a marker without needing explicit exports since registration is handled via the entry point in register.py.

packages/nvidia_nat_rag/src/nat/plugins/rag/configs/config.yml (1)

8-45: Configuration structure looks good.

The sample configuration is well-documented with helpful comments explaining each section. The use of localhost endpoints is appropriate for a sample configuration file.

packages/nvidia_nat_rag/pyproject.toml (2)

57-58: Entry point configuration looks correct.

The nat.components entry point correctly maps to the registration module that imports and registers the RAG functions.


52-55: Vendored wheel configuration is correct.

The vendored nvidia-rag wheel (version 2.4.0.dev0) exists at the specified path and is intentionally used for local development via the tool.uv.sources override, while the project maintains a stable version constraint (~=2.4) in dependencies.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +16 to +18
[project]
name = "nvidia-nat-rag"
dynamic = ["version"]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if nvidia-nat-rag is already added to nvidia-nat-all dependencies
rg -n "nvidia-nat-rag" packages/nvidia_nat_all/pyproject.toml || echo "nvidia-nat-rag NOT found in nvidia-nat-all dependencies"

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 228


🏁 Script executed:

#!/bin/bash
# First, confirm the exact package name from the pyproject.toml being reviewed
echo "=== Package name from nvidia-nat-rag/pyproject.toml ==="
cat packages/nvidia_nat_rag/pyproject.toml | grep -A 2 "^\[project\]"

# Search for exact match of "nvidia-nat-rag" (not ragaai) in nvidia-nat-all dependencies
echo -e "\n=== Checking for 'nvidia-nat-rag' in dependencies section ==="
rg -A 20 "^\[project.optional-dependencies\]|^dependencies" packages/nvidia_nat_all/pyproject.toml | head -40

# Check the entire dependencies section
echo -e "\n=== Full dependencies section ==="
sed -n '/^\[project\]/,/^\[/p' packages/nvidia_nat_all/pyproject.toml | head -50

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 2809


Add nvidia-nat-rag to the dependencies in packages/nvidia_nat_all/pyproject.toml.

Per coding guidelines, when adding a new package, its name must be added as a dependency to the nvidia-nat-all package. The nvidia-nat-rag package should be inserted in the sorted dependencies list between nvidia-nat-profiling and nvidia-nat-redis.

🤖 Prompt for AI Agents
In `@packages/nvidia_nat_rag/pyproject.toml` around lines 16 - 18, Add
"nvidia-nat-rag" to the dependencies list in
packages/nvidia_nat_all/pyproject.toml: locate the [project].dependencies array
and insert the package name "nvidia-nat-rag" into the sorted list so it appears
between "nvidia-nat-profiling" and "nvidia-nat-redis", preserving the existing
formatting and quoting style used for other dependency entries.

Comment on lines +19 to +27
dependencies = [
# Keep package version constraints as open as possible to avoid conflicts with other packages. Always define a minimum
# version when adding a new package. If unsure, default to using `~=` instead of `==`. Does not apply to nvidia-nat packages.
# Keep sorted!!!
"langgraph>=0.2", # Required for react_agent workflow
"langchain_classic",
"nvidia-nat~=1.5",
"nvidia-rag[rag]~=2.4",
]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

# First, let's examine the actual pyproject.toml file
cat -n packages/nvidia_nat_rag/pyproject.toml | head -40

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 1593


🏁 Script executed:

# Check if there are any other references to langchain_classic in the codebase
rg "langchain_classic" --type toml --type python

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 99


🏁 Script executed:

# Let's also verify what the learning says about dependency format
# by looking at other pyproject.toml files in packages/
fd "pyproject.toml" packages/ --exec head -50 {} \; 2>/dev/null | grep -A 5 "dependencies"

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 13728


🏁 Script executed:

# Search for langchain_classic usage in the codebase
rg "langchain_classic" --type python -A 2 -B 2

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 99


🏁 Script executed:

# Check if there are any version requirements documented in the package's documentation
fd "README*" packages/nvidia_nat_rag/

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 102


🏁 Script executed:

# Check the actual imports and usage
find packages/nvidia_nat_rag -name "*.py" -type f -exec grep -l "langchain_classic" {} \;

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 51


🏁 Script executed:

# Search for langchain_classic usage - without specifying python type
rg "langchain_classic" -A 2 -B 2

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 7741


🏁 Script executed:

# Check the README for version requirements
cat packages/nvidia_nat_rag/README.md

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 4646


🏁 Script executed:

# List Python files in the rag package
find packages/nvidia_nat_rag/src -type f -name "*.py" 2>/dev/null | head -20

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 241


🏁 Script executed:

# Check what the actual minimum version should be by looking at usage patterns
# and verify the current resolved version
cat packages/nvidia_nat_rag/uv.lock | grep -A 5 'name = "langchain-classic"' | head -20

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 132


🏁 Script executed:

# Check the root-level uv.lock file
head -100 uv.lock | grep -A 5 "langchain.classic"

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 51


🏁 Script executed:

# Also search for all references to find the version being used
rg "langchain.classic" uv.lock -A 3 | head -20

Repository: NVIDIA/NeMo-Agent-Toolkit

Length of output: 1161


Missing version constraint for langchain_classic.

Per coding guidelines, all dependencies should define a minimum version. The langchain_classic dependency lacks any version constraint, and per the coding guidelines comment in the file itself, the format should use ~= instead of ==.

📝 Suggested fix
 dependencies = [
   # Keep package version constraints as open as possible to avoid conflicts with other packages. Always define a minimum
   # version when adding a new package. If unsure, default to using `~=` instead of `==`. Does not apply to nvidia-nat packages.
   # Keep sorted!!!
   "langgraph>=0.2",  # Required for react_agent workflow
-  "langchain_classic",
+  "langchain_classic~=1.0",
   "nvidia-nat~=1.5",
   "nvidia-rag[rag]~=2.4",
 ]
🤖 Prompt for AI Agents
In `@packages/nvidia_nat_rag/pyproject.toml` around lines 19 - 27, The dependency
entry "langchain_classic" is missing a minimum version; update the dependencies
list by replacing "langchain_classic" with a pinned minimum using the ~= format
(e.g., "langchain_classic~=X.Y") per the file's guideline comment so all
packages have a defined minimum version and remain sorted with the other
entries.

Comment on lines +1 to +3
# NVIDIA NAT RAG Plugin

This plugin integrates [NVIDIA RAG](https://github.com/NVIDIA-AI-Blueprints/rag) with NeMo Agent Toolkit, providing RAG query and search capabilities for your agent workflows.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Missing SPDX header and incorrect naming convention.

The file is missing the required SPDX Apache-2.0 license header. Additionally, the title "NVIDIA NAT RAG Plugin" uses "NAT" as an acronym, which should be avoided per documentation guidelines. Use the full name "NVIDIA NeMo Agent Toolkit RAG Plugin" or reference nvidia-nat-rag with backticks when referring to the package.

Suggested fix
+<!-- SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -->
+<!-- SPDX-License-Identifier: Apache-2.0 -->
+
-# NVIDIA NAT RAG Plugin
+# NVIDIA NeMo Agent Toolkit RAG Plugin
 
-This plugin integrates [NVIDIA RAG](https://github.com/NVIDIA-AI-Blueprints/rag) with NeMo Agent Toolkit, providing RAG query and search capabilities for your agent workflows.
+This plugin integrates [NVIDIA RAG](https://github.com/NVIDIA-AI-Blueprints/rag) with the NeMo Agent Toolkit, providing RAG query and search capabilities for your agent workflows.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# NVIDIA NAT RAG Plugin
This plugin integrates [NVIDIA RAG](https://github.com/NVIDIA-AI-Blueprints/rag) with NeMo Agent Toolkit, providing RAG query and search capabilities for your agent workflows.
<!-- SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -->
<!-- SPDX-License-Identifier: Apache-2.0 -->
# NVIDIA NeMo Agent Toolkit RAG Plugin
This plugin integrates [NVIDIA RAG](https://github.com/NVIDIA-AI-Blueprints/rag) with the NeMo Agent Toolkit, providing RAG query and search capabilities for your agent workflows.
🤖 Prompt for AI Agents
In `@packages/nvidia_nat_rag/README.md` around lines 1 - 3, Add the SPDX
Apache-2.0 license header to the top of the README and update the title to avoid
the "NAT" acronym; change "NVIDIA NAT RAG Plugin" to "NVIDIA NeMo Agent Toolkit
RAG Plugin" (or use the package reference `nvidia-nat-rag` in backticks when
mentioning the package) so the file includes the required license header and
follows naming conventions.

Comment on lines +1 to +35
# NVIDIA NeMo Agent Toolkit - RAG Plugin

This package provides integration between NVIDIA NeMo Agent Toolkit and the NVIDIA RAG library.

## Features

- **RAG Query**: Query documents using RAG with configurable LLM and embeddings
- **RAG Search**: Search for relevant documents in vector database collections

## Installation

```bash
pip install nvidia-nat-rag
```

## Usage

Add the RAG tools to your NAT workflow configuration:

```yaml
functions:
rag_query:
_type: nvidia_rag_query
collection_names: ["my_collection"]
vdb_endpoint: "http://localhost:19530"

workflow:
_type: react_agent
tool_names: [rag_query]
llm_name: nim_llm
```

## Documentation

For more information, see the [NeMo Agent Toolkit documentation](https://docs.nvidia.com/nemo/agent-toolkit/latest/).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Missing SPDX Apache-2.0 license header.

Per coding guidelines, every file including markdown must start with the standard SPDX Apache-2.0 header.

Additionally, Line 18 uses "NAT" as an acronym ("Add the RAG tools to your NAT workflow configuration"). Per documentation guidelines, avoid using "NAT" as an acronym—spell out "NeMo Agent Toolkit" or use backticks when referring to code identifiers like nat.

Suggested header and fix
+<!-- SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. -->
+<!-- SPDX-License-Identifier: Apache-2.0 -->
+
 # NVIDIA NeMo Agent Toolkit - RAG Plugin

And on Line 18:

-Add the RAG tools to your NAT workflow configuration:
+Add the RAG tools to your NeMo Agent Toolkit workflow configuration:
🤖 Prompt for AI Agents
In `@packages/nvidia_nat_rag/src/nat/meta/pypi.md` around lines 1 - 35, Add the
standard SPDX Apache-2.0 header to the very top of
packages/nvidia_nat_rag/src/nat/meta/pypi.md (so every file begins with the
required license marker), and update the phrase "Add the RAG tools to your NAT
workflow configuration" to spell out "NeMo Agent Toolkit" or use a code literal
(e.g., `nat`)—ensure the usage is consistent with other docs and the YAML
example remains unchanged.

Comment on lines +1 to +6
# NVIDIA RAG Integration - Sample Configuration
# This configuration demonstrates how to use NVIDIA RAG tools with NeMo Agent Toolkit

# RAG configuration file path (used by nvidia_rag library)
# Make sure this file exists and is properly configured for your environment
# See: https://github.com/NVIDIA-AI-Blueprints/rag/blob/main/notebooks/config.yaml
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Missing SPDX Apache-2.0 license header.

Per coding guidelines, all source files including YAML should include the SPDX Apache-2.0 header template.

📝 Suggested addition
+# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+# SPDX-License-Identifier: Apache-2.0
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 # NVIDIA RAG Integration - Sample Configuration
 # This configuration demonstrates how to use NVIDIA RAG tools with NeMo Agent Toolkit
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# NVIDIA RAG Integration - Sample Configuration
# This configuration demonstrates how to use NVIDIA RAG tools with NeMo Agent Toolkit
# RAG configuration file path (used by nvidia_rag library)
# Make sure this file exists and is properly configured for your environment
# See: https://github.com/NVIDIA-AI-Blueprints/rag/blob/main/notebooks/config.yaml
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# NVIDIA RAG Integration - Sample Configuration
# This configuration demonstrates how to use NVIDIA RAG tools with NeMo Agent Toolkit
# RAG configuration file path (used by nvidia_rag library)
# Make sure this file exists and is properly configured for your environment
# See: https://github.com/NVIDIA-AI-Blueprints/rag/blob/main/notebooks/config.yaml
🤖 Prompt for AI Agents
In `@packages/nvidia_nat_rag/src/nat/plugins/rag/configs/config.yml` around lines
1 - 6, Add the SPDX Apache-2.0 license header to the top of config.yml: insert
the standard single-line SPDX identifier "SPDX-License-Identifier: Apache-2.0"
(and optionally the full Apache-2.0 header block if your project prefers) as the
first line(s) of the YAML file so the file complies with the repository's
licensing guidelines.

Comment on lines +117 to +119
except Exception as e:
logger.error("RAG query failed: %s", str(e))
return f"Error querying RAG: {str(e)}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use logger.exception() when logging exceptions without re-raising.

Per coding guidelines: "When catching and logging exceptions without re-raising: always use logger.exception() to capture the full stack trace information."

Suggested fix
         except Exception as e:
-            logger.error("RAG query failed: %s", str(e))
+            logger.exception("RAG query failed")
             return f"Error querying RAG: {e!s}"
🧰 Tools
🪛 Ruff (0.14.11)

117-117: Do not catch blind exception: Exception

(BLE001)


118-118: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


119-119: Use explicit conversion flag

Replace with conversion flag

(RUF010)

🤖 Prompt for AI Agents
In `@packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py` around lines
117 - 119, In the except block in the RAG query function (the except Exception
as e: that currently calls logger.error and returns an error string), replace
logger.error(...) with logger.exception(...) so the full stack trace is captured
while still returning the error string; keep the returned message unchanged and
do not re-raise the exception.

Comment on lines +196 to +204
doc_name = getattr(citation, "document_name", f"Document {idx + 1}")
content = getattr(citation, "content", "")
doc_type = getattr(citation, "document_type", "text")
description = getattr(citation, "metadata", {}).description
print(description)

results.append(f"**{doc_name}** (type: {doc_type}):\n{description}")

return "\n\n---\n\n".join(results)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Debug print() statement and potential AttributeError.

  1. Line 200 contains a print(description) statement that appears to be debug code and should be removed.

  2. Line 199 accesses .description as an attribute on metadata, but getattr(citation, "metadata", {}) returns a dict by default. Accessing .description on a dict raises AttributeError. This should use dict access or handle the attribute properly.

  3. Line 197 assigns content but it's never used—the output uses description instead. Clarify the intent or remove the unused variable.

Suggested fix
             for idx, citation in enumerate(citations.results):
                 doc_name = getattr(citation, "document_name", f"Document {idx + 1}")
-                content = getattr(citation, "content", "")
+                content = getattr(citation, "content", "No content available")
                 doc_type = getattr(citation, "document_type", "text")
-                description = getattr(citation, "metadata", {}).description
-                print(description)
 
-                results.append(f"**{doc_name}** (type: {doc_type}):\n{description}")
+                results.append(f"**{doc_name}** (type: {doc_type}):\n{content}")
🧰 Tools
🪛 Ruff (0.14.11)

197-197: Local variable content is assigned to but never used

Remove assignment to unused variable content

(F841)

🤖 Prompt for AI Agents
In `@packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py` around lines
196 - 204, Remove the stray debug print and fix metadata access/unused vars in
the citation formatting code: delete the print(description) call, replace the
brittle getattr(citation, "metadata", {}).description with safe access (e.g.,
metadata = getattr(citation, "metadata", {}) and then
metadata.get("description") or getattr(metadata, "description", None) depending
on whether metadata can be a dict or object), and either use the previously-read
content variable in the output or remove the unused content = getattr(citation,
"content", "") assignment; ensure results.append uses the chosen field(s)
(description or content) after null/empty checks.

Comment on lines +206 to +208
except Exception as e:
logger.error("RAG search failed: %s", str(e))
return f"Error searching documents: {str(e)}"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use logger.exception() when logging exceptions without re-raising.

Same issue as in nvidia_rag_query: use logger.exception() to capture the full stack trace.

Suggested fix
         except Exception as e:
-            logger.error("RAG search failed: %s", str(e))
+            logger.exception("RAG search failed")
             return f"Error searching documents: {e!s}"
🧰 Tools
🪛 Ruff (0.14.11)

206-206: Do not catch blind exception: Exception

(BLE001)


207-207: Use logging.exception instead of logging.error

Replace with exception

(TRY400)


208-208: Use explicit conversion flag

Replace with conversion flag

(RUF010)

🤖 Prompt for AI Agents
In `@packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py` around lines
206 - 208, Replace the logger.error(...) call in the except block that catches
"except Exception as e" in
packages/nvidia_nat_rag/src/nat/plugins/rag/rag_functions.py with
logger.exception(...) so the full stack trace is recorded (keep returning the
same user-facing string), and apply the same change in the nvidia_rag_query
handler where a generic Exception is caught; use logger.exception(logger
message, exc_info=True) semantics so the exception and traceback are logged
while still returning the existing error message to the caller.

@ericevans-nv ericevans-nv self-assigned this Jan 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants