-
Notifications
You must be signed in to change notification settings - Fork 559
chore(llm): remove deprecated llm_params module #1475
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
base: develop
Are you sure you want to change the base?
Conversation
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.
Greptile Overview
Greptile Summary
This PR removes the deprecated nemoguardrails.llm.params module and its associated tests as part of a planned deprecation cycle. The module provided a context manager pattern (llm_params()) for temporarily adjusting LLM parameters, which was deprecated in v0.17.0 and scheduled for removal in v0.19.0. The functionality has been replaced by passing parameters directly to llm_call() using the llm_params argument. This cleanup simplifies the API surface by removing 131 lines of production code and 321 lines of test code. The change aligns with the project's architectural shift toward leveraging LangChain's universal .bind() method for parameter binding across all model packages, reducing complexity in the NeMo Guardrails LLM integration layer.
Important Files Changed
| Filename | Score | Overview |
|---|---|---|
nemoguardrails/llm/params.py |
5/5 | Removed deprecated module containing LLMParams context manager class and helper functions (131 lines) |
tests/test_llm_params.py |
5/5 | Deleted comprehensive test suite for the removed params module (321 lines) |
Confidence score: 5/5
- This PR is safe to merge with minimal risk
- The removal follows a documented deprecation schedule (deprecated v0.17.0, removal planned for v0.19.0), and the functionality has been replaced by a simpler direct parameter-passing approach that has been available for multiple versions
- No files require special attention; this is straightforward cleanup of deprecated code with no remaining references
Sequence Diagram
sequenceDiagram
participant Developer
2 files reviewed, no comments
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
3717caa to
9d1a3ab
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.
Greptile Overview
Greptile Summary
Removes the deprecated nemoguardrails.llm.params module containing the llm_params context manager and associated test file. This was scheduled for removal in v0.19.0.
Key Changes:
- Deleted
nemoguardrails/llm/params.py(132 lines) - containedLLMParamscontext manager class - Deleted
tests/test_llm_params.py(321 lines) - contained unit tests for the deprecated functionality - No remaining references to the deprecated module found in the codebase
- The replacement pattern (passing
llm_paramsas argument tollm_call()) was implemented in v0.17.0 via #1387
Migration Path:
Users should now pass parameters directly: await llm_call(llm, prompt, llm_params={"temperature": 0.7})
Confidence Score: 5/5
- This PR is safe to merge with no risk
- Clean removal of deprecated code that was scheduled for deletion. No remaining references found in codebase, replacement functionality already implemented and tested in v0.17.0, and comprehensive E2E tests exist for the new pattern.
- No files require special attention
Important Files Changed
File Analysis
| Filename | Score | Overview |
|---|---|---|
| nemoguardrails/llm/params.py | 5/5 | Deleted deprecated llm_params context manager module (132 lines removed) |
| tests/test_llm_params.py | 5/5 | Deleted deprecated tests for llm_params context manager (321 lines removed) |
Sequence Diagram
sequenceDiagram
participant User as User Code
participant Old as llm_params (DEPRECATED)
participant New as llm_call()
participant LLM as Language Model
Note over User,LLM: Before v0.19.0 (Old Pattern - REMOVED)
User->>Old: with llm_params(llm, temperature=0.7)
Old->>LLM: Temporarily set temperature=0.7
User->>LLM: await llm_call(llm, prompt)
LLM-->>User: response
Old->>LLM: Restore original temperature
Note over User,LLM: After v0.17.0 (New Pattern - CURRENT)
User->>New: await llm_call(llm, prompt, llm_params={"temperature": 0.7})
New->>LLM: llm.bind(temperature=0.7)
LLM-->>New: bound_llm
New->>LLM: bound_llm.ainvoke(prompt)
LLM-->>New: response
New-->>User: response
Note over User,New: Original LLM unchanged - no side effects
2 files reviewed, no comments
Description
Removes the deprecated
nemoguardrails.llm.paramsmodule that was scheduled for removal in v0.19.0. Thellm_paramscontext manager has been replaced by passing parameters directly tollm_call()usingthe
llm_paramsargument.Modified Files
nemoguardrails/llm/params.py(deleted - 131 lines removed)tests/test_llm_params.py(deleted - 321 lines removed)References