Last active
May 8, 2026 20:25
-
-
Save wullemsb/fc50d26049c6d4da516fbc862f298062 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using GitHub.Copilot.SDK; | |
| await using var client = new CopilotClient(); | |
| await client.StartAsync(); | |
| var session = await client.CreateSessionAsync(new SessionConfig | |
| { | |
| Model = "gpt-4.1" | |
| OnPermissionRequest = PermissionHandler.ApproveAll, | |
| }); | |
| Console.WriteLine("Chat with Copilot (type 'exit' to quit)\n"); | |
| while (true) | |
| { | |
| Console.Write("You: "); | |
| var input = Console.ReadLine(); | |
| if (string.IsNullOrWhiteSpace(input) || input == "exit") | |
| break; | |
| var response = await session.SendAndWaitAsync(new MessageOptions | |
| { | |
| Prompt = input | |
| }); | |
| Console.WriteLine($"Copilot: {response?.Data.Content}\n"); | |
| } | |
| await client.StopAsync(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment