docs: documentation for langchain decoupling - #1854
Conversation
10bad9b to
1126baa
Compare
1126baa to
085593f
Compare
Documentation preview |
…routing matrix, engine tables)
085593f to
82aaebc
Compare
📝 WalkthroughWalkthroughDocumentation for NeMo Guardrails 0.22 explaining the new LLM framework routing model. Introduces DefaultFramework for OpenAI-compatible endpoints (httpx-based, no LangChain) and LangChain for other providers, with configuration guidance, engine mappings, runtime controls, and troubleshooting. ChangesNeMo Guardrails 0.22 Framework Transition Documentation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/configure-rails/configuration-reference.md`:
- Line 58: The docs entry for `models.parameters` incorrectly references the
`engine: langchain/<provider>` syntax; update the sentence to remove that
invalid syntax and clarify that LangChain-routed engines should use bare
provider engine names (e.g. `anthropic`, `cohere`) with framework selection
handled separately, while keeping the existing note about DefaultFramework
engines (`openai`, `nim`, `nvidia_ai_endpoints`, `ollama`) passing
OpenAI-compatible params like `temperature`, `max_tokens`, `base_url`,
`api_key`.
In `@docs/upgrade/0.22-framework-transition.md`:
- Around line 211-214: The fenced code block containing the error message is
unlabeled and triggers MD040; update the block to include a language label
(e.g., change ``` to ```text) so the block becomes a labeled fenced code block
with the error lines "ValueError: No default base_url for provider 'cohere'."
and "Set it explicitly in model parameters: parameters.base_url".
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 53463eb7-b6bf-4aca-9af7-0f5510c6caeb
📒 Files selected for processing (5)
docs/about/supported-llms.mddocs/configure-rails/configuration-reference.mddocs/index.mddocs/troubleshooting.mddocs/upgrade/0.22-framework-transition.md
Greptile SummaryThis PR adds the must-ship 0.22 documentation set for the LangChain decoupling: a routing matrix, a migration guide, configuration-reference engine table split, troubleshooting entries, and a table-expand UI widget backed by new CSS and JavaScript.
|
| Filename | Overview |
|---|---|
| docs/_static/js/table-expander.js | New IIFE that powers the "Expand table" button feature. Functional but the modal dialog is missing aria-labelledby and a focus trap, both needed for WCAG-compliant keyboard navigation. |
| docs/_static/css/custom.css | Adds CSS classes for the table-expander modal and button. Styles are clean with responsive breakpoints, hover/focus states, and scroll locking via body.table-expander-modal-open. |
| docs/about/supported-llms.md | New routing matrix table covering DefaultFramework and LangChain-routed engines. Previously flagged issues (google_genai, azure naming, deepseek ambiguity, URL) were addressed in prior commits. |
| docs/migration/0.22.md | Comprehensive migration guide covering OpenAI-compatible providers, mixed-shape configs, Azure paths, custom providers, and what didn't change. Well-structured with concrete before/after YAML examples. |
| docs/configure-rails/configuration-reference.md | Engine section reorganized into Built-in Engines and LangChain Engines tables. google_genai is now present. Embedding Engines table (3 rows) is intentionally a short list; full mapping is deferred to supported-llms.md. |
| docs/troubleshooting.md | New "LLM Framework Routing" section documents NEMOGUARDRAILS_LLM_FRAMEWORK, set_default_framework, and three new error entries. Wording is accurate and links to the migration guide. |
| docs/conf.py | Registers the new js/table-expander.js in html_js_files. Change is minimal and correct. |
| docs/index.md | Adds "Migrating to 0.22" to the Reference toctree. Functional navigation change. |
| docs/about/release-notes.md | Adds a 0.22.0 section covering the LangChain-optional change, new extension protocols, and the public testing surface. Clean and accurate. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[User sets engine in config.yml] --> B{NEMOGUARDRAILS_LLM_FRAMEWORK?}
B -- default built-in --> C{Engine is OpenAI-compatible?}
B -- langchain --> F[LangChain framework]
C -- yes --> D[Built-in httpx client]
C -- no --> E[ValueError: No default base_url]
E --> G[Set NEMOGUARDRAILS_LLM_FRAMEWORK=langchain OR use engine: openai + parameters.base_url]
F --> H[anthropic / azure / cohere / google_genai / vertexai / huggingface_*]
D --> I[Inference result returned to rails]
H --> I
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.
---
### Issue 1 of 2
docs/_static/js/table-expander.js:27-54
**Modal dialog missing `aria-labelledby` association**
The `createModal()` function sets `role="dialog"` and `aria-modal="true"` on the outer element, but never assigns an `id` to the title `p` element or an `aria-labelledby` attribute on the modal pointing to that `id`. WCAG 4.1.2 and the ARIA `dialog` role both require an accessible name, so screen readers will announce the dialog with no title when it opens. Adding `title.id = "table-expander-modal-title"` in `createModal` and then `modal.setAttribute("aria-labelledby", "table-expander-modal-title")` would satisfy the requirement.
### Issue 2 of 2
docs/_static/js/table-expander.js:57-112
**No focus trap — Tab key exits the open modal**
`openModal` moves initial focus to the close button (`modalParts.closeButton.focus()`), but there is no listener to cycle focus back into the dialog when the user presses Tab past the last focusable element. Keyboard users will tab through the close button and land on links in the obscured page content behind the backdrop, violating WCAG 2.1 SC 2.1.2 (No Keyboard Trap) in the inverse direction. The standard fix is a `keydown` listener that intercepts Tab/Shift-Tab while the modal is open and wraps focus to the last/first focusable descendant of the dialog respectively.
Reviews (6): Last reviewed commit: "docs: polish" | Re-trigger Greptile
fa85feb to
7594e91
Compare
Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Pouyanpi I made lots of changes. I hope it helps explain things with better clarity. Please let me know if anything's incorrect. Approving in case you could make final touch-ups and merge overnight my time. |
|
@Pouyanpi -- The docs team's guidance is to put migration guide under Reference. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Description
Add must-ship 0.22 documentation for the LangChain decoupling: troubleshooting entry for NEMOGUARDRAILS_LLM_FRAMEWORK, 0.22-framework-transition.md migration guide, supported-llms.md routing matrix, and configuration-reference.md engine table split between DefaultFramework and LangChain-routed.
Important
Blocked on #1857.
Summary by CodeRabbit