Conversation
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
📝 WalkthroughWalkthroughIntroduces schema customization for tool-based inference by adding a Changes
Sequence DiagramsequenceDiagram
actor User
participant Config as GenerateSolutionsConfig
participant Model as ToolCallingWrapper
participant Adapter as MCP Adapter
participant LLM as Language Model
participant Tool as Tool Execution
User->>Config: Provide schema_overrides
Config->>Model: Pass schema_overrides to ToolCallingWrapper
Model->>Adapter: Call format_tool_list_by_endpoint_type(tools, schema_overrides)
Adapter->>Adapter: Apply schema_overrides to each tool<br/>(rename params, update required fields)
Adapter->>Adapter: Build parameter remapping metadata
Adapter-->>Model: Return (formatted_tools, mappings)
Model->>LLM: Send formatted_tools with renamed parameters
LLM-->>Model: Return tool_call (with renamed param names)
Model->>Adapter: Call remap_tool_call(tool_name, args, mappings)
Adapter->>Adapter: Restore original tool name<br/>and parameter names
Adapter-->>Model: Return (original_tool_name, original_args)
Model->>Tool: Execute tool with original names/args
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Areas requiring attention:
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
🧰 Additional context used🧬 Code graph analysis (4)tests/test_mcp_clients.py (3)
nemo_skills/mcp/adapters.py (2)
nemo_skills/inference/generate.py (1)
nemo_skills/inference/model/tool_call.py (1)
🪛 Ruff (0.14.8)nemo_skills/mcp/adapters.py72-72: Prefer (TRY004) 72-72: Avoid specifying long messages outside the exception class (TRY003) 77-77: Prefer (TRY004) 77-77: Avoid specifying long messages outside the exception class (TRY003) 82-82: Prefer (TRY004) 82-82: Avoid specifying long messages outside the exception class (TRY003) 113-113: Avoid specifying long messages outside the exception class (TRY003) 115-115: Prefer (TRY004) 115-115: Avoid specifying long messages outside the exception class (TRY003) 193-193: Avoid specifying long messages outside the exception class (TRY003) ⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
🔇 Additional comments (14)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
wedu-nvidia
left a comment
There was a problem hiding this comment.
Thanks, it works good to me as I tested and verfied.
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: wasiahmad <wasiahmad@ucla.edu>
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: dlord <dlord@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: Cheng-Ping Hsieh <chsieh@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com>
Signed-off-by: George Armstrong <georgea@nvidia.com> Signed-off-by: dgitman <dgitman@nvidia.com>
Schema Overrides for Tool Calling
Summary
This PR adds support for schema overrides, which allow customizing how tool schemas are presented to the model without modifying the underlying tool implementation.
How It Works
Schema overrides transform the tool schema sent to the model while remapping the model's responses back to the original parameter names for execution.
Configuration
YAML Config File
Create a config file (e.g.,
schema_overrides.yaml):Mapping Example
The
PythonToolhas the following original schema:{ "name": "stateful_python_code_exec", "description": "Call this function to execute Python code in a stateful Jupyter notebook environment. Python will respond with the output of the execution or time out after 120.0 seconds.", "input_schema": { "properties": { "code": {"type": "string", "description": "Code to execute"} }, "required": ["code"] } }With the above overrides, the model sees:
{ "name": "python", "description": "Run Python code and return the result", "input_schema": { "properties": { "script": {"type": "string", "description": "Python script to run"} }, "required": ["script"] } }When the model calls
python(script="print(1)"), the framework automatically remaps it tostateful_python_code_exec(code="print(1)")for execution.Usage
Command Line
Use
--config-pathand--config-nameto load your override config:ns generate \ --cluster=slurm \ --model=Qwen/Qwen3-8B \ --server_type=vllm \ --server_gpus=1 \ --server_args='--enable-auto-tool-choice --tool-call-parser hermes' \ --input_file=data.jsonl \ --output_dir=outputs \ --with_sandbox=true \ ++tool_modules=[nemo_skills.mcp.servers.python_tool.PythonTool] \ --config-path=/nemo_run/code/configs \ --config-name=schema_overridesPython API
Config File Location
Option A: Commit to git - Files committed to your repository are automatically packaged and available at
/nemo_run/codeon the cluster. See Code Packaging for details.Option B: Mount from cluster storage - Mount config files from a known location on your cluster filesystem. Update your cluster config to mount the directory containing your override files, then reference the mounted path:
Output Format
The generation output includes the transformed tool schema in the
toolsfield:{ "conversation": [ {"role": "user", "content": "Calculate 2+2"}, {"role": "assistant", "content": "...", "tool_calls": [...]}, {"role": "tool", "content": "4"} ], "tools": [ { "type": "function", "function": { "name": "python", "description": "Run Python code and return the result", "parameters": { "properties": {"script": {"type": "string", "description": "Python script to run"}}, "required": ["script"] } } } ], "num_tool_calls": 1, "generation": "..." }Validation
Schema overrides are validated at startup:
hide_argscannot be overridden (they're not in the schema)Summary by CodeRabbit
Release Notes
New Features
Tests
✏️ Tip: You can customize this high-level summary in your review settings.