usingvarclient=newGeminiClient(apiKey);try{usingvarcts=newCancellationTokenSource(TimeSpan.FromSeconds(30));// Connects with a system instruction to customize model behavior.varconfig=CreateLiveConfig();config.SystemInstruction=newContent{Parts=[newPart{Text="You are a helpful assistant. Always be concise."}],};awaitusingvarsession=awaitclient.ConnectLiveAsync(config,cancellationToken:cts.Token);// Send a message — system instruction is accepted at setup time.awaitsession.SendTextAsync("Say hello",cts.Token);boolreceivedResponse=false;awaitforeach(varmessageinsession.ReadEventsAsync(cts.Token)){if(message.ServerContent?.ModelTurn?.Partsis{Count:>0}){receivedResponse=true;}if(message.ServerContent?.TurnComplete==true){break;}}}catch(WebSocketExceptionex){}catch(OperationCanceledException){}