-
Notifications
You must be signed in to change notification settings - Fork 410
feat: LiteLLM support for LangChain/LangGraph, Agno, CrewAI, LlamaIndex #881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: LiteLLM support for LangChain/LangGraph, Agno, CrewAI, LlamaIndex #881
Conversation
WalkthroughAdds LiteLLM support across AGNO, CrewAI, LangChain, and LlamaIndex by registering new handlers that build LiteLLM clients from Changes
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
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests
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 |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this 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
⛔ Files ignored due to path filters (1)
uv.lockis 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
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:
packages/nvidia_nat_agno/src/nat/plugins/agno/llm.pypackages/nvidia_nat_llama_index/pyproject.tomldocs/source/workflows/llms/index.mdpackages/nvidia_nat_langchain/src/nat/plugins/langchain/llm.pypackages/nvidia_nat_llama_index/src/nat/plugins/llama_index/llm.pypackages/nvidia_nat_langchain/pyproject.tomlpackages/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 apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-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 thepyproject.tomlfile.
Files:
packages/nvidia_nat_agno/src/nat/plugins/agno/llm.pypackages/nvidia_nat_llama_index/pyproject.tomlpackages/nvidia_nat_langchain/src/nat/plugins/langchain/llm.pypackages/nvidia_nat_llama_index/src/nat/plugins/llama_index/llm.pypackages/nvidia_nat_langchain/pyproject.tomlpackages/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/_staticdirectory.
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.tomlpackages/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 usesmodel(notmodel_name) and acceptstemperature,top_p,max_tokens,seed, andmax_retriesas top‐level args; your use ofmodel_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 thatOpenAIChatexists atagno.models.openai.chatin the AGNO version pinned to this project (install AGNO and inspect its source or docs if needed).
105-119: Verify external LiteLLM API before mergingThe plugin imports
agno.models.litellm.chat.LiteLLMand relies on itsinvoke,ainvoke,invoke_stream, andainvoke_streammethods. Since that module isn’t part of this repo, ensure your deployedagnopackage version exposesLiteLLMat that path and includes all four methods.
72-72: Verify AGNO Nvidia import pathEnsure the AGNO version pinned in NAT’s CI/CD defines a
Nvidiaclass in theagno.models.nvidia.nvidiamodule.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.
8e42844 to
229ac8b
Compare
Signed-off-by: Will Killian <[email protected]>
229ac8b to
a92098b
Compare
There was a problem hiding this 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_agnohandler correctly mirrors the structure ofnim_agnoandopenai_agno:
- Excludes the appropriate fields (
type,thinking,model_name)- Uses
by_alias=Trueandexclude_none=Truefor serialization- Applies the same post-configuration patching via
_patch_llm_based_on_configConsider 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
⛔ Files ignored due to path filters (1)
uv.lockis 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
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:
packages/nvidia_nat_agno/src/nat/plugins/agno/llm.pypackages/nvidia_nat_langchain/pyproject.toml
packages/**/*
⚙️ CodeRabbit configuration file
packages/**/*: - This directory contains optional plugin packages for the toolkit, each should contain apyproject.tomlfile. - Thepyproject.tomlfile should declare a dependency onnvidia-nator another package with a name starting
withnvidia-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 thepyproject.tomlfile.
Files:
packages/nvidia_nat_agno/src/nat/plugins/agno/llm.pypackages/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 ofLiteLLMwas found in the repo; please confirm thatagno.models.litellm.chat.LiteLLMexists in the installed AGNO package.packages/nvidia_nat_langchain/pyproject.toml (1)
26-26: Lock file synced: Verifiedlangchain-litellm~=0.2.3entry in uv.lock.
Signed-off-by: Will Killian <[email protected]>
There was a problem hiding this 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 torun_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 forrun_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
📒 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
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:
src/nat/cli/main.py
|
/merge |
…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
Description
This PR extends the LiteLLM type introduced in #726 to be supported in other frameworks.
Closes
By Submitting this PR I confirm:
Summary by CodeRabbit
New Features
Documentation
Chores