Skip to content

Add modelCapabilities override#1022

Merged
SteveSandersonMS merged 6 commits intomainfrom
stevesa/override-model-capabilities
Apr 7, 2026
Merged

Add modelCapabilities override#1022
SteveSandersonMS merged 6 commits intomainfrom
stevesa/override-model-capabilities

Conversation

@SteveSandersonMS
Copy link
Copy Markdown
Contributor

@SteveSandersonMS SteveSandersonMS commented Apr 6, 2026

Summary

Adds modelCapabilities parameter to the Node SDK's createSession and setModel APIs, allowing SDK consumers to override individual model capabilities (e.g., vision support) without specifying the full capabilities object.

Closes #994

Changes

  • Codegen: Regenerated RPC types from runtime schema (adds modelCapabilities to model.switchTo)
  • Types: Added ModelCapabilitiesOverride type, exported from index
  • Session: createSession and setModel accept optional modelCapabilities
  • E2E tests: Two tests verify vision toggle via setModel changes image processing behavior

Usage

// Override vision at session creation
const session = await client.createSession({
    model: "my-byok-model",
    provider: { type: "openai", baseUrl: "..." },
    modelCapabilities: { supports: { vision: true } },
});

// Toggle vision mid-session
await session.setModel("my-byok-model", {
    modelCapabilities: { supports: { vision: false } },
});

Testing

E2E tests run against a local runtime build and verify that:

  • Starting with vision disabled then enabling via setModel causes image_url content to appear
  • Starting with vision enabled then disabling via setModel causes image_url content to stop appearing

@SteveSandersonMS SteveSandersonMS changed the title Add modelCapabilities override to all SDK languages Add modelCapabilities override Apr 6, 2026
@github-actions

This comment has been minimized.

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Generated by SDK Consistency Review Agent for issue #1022

SteveSandersonMS and others added 2 commits April 7, 2026 10:27
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
Regenerated RPC types and added modelCapabilities support to Python, Go, and C#
SDKs to match the Node.js implementation. All languages now support:
- modelCapabilities on createSession/create_session/CreateSession
- modelCapabilities on setModel/set_model/SetModel/SetModelAsync
- E2E tests verifying vision toggle via setModel changes image processing

Also includes:
- Regenerated codegen output with proper type names (no Purple/Fluffy)
- C# codegen fix to respect JSON Schema 'title' for class naming
- Fix Go E2E tests for DataContent type change in session events
- Fix Python generated Union import in session events

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/override-model-capabilities branch from b14e5b6 to cf12a7f Compare April 7, 2026 09:28
Co-Authored-By: Copilot <223556219+Copilot@users.noreply.github.com>
@SteveSandersonMS SteveSandersonMS force-pushed the stevesa/override-model-capabilities branch from cf12a7f to 2e943bf Compare April 7, 2026 09:31
- Replace foreach loops with LINQ .Where/.Any in HasImageUrlContent
- Fix Python import ordering (ruff)
- Apply formatter output across Node/Python

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
[Fact]
public async Task VisionEnabledThenDisabledViaSetModel()
{
await File.WriteAllBytesAsync(Path.Combine(Ctx.WorkDir, "test.png"), Png1X1);
SteveSandersonMS and others added 2 commits April 7, 2026 10:39
Addresses Cross-SDK Consistency Review:
- Add modelCapabilities to ResumeSessionConfig Pick list
- Forward modelCapabilities in session.resume RPC call

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Cross-SDK Consistency Review ✅

This PR adds modelCapabilities support to Node.js, Go, and .NET. Checking for Python parity:

Python already implements this featurepython/copilot/client.py and python/copilot/session.py include model_capabilities: ModelCapabilitiesOverride | None = None on create_session, resume_session, and set_model, along with the ModelCapabilitiesOverride type and _capabilities_to_dict serializer.

All four SDKs are consistent:

SDK createSession resumeSession setModel
Node.js ✅ (this PR) ✅ (this PR)
Python ✅ (pre-existing) ✅ (pre-existing) ✅ (pre-existing)
Go ✅ (this PR) ✅ (this PR) ✅ (this PR)
.NET ✅ (this PR) ✅ (this PR) ✅ (this PR)

No cross-SDK consistency issues found.

Generated by SDK Consistency Review Agent for issue #1022 ·

@SteveSandersonMS SteveSandersonMS merged commit 62bf520 into main Apr 7, 2026
23 of 36 checks passed
@SteveSandersonMS SteveSandersonMS deleted the stevesa/override-model-capabilities branch April 7, 2026 09:55
@SteveSandersonMS SteveSandersonMS restored the stevesa/override-model-capabilities branch April 7, 2026 09:57
@SteveSandersonMS
Copy link
Copy Markdown
Contributor Author

This PR was merged prematurely in error by the branch's upstream tracking branch being wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

view tool doesn't work with BYOM

1 participant