You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#### Overview
Fix LangChain serialization, by adding a LangChain specific codec
- [x] I confirm this contribution is my own work, or I have the right to submit it under this project's license.
- [x] I searched existing issues and open pull requests, and this does not duplicate existing work.
#### Details
* This fixes the ability to use LLM intercepts
* First pass at documenting the immutability of `LLMRequest` and the immutability of `AnnotatedLLMRequest` (I need to go back and updagte this for the other language bindings)
#### Where should the reviewer start?
`python/nemo_relay/integrations/langchain/_serialization.py`
#### Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
- Closes #
## Summary by CodeRabbit
* **Documentation**
* Clarified that LLM request objects are immutable; examples now show returning new request instances instead of mutating originals.
* **Integrations**
* LangChain integration reworked to use a dedicated codec for reliable request/response translation, role normalization, tool-call handling, and preservation of extra fields.
* **Tests**
* Expanded LangChain and middleware tests, including codec round-trip and interceptor behavior; added an end-to-end agent integration test.
[](https://app.coderabbit.ai/change-stack/NVIDIA/NeMo-Relay/pull/165?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)
Authors:
- David Gardner (https://github.com/dagardner-nv)
Approvers:
- Will Killian (https://github.com/willkill07)
URL: NVIDIA#165
Copy file name to clipboardExpand all lines: docs/build-plugins/code-examples.mdx
+5-2Lines changed: 5 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,6 +13,8 @@ This page collects concrete examples for the surrounding guide area.
13
13
14
14
Use an LLM request intercept when a plugin needs to inject tenant or routing metadata into every provider request.
15
15
16
+
LLM request intercepts receive three arguments: `name`, `request`, and `annotated`. The `request` object is immutable, however it is possible to return a new instance of the request with edits, the exception to this is when the intercept is written in Rust.
0 commit comments