Created
January 6, 2026 05:14
-
-
Save lqdev/a5c2063ad16470e69ce36df8e1c88a67 to your computer and use it in GitHub Desktop.
OpenAI File Based App
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
| #:package Microsoft.Extensions.AI.OpenAI@10.1.1-preview.1.25612.2 | |
| using Microsoft.Extensions.AI; | |
| using OpenAI; | |
| var key = Environment.GetEnvironmentVariable("OPENAI_KEY"); | |
| IChatClient chatClient = | |
| new OpenAIClient(key) | |
| .GetChatClient("gpt-4o-mini") | |
| .AsIChatClient(); | |
| var res = await chatClient.GetResponseAsync("What is AI?"); | |
| Console.WriteLine(res); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment