Skip to content

Add setModel() convenience method to Session#18

Merged
kawax merged 2 commits intomainfrom
copilot/add-setmodel-function
Mar 3, 2026
Merged

Add setModel() convenience method to Session#18
kawax merged 2 commits intomainfrom
copilot/add-setmodel-function

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Tracks official SDK PR #621. Adds setModel() to Session as a thin convenience wrapper over $this->rpc()->model()->switchTo().

Changes

  • src/Session.php — adds setModel(string $modelId): void
  • src/Contracts/CopilotSession.php — adds method to interface with @throws JsonRpcException
  • src/Testing/FakeSession.php — no-op implementation to satisfy interface

Usage

$session->setModel('claude-sonnet-4');

// Equivalent to:
$session->rpc()->model()->switchTo(new SessionModelSwitchToParams(modelId: 'claude-sonnet-4'));

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: kawax <1502086+kawax@users.noreply.github.com>
Copilot AI changed the title [WIP] Add setModel function to follow SDK changes Add setModel() convenience method to Session Mar 3, 2026
Copilot finished work on behalf of kawax March 3, 2026 21:47
@kawax kawax marked this pull request as ready for review March 3, 2026 21:50
@kawax kawax merged commit 920cfeb into main Mar 3, 2026
5 checks passed
@kawax kawax deleted the copilot/add-setmodel-function branch March 3, 2026 21:50
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.

2 participants