@@ -553,8 +553,7 @@ await InvokeRpcAsync<object>(
553553 /// </example>
554554 public async Task SetModelAsync ( string model , CancellationToken cancellationToken = default )
555555 {
556- await InvokeRpcAsync < object > (
557- "session.setModel" , [ new SetModelRequest { SessionId = SessionId , Model = model } ] , cancellationToken ) ;
556+ await Rpc . Model . SwitchToAsync ( model , cancellationToken ) ;
558557 }
559558
560559 /// <summary>
@@ -655,12 +654,6 @@ internal record SessionDestroyRequest
655654 public string SessionId { get ; init ; } = string . Empty ;
656655 }
657656
658- internal record SetModelRequest
659- {
660- public string SessionId { get ; init ; } = string . Empty ;
661- public string Model { get ; init ; } = string . Empty ;
662- }
663-
664657 [ JsonSourceGenerationOptions (
665658 JsonSerializerDefaults . Web ,
666659 AllowOutOfOrderMetadataProperties = true ,
@@ -673,7 +666,6 @@ internal record SetModelRequest
673666 [ JsonSerializable ( typeof ( SendMessageResponse ) ) ]
674667 [ JsonSerializable ( typeof ( SessionAbortRequest ) ) ]
675668 [ JsonSerializable ( typeof ( SessionDestroyRequest ) ) ]
676- [ JsonSerializable ( typeof ( SetModelRequest ) ) ]
677669 [ JsonSerializable ( typeof ( UserMessageDataAttachmentsItem ) ) ]
678670 [ JsonSerializable ( typeof ( PreToolUseHookInput ) ) ]
679671 [ JsonSerializable ( typeof ( PreToolUseHookOutput ) ) ]
0 commit comments