Last active
April 3, 2025 14:04
-
-
Save elbruno/8593452caa9dabf45aad8bf6d1db3281 to your computer and use it in GitHub Desktop.
genainet_showghtoken.cs
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 Azure; | |
using Azure.AI.Inference; | |
using Microsoft.Extensions.AI; | |
// uncomment this line to see your GitHub Token | |
// Console.WriteLine($"GITHUB_TOKEN: {Environment.GetEnvironmentVariable("GITHUB_TOKEN")}"); | |
IChatClient client = new ChatCompletionsClient( | |
endpoint: new Uri("https://models.inference.ai.azure.com"), | |
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.GetResponseAsync("What is AI?"); | |
Console.WriteLine(response.Message); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment