From 6f985680f96d863e9e26258034c0ea016e41eb65 Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Thu, 6 Feb 2025 04:21:31 +0000 Subject: [PATCH] Fixing compiler warning and adding some error handling Fixes #20 --- 02-SettingUp.NETDev/src/BasicChat-01MEAI/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/02-SettingUp.NETDev/src/BasicChat-01MEAI/Program.cs b/02-SettingUp.NETDev/src/BasicChat-01MEAI/Program.cs index 253956a..49e38b2 100644 --- a/02-SettingUp.NETDev/src/BasicChat-01MEAI/Program.cs +++ b/02-SettingUp.NETDev/src/BasicChat-01MEAI/Program.cs @@ -4,7 +4,7 @@ IChatClient client = new ChatCompletionsClient( endpoint: new Uri("https://models.inference.ai.azure.com"), - new AzureKeyCredential(Environment.GetEnvironmentVariable("GITHUB_TOKEN"))) + new AzureKeyCredential(Environment.GetEnvironmentVariable("GITHUB_TOKEN") ?? throw new InvalidOperationException("Missing GITHUB_TOKEN environment variable. Ensure you followed the instructions to setup a GitHub Token to use GitHub Models."))) .AsChatClient("Phi-3.5-MoE-instruct"); var response = await client.CompleteAsync("What is AI?");