Skip to content

Conversation

@willkill07
Copy link
Member

@willkill07 willkill07 commented Sep 30, 2025

Description

This PR extends the LiteLLM type introduced in #726 to be supported in other frameworks.

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

  • New Features

    • Added LiteLLM as a supported LLM provider across AGNO, CrewAI, LangChain, LangChain, and LlamaIndex integrations.
    • Enables configuring LiteLLM with common parameters (model_name, api_key, base_url, seed, temperature, top_p, max_retries).
  • Documentation

    • Updated LLM providers table and added LiteLLM setup/config guidance, including Azure OpenAI area and workflows docs.
  • Chores

    • Added runtime dependencies for LiteLLM integrations (LangChain, LlamaIndex) and suppresses transformers warnings in the CLI.

@willkill07 willkill07 requested review from a team as code owners September 30, 2025 20:43
@coderabbitai
Copy link

coderabbitai bot commented Sep 30, 2025

Walkthrough

Adds LiteLLM support across AGNO, CrewAI, LangChain, and LlamaIndex by registering new handlers that build LiteLLM clients from LiteLlmModelConfig. Updates docs to document LiteLLM and adds runtime dependencies for LangChain and LlamaIndex. Also sets TRANSFORMERS_VERBOSITY="error" in the CLI run flow.

Changes

Cohort / File(s) Summary
Docs: LiteLLM provider
docs/source/workflows/llms/index.md
Adds LiteLLM to LLM providers table and documents configuration fields (_type, model_name, api_key, base_url, seed, temperature, top_p, max_retries) and usage notes.
AGNO plugin: LiteLLM + import tweaks
packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py
Adds litellm_agno handler that builds a LiteLLM client from LiteLlmModelConfig (using model_dump with exclusions/aliases), applies existing patching (retries/thinking), and adjusts import paths for other AGNO handlers.
CrewAI plugin: LiteLLM
packages/nvidia_nat_crewai/src/nat/plugins/crewai/llm.py
Adds litellm_crewai handler registered for LiteLlmModelConfig that constructs a CrewAI LLM client from filtered config and applies _patch_llm_based_on_config. (Handler registration appears twice in the diff.)
LangChain plugin + dependency
packages/nvidia_nat_langchain/src/nat/plugins/langchain/llm.py, packages/nvidia_nat_langchain/pyproject.toml
Adds litellm_langchain handler (for LiteLlmModelConfig) that runtime-imports ChatLiteLLM from langchain_litellm, constructs via filtered model_dump, and applies patching. Adds runtime dependency langchain-litellm~=0.2.3.
LlamaIndex plugin + dependency
packages/nvidia_nat_llama_index/src/nat/plugins/llama_index/llm.py, packages/nvidia_nat_llama_index/pyproject.toml
Adds async litellm_llama_index handler (for LiteLlmModelConfig) that runtime-imports LiteLLM from llama_index.llms.litellm, constructs via filtered model_dump, and applies patching. Adds dependency llama-index-llms-litellm~=0.5.1.
CLI: transformer warnings suppression
src/nat/cli/main.py
Sets environment variable TRANSFORMERS_VERBOSITY="error" inside run_cli to suppress transformers warnings.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor App as App/Builder
  participant Reg as LLM Registry
  participant H as litellm_* handler
  participant Client as LiteLLM implementation
  participant Patch as _patch_llm_based_on_config
  participant FW as Framework Wrapper

  App->>Reg: request LLM client for LiteLlmModelConfig + wrapper
  Reg->>H: invoke registered litellm_* handler
  H->>H: llm_config.model_dump(exclude={"type","thinking"}, by_alias=true, exclude_none=true)
  note right of H: AGNO handler also excludes `model_name` when building client
  H->>Client: runtime import & construct LiteLLM / ChatLiteLLM
  H->>Patch: apply retries/thinking patches
  Patch-->>H: patched client
  H-->>FW: yield patched client
  FW-->>App: ready-to-use LLM client
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title claims to add LiteLLM support for “LangChain/LangGraph,” but the changes only implement support for LangChain, Agno, CrewAI, LlamaIndex, documentation, and CLI adjustments with no LangGraph integration, making the title misleading. Please update the title to accurately reflect the implemented changes by removing “LangGraph” or adding any missing LangGraph support if intended.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@willkill07
Copy link
Member Author

@coderabbitai review

@coderabbitai
Copy link

coderabbitai bot commented Sep 30, 2025

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@willkill07 willkill07 added feature request New feature or request non-breaking Non-breaking change labels Sep 30, 2025
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: 1

🧹 Nitpick comments (3)
docs/source/workflows/llms/index.md (2)

51-54: Optional: clarify env vars are provider-specific.

Consider adding a one-liner that required environment variables depend on the selected LiteLLM backend (e.g., OPENAI_API_KEY, ANTHROPIC_API_KEY), with the link you already provide for details.


135-149: Note required extras and version caveats.

Recommend adding a short note that some frameworks need extra packages:

  • LangChain: langchain-litellm
  • LlamaIndex: llama-index-llms-litellm

Also mention compatibility follows the framework versions pinned in NAT (see package pyproject files).

packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py (1)

36-66: Minor cleanup: avoid duplicate imports and narrow scope.

You import Message at Line 38 and again inside AgnoThinkingInjector (Line 42). Import once at function scope and reference it; this reduces redundancy.

-    from agno.models.message import Message
-
     class AgnoThinkingInjector(BaseThinkingInjector):
-
-        from agno.models.message import Message
+        from agno.models.message import Message  # or capture Message from outer scope
📜 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 12a3646 and 8e42844.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • docs/source/workflows/llms/index.md (3 hunks)
  • packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py (4 hunks)
  • packages/nvidia_nat_crewai/src/nat/plugins/crewai/llm.py (2 hunks)
  • packages/nvidia_nat_langchain/pyproject.toml (1 hunks)
  • packages/nvidia_nat_langchain/src/nat/plugins/langchain/llm.py (2 hunks)
  • packages/nvidia_nat_llama_index/pyproject.toml (1 hunks)
  • packages/nvidia_nat_llama_index/src/nat/plugins/llama_index/llm.py (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*

⚙️ 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 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.

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:

  • packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py
  • packages/nvidia_nat_llama_index/pyproject.toml
  • docs/source/workflows/llms/index.md
  • packages/nvidia_nat_langchain/src/nat/plugins/langchain/llm.py
  • packages/nvidia_nat_llama_index/src/nat/plugins/llama_index/llm.py
  • packages/nvidia_nat_langchain/pyproject.toml
  • packages/nvidia_nat_crewai/src/nat/plugins/crewai/llm.py
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.

Files:

  • packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py
  • packages/nvidia_nat_llama_index/pyproject.toml
  • packages/nvidia_nat_langchain/src/nat/plugins/langchain/llm.py
  • packages/nvidia_nat_llama_index/src/nat/plugins/llama_index/llm.py
  • packages/nvidia_nat_langchain/pyproject.toml
  • packages/nvidia_nat_crewai/src/nat/plugins/crewai/llm.py
docs/source/**/*

⚙️ CodeRabbit configuration file

This directory contains the source code for the documentation. All documentation should be written in Markdown format. Any image files should be placed in the docs/source/_static directory.

Files:

  • docs/source/workflows/llms/index.md
🧠 Learnings (1)
📚 Learning: 2025-09-23T18:39:15.023Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-09-23T18:39:15.023Z
Learning: Applies to packages/*/pyproject.toml : In packages, declare a dependency on nvidia-nat or packages starting with nvidia-nat-

Applied to files:

  • packages/nvidia_nat_llama_index/pyproject.toml
  • packages/nvidia_nat_langchain/pyproject.toml
⏰ 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 (11)
docs/source/workflows/llms/index.md (1)

29-29: Good addition to the providers table.

packages/nvidia_nat_langchain/src/nat/plugins/langchain/llm.py (2)

27-27: Import addition is appropriate for the new handler.


160-167: Confirm parameter mapping correct: ChatLiteLLM’s constructor uses model (not model_name) and accepts temperature, top_p, max_tokens, seed, and max_retries as top‐level args; your use of model_dump(exclude={"type","thinking"}, by_alias=True) aligns with its signature.

packages/nvidia_nat_langchain/pyproject.toml (1)

26-26: LGTM—compatibility with langchain-core 0.3.75 and langgraph 0.6.7 verified for langchain-litellm 0.2.3.

packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py (3)

90-90: Ensure AGNO’s OpenAIChat import is valid
Confirm that OpenAIChat exists at agno.models.openai.chat in the AGNO version pinned to this project (install AGNO and inspect its source or docs if needed).


105-119: Verify external LiteLLM API before merging

The plugin imports agno.models.litellm.chat.LiteLLM and relies on its invoke, ainvoke, invoke_stream, and ainvoke_stream methods. Since that module isn’t part of this repo, ensure your deployed agno package version exposes LiteLLM at that path and includes all four methods.


72-72: Verify AGNO Nvidia import path

Ensure the AGNO version pinned in NAT’s CI/CD defines a Nvidia class in the agno.models.nvidia.nvidia module.

packages/nvidia_nat_crewai/src/nat/plugins/crewai/llm.py (2)

26-26: LGTM!

Import is correctly placed and follows the established pattern.


132-139: LGTM!

The LiteLLM handler implementation is consistent with existing handlers (OpenAI, NIM, Azure) and correctly follows the established pattern: imports the framework client, constructs it from the config excluding non-client fields, and applies the standard patching pipeline.

packages/nvidia_nat_llama_index/src/nat/plugins/llama_index/llm.py (2)

27-27: LGTM!

Import is correctly placed alphabetically and follows the established pattern.


112-119: LGTM!

The LiteLLM handler implementation for LlamaIndex is consistent with existing handlers and correctly follows the established pattern: imports from llama_index.llms.litellm, constructs the client from the filtered config, and applies the standard patching pipeline.

@willkill07 willkill07 force-pushed the wkk_litellm-support-for-other-frameworks branch from 8e42844 to 229ac8b Compare September 30, 2025 20:56
@willkill07 willkill07 force-pushed the wkk_litellm-support-for-other-frameworks branch from 229ac8b to a92098b Compare September 30, 2025 22:22
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: 0

🧹 Nitpick comments (1)
packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py (1)

105-119: Implementation follows established pattern correctly.

The litellm_agno handler correctly mirrors the structure of nim_agno and openai_agno:

  • Excludes the appropriate fields (type, thinking, model_name)
  • Uses by_alias=True and exclude_none=True for serialization
  • Applies the same post-configuration patching via _patch_llm_based_on_config

Consider adding a return type hint for consistency with coding guidelines. Based on the async generator pattern with yield, the signature should be:

 @register_llm_client(config_type=LiteLlmModelConfig, wrapper_type=LLMFrameworkEnum.AGNO)
-async def litellm_agno(llm_config: LiteLlmModelConfig, _builder: Builder):
+async def litellm_agno(llm_config: LiteLlmModelConfig, _builder: Builder) -> typing.AsyncGenerator:

Note: The existing handlers (nim_agno, openai_agno) also lack return type hints, so this is a consistency issue across the file rather than specific to this change.

As per coding guidelines.

📜 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 8e42844 and a92098b.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (7)
  • docs/source/workflows/llms/index.md (3 hunks)
  • packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py (2 hunks)
  • packages/nvidia_nat_crewai/src/nat/plugins/crewai/llm.py (2 hunks)
  • packages/nvidia_nat_langchain/pyproject.toml (1 hunks)
  • packages/nvidia_nat_langchain/src/nat/plugins/langchain/llm.py (2 hunks)
  • packages/nvidia_nat_llama_index/pyproject.toml (1 hunks)
  • packages/nvidia_nat_llama_index/src/nat/plugins/llama_index/llm.py (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • packages/nvidia_nat_langchain/src/nat/plugins/langchain/llm.py
  • docs/source/workflows/llms/index.md
  • packages/nvidia_nat_llama_index/pyproject.toml
  • packages/nvidia_nat_crewai/src/nat/plugins/crewai/llm.py
  • packages/nvidia_nat_llama_index/src/nat/plugins/llama_index/llm.py
🧰 Additional context used
📓 Path-based instructions (8)
**/*.{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:

  • packages/nvidia_nat_agno/src/nat/plugins/agno/llm.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:

  • packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py
packages/*/src/**/*.py

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

Importable Python code inside packages must live under packages//src/

Files:

  • packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py
{src/**/*.py,packages/*/src/**/*.py}

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

All public APIs must have Python 3.11+ type hints on parameters and return values; prefer typing/collections.abc abstractions; use typing.Annotated when useful

Files:

  • packages/nvidia_nat_agno/src/nat/plugins/agno/llm.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 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.

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:

  • packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py
  • packages/nvidia_nat_langchain/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.

Files:

  • packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py
  • packages/nvidia_nat_langchain/pyproject.toml
packages/*/pyproject.toml

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

packages/*/pyproject.toml: Each package must contain a pyproject.toml
In packages, declare a dependency on nvidia-nat or packages starting with nvidia-nat-
Use ~= version constraints (e.g., ~=1.0) for dependencies

Files:

  • packages/nvidia_nat_langchain/pyproject.toml
{packages/*/pyproject.toml,uv.lock}

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

Add new dependencies to both pyproject.toml (alphabetically) and uv.lock via uv pip install --sync

Files:

  • packages/nvidia_nat_langchain/pyproject.toml
🧠 Learnings (1)
📚 Learning: 2025-09-23T18:39:15.023Z
Learnt from: CR
PR: NVIDIA/NeMo-Agent-Toolkit#0
File: .cursor/rules/general.mdc:0-0
Timestamp: 2025-09-23T18:39:15.023Z
Learning: Applies to packages/*/pyproject.toml : In packages, declare a dependency on nvidia-nat or packages starting with nvidia-nat-

Applied to files:

  • packages/nvidia_nat_langchain/pyproject.toml
🧬 Code graph analysis (1)
packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py (3)
src/nat/llm/litellm_llm.py (1)
  • LiteLlmModelConfig (32-52)
src/nat/builder/framework_enum.py (1)
  • LLMFrameworkEnum (19-25)
src/nat/builder/builder.py (1)
  • Builder (68-290)
🔇 Additional comments (3)
packages/nvidia_nat_agno/src/nat/plugins/agno/llm.py (2)

24-24: LGTM!

The import follows the established pattern and is correctly placed with other LLM config imports.


108-108: Verify LiteLLM import path in llm.py:108
No local definition of LiteLLM was found in the repo; please confirm that agno.models.litellm.chat.LiteLLM exists in the installed AGNO package.

packages/nvidia_nat_langchain/pyproject.toml (1)

26-26: Lock file synced: Verified langchain-litellm~=0.2.3 entry in uv.lock.

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: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/nat/cli/main.py (1)

16-24: Dual/contradictory license headers.

File includes both Apache‑2.0 and a proprietary SPDX block. This conflicts with repo policy.

-# SPDX-FileCopyrightText: Copyright (c) 2024-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
-# SPDX-License-Identifier: LicenseRef-NvidiaProprietary
-#
-# NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
-# property and proprietary rights in and to this material, related
-# documentation and any modifications thereto. Any use, reproduction,
-# disclosure or distribution of this material and related documentation
-# without an express license agreement from NVIDIA CORPORATION or
-# its affiliates is strictly prohibited.

Ensure only the Apache‑2.0 header remains. As per coding guidelines.

🧹 Nitpick comments (3)
src/nat/cli/main.py (3)

29-35: Add return type and a concise Google‑style docstring to run_cli.

Public APIs must have type hints and docstrings.

-def run_cli():
+def run_cli() -> None:
+    """Run the NAT CLI entrypoint.
+
+    Sets Transformers verbosity to reduce noise, adjusts sys.path for in-repo runs,
+    then invokes `nat.cli.entrypoint.cli`.
+    """

As per coding guidelines.


46-56: Annotate return type and tighten the docstring for run_cli_aiq_compat.

Match public API typing; make docstring Google‑style.

-def run_cli_aiq_compat():
-    "Entrypoint for the `aiq` compatibility command"
+def run_cli_aiq_compat() -> None:
+    """Entrypoint for the `aiq` compatibility command.
+
+    Emits a deprecation warning and dispatches to `run_cli`.
+    """

As per coding guidelines.


36-39: Minimize sys.path mutations for import hygiene.

Current guard is fine for in‑repo runs, but long‑term prefer package‑relative imports or entrypoints to avoid path tweaks.

📜 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 a92098b and 5f436ac.

📒 Files selected for processing (1)
  • src/nat/cli/main.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (6)
**/*.{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:

  • src/nat/cli/main.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:

  • src/nat/cli/main.py
src/**/*.py

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

All importable Python code must live under src/ (or packages//src/)

Files:

  • src/nat/cli/main.py
src/nat/**/*

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

Changes in src/nat should prioritize backward compatibility

Files:

  • src/nat/cli/main.py

⚙️ CodeRabbit configuration file

This directory contains the core functionality of the toolkit. Changes should prioritize backward compatibility.

Files:

  • src/nat/cli/main.py
{src/**/*.py,packages/*/src/**/*.py}

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

All public APIs must have Python 3.11+ type hints on parameters and return values; prefer typing/collections.abc abstractions; use typing.Annotated when useful

Files:

  • src/nat/cli/main.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 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.

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:

  • src/nat/cli/main.py

@willkill07
Copy link
Member Author

/merge

@rapids-bot rapids-bot bot merged commit b5541b5 into NVIDIA:release/1.3 Oct 1, 2025
17 checks passed
nouraellm pushed a commit to nouraellm/NeMo-Agent-Toolkit that referenced this pull request Oct 3, 2025
…ex (NVIDIA#881)

This PR extends the LiteLLM type introduced in NVIDIA#726 to be supported in other frameworks.

Closes

## By Submitting this PR I confirm:
- I am familiar with the [Contributing Guidelines](https://github.com/NVIDIA/NeMo-Agent-Toolkit/blob/develop/docs/source/resources/contributing.md).
- 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

- **New Features**
  - Added LiteLLM as a supported LLM provider across AGNO, CrewAI, LangChain, LangChain, and LlamaIndex integrations.
  - Enables configuring LiteLLM with common parameters (model_name, api_key, base_url, seed, temperature, top_p, max_retries).

- **Documentation**
  - Updated LLM providers table and added LiteLLM setup/config guidance, including Azure OpenAI area and workflows docs.

- **Chores**
  - Added runtime dependencies for LiteLLM integrations (LangChain, LlamaIndex) and suppresses transformers warnings in the CLI.

Authors:
  - Will Killian (https://github.com/willkill07)

Approvers:
  - Eric Evans II (https://github.com/ericevans-nv)
  - https://github.com/Salonijain27

URL: NVIDIA#881
@willkill07 willkill07 deleted the wkk_litellm-support-for-other-frameworks branch October 23, 2025 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request New feature or request non-breaking Non-breaking change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants