refactor(streaming): remove ChatNVIDIA streaming patch#1607
Merged
refactor(streaming): remove ChatNVIDIA streaming patch#1607
Conversation
Contributor
Greptile OverviewGreptile SummaryThis PR removes the custom
The changes align with the base branch Key considerations:
|
| Filename | Overview |
|---|---|
| nemoguardrails/llm/models/langchain_initializer.py | removed custom patch import, now uses standard ChatNVIDIA from langchain_nvidia_ai_endpoints, simplified docstring and error handling, added type hint to _PROVIDER_INITIALIZERS |
| nemoguardrails/llm/providers/_langchain_nvidia_ai_endpoints_patch.py | removed 107-line custom patch module that wrapped ChatNVIDIA with streaming decorators |
Sequence Diagram
sequenceDiagram
participant App as Application
participant Init as langchain_initializer
participant Patch as _langchain_nvidia_ai_endpoints_patch (REMOVED)
participant Native as langchain_nvidia_ai_endpoints.ChatNVIDIA
Note over App,Native: BEFORE: Custom Patch Flow
App->>Init: Initialize NVIDIA model
Init->>Patch: Import custom ChatNVIDIA
Patch->>Native: Inherit from ChatNVIDIAOriginal
Patch->>Patch: Apply stream_decorator
Patch->>Patch: Apply async_stream_decorator
Patch-->>Init: Return patched ChatNVIDIA
Init-->>App: Return model with streaming support
Note over App,Native: AFTER: Native Implementation Flow
App->>Init: Initialize NVIDIA model
Init->>Native: Import ChatNVIDIA directly
Native-->>Init: Return ChatNVIDIA
Init-->>App: Return model with native streaming
a97a9be to
48a77d8
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Remove the custom ChatNVIDIA patch that added streaming decorators. Now using the standard ChatNVIDIA from langchain_nvidia_ai_endpoints directly since LangChain callback-based streaming has been dropped.
48a77d8 to
bab7aab
Compare
tgasser-nv
approved these changes
Feb 3, 2026
Collaborator
There was a problem hiding this comment.
Looks great, just a couple of things to do before merging:
- Could you just add the docstring back before merging (see comment).
- Also can you run streaming and non-streaming nemoguardrails chats through ChatNVIDIA to make sure nothing broke after removing the patch?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_langchain_nvidia_ai_endpoints_patch.pymodule that patched ChatNVIDIA with streaming decorators_init_nvidia_modelto use standardChatNVIDIAfromlangchain_nvidia_ai_endpointsdirectly