Skip to content

Commit e3638da

Browse files
authored
Fix Getting Started .NET code for OnPermissionRequest handler (#957)
Added OnPermissionRequest handler to session configuration for .NET code in Getting Started guide.
1 parent 4c476fd commit e3638da

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

docs/getting-started.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ Create a new console project and add this to `Program.cs`:
210210
using GitHub.Copilot.SDK;
211211

212212
await using var client = new CopilotClient();
213-
await using var session = await client.CreateSessionAsync(new SessionConfig { Model = "gpt-4.1" });
213+
await using var session = await client.CreateSessionAsync(new SessionConfig
214+
{
215+
Model = "gpt-4.1",
216+
OnPermissionRequest = PermissionHandler.ApproveAll
217+
});
214218

215219
var response = await session.SendAndWaitAsync(new MessageOptions { Prompt = "What is 2 + 2?" });
216220
Console.WriteLine(response?.Data.Content);
@@ -368,6 +372,7 @@ await using var client = new CopilotClient();
368372
await using var session = await client.CreateSessionAsync(new SessionConfig
369373
{
370374
Model = "gpt-4.1",
375+
OnPermissionRequest = PermissionHandler.ApproveAll,
371376
Streaming = true,
372377
});
373378

@@ -811,6 +816,7 @@ var getWeather = AIFunctionFactory.Create(
811816
await using var session = await client.CreateSessionAsync(new SessionConfig
812817
{
813818
Model = "gpt-4.1",
819+
OnPermissionRequest = PermissionHandler.ApproveAll,
814820
Streaming = true,
815821
Tools = [getWeather],
816822
});
@@ -1114,6 +1120,7 @@ await using var client = new CopilotClient();
11141120
await using var session = await client.CreateSessionAsync(new SessionConfig
11151121
{
11161122
Model = "gpt-4.1",
1123+
OnPermissionRequest = PermissionHandler.ApproveAll,
11171124
Streaming = true,
11181125
Tools = [getWeather]
11191126
});

0 commit comments

Comments
 (0)