Skip to content

feat: add request codecs to manual LLM calls - #1441

Merged
willkill07 merged 3 commits into
NVIDIA:mainfrom
willkill07:feat/manual-llm-request-codecs
Oct 21, 2026
Merged

willkill07 merged 3 commits into
NVIDIA:mainfrom
willkill07:feat/manual-llm-request-codecs

Conversation

@willkill07

@willkill07 willkill07 commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Overview

Add request codecs to manual Python and Node.js LLM calls so telemetry sanitizers can use the same request-codec support as Rust. Codecs sanitize and annotate the telemetry copy without changing the caller's request.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Add an optional codec keyword to Python's llm.call(), including its native binding, type stub, and docstrings.
  • Append optional codecDecode and codecEncode callbacks to Node.js's llmCall(). Require both callbacks together and preserve existing argument positions.
  • Reuse the existing codec adapters and Rust runtime behavior. Manual calls still skip request and execution intercepts.
  • Cover request annotations, sanitization, unchanged caller requests, built-in and custom Python codecs, and incomplete Node.js callback pairs.
  • Update the existing provider-codec guide with simple instructions for manual calls.

Validation:

  • just test-python: 83 native tests, 1,045 Python tests, and 24 plugin-example tests passed.
  • just test-node: 5 native tests, 503 JavaScript tests, and 26 plugin-example tests passed.
  • just docs-linkcheck: passed. Fern skipped the published-redirect comparison because its service returned HTTP 403.
  • Repository pre-commit hooks passed on the staged changes.

These additions are optional and preserve existing calls.

Where should the reviewer start?

Start with python/nemo_relay/llm.py and crates/node/src/api/mod.rs for the public APIs. Then review the manual-request-codec cases in python/tests/test_llm.py and crates/node/tests/llm_tests.mjs for the behavior they preserve.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • Relates to: none

Summary by CodeRabbit

  • New Features

    • Manual LLM calls now support optional request codecs in Python, Node.js, and Rust.
    • Codecs can sanitize and annotate telemetry while preserving the caller’s original request.
    • Node.js requires decode and encode callbacks to be provided together.
  • Documentation

    • Added guidance and examples for configuring request codecs across supported languages.
  • Tests

    • Added coverage for codec behavior, sanitization options, request immutability, and callback validation.

@willkill07
willkill07 requested review from a team as code owners October 21, 2026 16:11
@github-actions github-actions Bot added size:S PR is small Feature a new feature lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code labels Oct 21, 2026
@willkill07 willkill07 added this to the 0.11 milestone Oct 21, 2026
@willkill07 willkill07 self-assigned this Oct 21, 2026
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NeMo-Relay/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: 7ffe3689-e256-4cb9-8909-33b66aabddd2
📥 Commits

Reviewing files that changed from the base of the PR and between 5da784f and b816e73.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: NVIDIA/NeMo-Relay/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Enterprise
  • Run ID: feefa5d8-5f97-482c-9c96-69bfb9c4d28e
📥 Commits

Reviewing files that changed from the base of the PR and between c528678 and 5da784f.

📒 Files selected for processing: 2
  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • python/tests/test_llm.py

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 1 remain after this review.

📜 Recent review details
⏰ Context from checks skipped due to timeout: 32
  • GitHub Check: Node.js / Package (windows-arm64)
  • GitHub Check: Node.js / Package (linux-musl-amd64)
  • GitHub Check: Node.js / Test (linux-arm64)
  • GitHub Check: Node.js / Package (linux-musl-arm64)
  • GitHub Check: Node.js / Package (macos-arm64)
  • GitHub Check: Python / Package (linux-arm64)
  • GitHub Check: Node.js / Test (windows-amd64)
  • GitHub Check: Node.js / Test (windows-arm64)
  • GitHub Check: Node.js / Package (linux-arm64)
  • GitHub Check: Node.js / Package (linux-amd64)
  • GitHub Check: Python / Package (linux-musl-amd64)
  • GitHub Check: Python / Test (linux-arm64)
  • GitHub Check: Node.js / Package (windows-amd64)
  • GitHub Check: Rust / Test (windows-amd64)
  • GitHub Check: Node.js / Test (linux-amd64)
  • GitHub Check: Python / Test (windows-amd64)
  • GitHub Check: Python / Package (windows-amd64)
  • GitHub Check: Python / Package (linux-amd64)
  • GitHub Check: Node.js / Test (macos-arm64)
  • GitHub Check: Python / Package (windows-arm64)
  • GitHub Check: Python / Package (linux-musl-arm64)
  • GitHub Check: Python / Test (macos-arm64)
  • GitHub Check: Rust / Test (linux-amd64)
  • GitHub Check: Rust / Test (windows-arm64)
  • GitHub Check: Python / Package (macos-arm64)
  • GitHub Check: Python / Test (linux-amd64)
  • GitHub Check: Python / Test (windows-arm64)
  • GitHub Check: Node.js / Package OpenClaw plugin
  • GitHub Check: Check / Run
  • GitHub Check: Rust / Test (linux-arm64)
  • GitHub Check: Rust / Test (macos-arm64)
  • GitHub Check: Preview docs
🧰 Additional context used
📚 Code guidelines: 1
CONTRIBUTING.md — configured
📓 Path-based instructions: 4
Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.

⚙️ CodeRabbit configuration file

Files:

  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • python/tests/test_llm.py
Treat binding changes as public API changes.

⚙️ CodeRabbit configuration file

Files:

  • crates/python/tests/coverage/py_api_coverage_tests.rs
Applicability reference: AGENTS.md: # NeMo Relay Repository Guidance See `CONTRIBUTING.md` and `docs/contribute/testing-and-docs.mdx` for contributor details, and `.agents/skills/README.md` for the maintainer skill boundar...

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Files:

  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • python/tests/test_llm.py
Applicability reference: AGENTS.md: # NeMo Relay Repository Guidance See `CONTRIBUTING.md` and `docs/contribute/testing-and-docs.mdx` for contributor details, and `.agents/skills/README.md` for the maintainer skill boundary.

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Files:

  • crates/python/tests/coverage/py_api_coverage_tests.rs
  • python/tests/test_llm.py
🔇 Additional comments: 2
python/tests/test_llm.py: 1

73-73: LGTM!

Also applies to: 76-76, 79-79, 83-83, 92-92, 101-101

crates/python/tests/coverage/py_api_coverage_tests.rs: 1

179-179: LGTM!

Walkthrough

Python and Node.js manual LLM calls now accept request codecs and pass them to the core call parameters. Tests cover sanitization, telemetry annotation, request immutability, and manual-call intercept behavior. Node.js also validates paired codec callbacks.

Changes

Manual LLM request codecs

Layer / File(s) Summary
Node.js codec callbacks
crates/node/src/api/mod.rs, crates/node/tests/llm_tests.mjs
llm_call accepts paired codecDecode and codecEncode callbacks and passes the codec to the core call. Tests cover callback pairing and manual-call telemetry behavior.
Python codec forwarding and documentation
python/nemo_relay/llm.py, python/nemo_relay/_native.pyi, crates/python/src/py_api/mod.rs, python/tests/test_llm.py, crates/python/tests/coverage/py_api_coverage_tests.rs, docs/integrate-into-frameworks/provider-codecs.mdx
Python llm.call() and the native API accept an optional codec. The Python wrapper converts and forwards it. Tests cover manual-call behavior, and framework documentation describes codec configuration for Python, Node.js, and Rust.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Caller
  participant RuntimeAPI
  participant CoreLLMCall
  participant Telemetry
  Caller->>RuntimeAPI: Supply request codec
  RuntimeAPI->>CoreLLMCall: Pass codec
  CoreLLMCall->>Telemetry: Sanitize request copy
  Telemetry-->>Caller: Emit lifecycle data
Loading
Merge Risk: ⚪ Minimal · up to 5da78

No actionable merge-blocking risk was identified in the reviewed changes.

Pre-merge checks: Passed 5
Check name Status Explanation
Title check Passed The title uses valid Conventional Commits format with the allowed lowercase type feat, an imperative summary, no trailing period, and 44 characters.
Description check Passed The description includes the required Overview, Details, reviewer-start, and Related Issues sections. It includes the required confirmations and provides implementation details, testing results, and s…
Docstring Coverage Passed Docstring coverage is 91.67% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 12 functions across 7 files.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description includes the required Overview, Details, reviewer-start, and Related Issues sections. It includes the required confirmations and provides implementation details, testing results, and scope.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

@greysonlalonde greysonlalonde left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm ✅

@willkill07
willkill07 merged commit 044ae85 into NVIDIA:main Oct 21, 2026
71 checks passed
@willkill07
willkill07 deleted the feat/manual-llm-request-codecs branch October 30, 2026 14:46

This branch was previously deployed

1 inactive deployment
fern — b816e739 Deployed Oct 21, 2026 by willkill07 via Clean up docs preview #6186
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature a new feature lang:js PR changes/introduces Javascript/Typescript code lang:python PR changes/introduces Python code lang:rust PR changes/introduces Rust code size:S PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants