MCPcopy Index your code
hub / github.com/github/copilot-sdk / SwitchTo

Method SwitchTo

go/rpc/zrpc.go:15365–15391  ·  view source on GitHub ↗

SwitchTo switches the session to a model and optional reasoning configuration. RPC method: session.model.switchTo. Parameters: Target model identifier and optional reasoning effort, summary, capability overrides, and context tier. Returns: The model identifier active on the session after the swit

(ctx context.Context, params *ModelSwitchToRequest)

Source from the content-addressed store, hash-verified

15363//
15364// Returns: The model identifier active on the session after the switch.
15365func (a *ModelAPI) SwitchTo(ctx context.Context, params *ModelSwitchToRequest) (*ModelSwitchToResult, error) {
15366 req := map[string]any{"sessionId": a.sessionID}
15367 if params != nil {
15368 if params.ContextTier != nil {
15369 req["contextTier"] = *params.ContextTier
15370 }
15371 if params.ModelCapabilities != nil {
15372 req["modelCapabilities"] = *params.ModelCapabilities
15373 }
15374 req["modelId"] = params.ModelID
15375 if params.ReasoningEffort != nil {
15376 req["reasoningEffort"] = *params.ReasoningEffort
15377 }
15378 if params.ReasoningSummary != nil {
15379 req["reasoningSummary"] = *params.ReasoningSummary
15380 }
15381 }
15382 raw, err := a.client.Request(ctx, "session.model.switchTo", req)
15383 if err != nil {
15384 return nil, err
15385 }
15386 var result ModelSwitchToResult
15387 if err := json.Unmarshal(raw, &result); err != nil {
15388 return nil, err
15389 }
15390 return &result, nil
15391}
15392
15393// Experimental: NameAPI contains experimental APIs that may change or be removed.
15394type NameAPI sessionAPI

Callers 3

SetModelMethod · 0.80
TestRPCSessionStateE2EFunction · 0.80
TestSessionRPCE2EFunction · 0.80

Calls 1

RequestMethod · 0.45

Tested by 2

TestRPCSessionStateE2EFunction · 0.64
TestSessionRPCE2EFunction · 0.64