Skip to content

Instantly share code, notes, and snippets.

@elbruno
Last active April 3, 2025 14:04
Show Gist options
  • Save elbruno/8593452caa9dabf45aad8bf6d1db3281 to your computer and use it in GitHub Desktop.
Save elbruno/8593452caa9dabf45aad8bf6d1db3281 to your computer and use it in GitHub Desktop.
genainet_showghtoken.cs
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