Skip to content

Sync midstream to upstream#16

Merged
m-misiura merged 18 commits into
trustyai-explainability:developfrom
m-misiura:sync-upstream-to-midstream
Nov 28, 2025
Merged

Sync midstream to upstream#16
m-misiura merged 18 commits into
trustyai-explainability:developfrom
m-misiura:sync-upstream-to-midstream

Conversation

@m-misiura
Copy link
Copy Markdown
Collaborator

No description provided.

tgasser-nv and others added 18 commits November 13, 2025 18:39
…-NeMo#1490)

* Add full path to server uvicorn.run() call

* Remove unused files

* Add Procfile with the commands to run Guardrails, content safety mock, and APP LLM mock

* Add simple script to validate Guardrails and mocks are running correctly

* Restructure configs into mocks and Guardrails configs

* Add tests against validate_mocks.py

* Convert f-string logging statements to %s format

* Add tests for validate_mocks.py

* Remove script-testing unit-tests

* Add pyproject.toml 'benchmark' extra to install honcho and requests

* Add workers CLI argument to pass to uvicorn app invocation

* Use httpx rather than requests to call and validate mocks

* Revert "Add pyproject.toml 'benchmark' extra to install honcho and requests"

This reverts commit 20f3726.

* Removed commented line in Procfile

* Add README explaining core-banchmarking

* Small README tweaks
…VIDIA-NeMo#1504)

* feat(llm): Add async streaming support to ChatNVIDIA provider

Enables stream_async() to work with ChatNVIDIA/NIM models by
implementing async streaming decorator and _agenerate method. Prior to
this fix, stream_async() would fail with NIM engine configurations.

* fix: ensure stream_async background task completes before exit (NVIDIA-NeMo#1508)

Wrap the returned iterator to await the background generation task in a
finally block, preventing "Task was destroyed but it is pending"
warning.
Add overloaded type signatures to provide accurate return types based on
the include_generation_metadata parameter.
* refactor(langchain): migrate imports to canonical langchain-core paths

Migrate all imports from deprecated proxy paths to canonical
langchain-core paths
to ensure compatibility with LangChain 1.x. Changes include:
- Use `from langchain_core.language_models import BaseLLM,
BaseChatModel`
- Remove proxy imports from `langchain.chat_models.base`
- Standardize submodule imports to top-level
langchain_core.language_models

This ensures forward compatibility with LangChain 1.x where proxy
imports from the main langchain package will be removed.

* refactor(langchain)!: remove deprecated Chain support from action dispatcher

Remove support for registering LangChain Chain objects as actions in
favor of
the modern Runnable interface. Chain support is deprecated in LangChain
1.x
and users should migrate to using Runnable objects instead.

- Remove Chain handling logic from action_dispatcher.py
- Remove Chain-based tests from test_runnable_rails.py
- Add deprecation warning in python-api.md documentation

* refactor(langchain)!: remove SummarizeDocument built-in action

Remove the built-in SummarizeDocument action which relied on deprecated
LangChain Chain features. Users who need document summarization should
implement custom actions using LangChain Runnable chains.

- Delete nemoguardrails/actions/summarize_document.py
- Remove related import from llm/filters.py

* feat(langchain): add LangChain 1.x compatibility with fallback patterns

Add try/except fallback patterns in examples to support both LangChain
0.x and 1.x. When using LangChain 1.x, legacy Chain features are
imported from langchain-classic package with helpful error messages.

This allows examples to work seamlessly across LangChain versions
without requiring code changes from users.

- Add fallback imports for RetrievalQA, embeddings, text splitters,
vectorstores
- Provide clear error messages directing users to install
langchain-classic

* refactor(langchain): update runtime imports to langchain-core

Update Colang runtime imports to use canonical langchain-core paths for
callbacks and runnables. Part of the broader migration to langchain-core
for LangChain 1.x compatibility.

* docs(langchain): rewrite custom LLM provider guide with BaseChatModel support

Complete rewrite of the custom LLM provider documentation with:
- Separate comprehensive guides for BaseLLM (text completion) and
BaseChatModel (chat)
- Correct method signatures (_call vs _generate)
- Proper async implementations
- Clear registration instructions (register_llm_provider vs
register_chat_provider)
- Working code examples with correct langchain-core imports
- Important notes on choosing the right base class

This addresses the gap where users were not properly guided on
implementing
custom chat models and were being directed to the wrong interface.

* feat(langchain): extend dependency constraints to support LangChain 1.x

Extend LangChain dependency constraints to support both 0.x and 1.x versions:
- langchain: >=0.2.14,<0.4.0 → >=0.2.14,<2.0.0
- langchain-core: >=0.2.14,<0.4.0 → >=0.2.14,<2.0.0
- langchain-community: >=0.2.5,<0.4.0 → >=0.2.5,<2.0.0
NVIDIA-NeMo#1509)

* fix(cli): Fix TypeError in v2.x chat due to incorrect State/dict conversion

Fixes incorrect type assumptions in PR NVIDIA-NeMo#1380 that caused TypeError when
using v2.x chat CLI. The bug incorrectly assumed process_events_async
returns dict and tried to convert State objects with
State(**output_state).

Changes:
- Fix type annotations in LLMRails.process_events_async to return
Union[dict, State]
- Remove incorrect asdict() conversion and State(**) reconstruction in
chat.py
- Add integration tests to prevent regression
* chore(pre-commit): switch to ruff for linting and formatting

Replace isort and black with ruff and ruff-format in pre-commit config.
Update hooks to use ruff for both linting and formatting, specifying
versions v0.9.6 and v0.11.2. Remove isort and black hooks, and keep
other hooks unchanged.

* feat(imports): add utilities for optional dependencies

Introduced a new `imports.py` module providing utilities to handle optional
dependencies. This includes functions for importing optional modules with
customizable error handling, checking for their presence, and version
validation. Also added a mapping for commonly used optional dependencies
and a helper to retrieve them with predefined settings.
* ci: add lint workflow and unify coverage reporting

- Introduced `.github/workflows/lint.yml` for running pre-commit hooks on
  PRs and pushes to main/develop branches.
- Updated `_test.yml` to support coverage reporting and uploading to
  Codecov, controlled via `with-coverage` input.
- Enhanced `pr-tests.yml` to run tests with coverage for Python 3.11.
- Added `pr-tests-skip.yml` to skip tests for non-code PRs.
- Removed obsolete `test-coverage-report.yml` workflow.
* docs: clean up documentation language and references

Co-authored-by: Chris Parisien <64271260+cparisien@users.noreply.github.com>
Signed-off-by: Pouyan <13303554+Pouyanpi@users.noreply.github.com>

---------

Signed-off-by: Pouyan <13303554+Pouyanpi@users.noreply.github.com>
Co-authored-by: Chris Parisien <64271260+cparisien@users.noreply.github.com>
Signed-off-by: Mike McKiernan <mmckiernan@nvidia.com>
@m-misiura m-misiura changed the title Sync upstream to midstream Sync midstream to upstream Nov 28, 2025
@m-misiura m-misiura requested review from RobGeada and removed request for RobGeada November 28, 2025 16:47
@m-misiura m-misiura merged commit 48a7021 into trustyai-explainability:develop Nov 28, 2025
4 of 22 checks passed
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.

4 participants