In-Depth

Using Copilot AI to Call OpenAI APIs from Visual Studio 2022

The Newtonsoft app's prompt was "How long until we reach mars?" resulting in this API response:

Newtonsoft JSON App
[Click on image for larger view.] Newtonsoft JSON App (source: Ramel).

The System.Text.Json app's prompt was "Once upon a time" and resulted in this response:

System JSON App
[Click on image for larger view.] System JSON App (source: Ramel).

As is common with LLMs, the responses varied from one API call to the next, though they often used similar names and themes. Coincidentally, when I submitted the story prompt to ChatGPT Plus, it just kept churning away until its creation neared novellette length, strangely using a same character name as was used in an API call response.

It would take a lot more work to create a full-blown chatbot, perhaps too much work for a "citizen developer" even armed with AI. That said, my proof-of-concept shows how to take the first step of accessing OpenAI API endpoints from Visual Studio 2022, aided by AI tools.

The next steps for a business app might be inclusion of text fields and buttons and other doodads in a WinForms or web or .NET MAUI app to make it all pretty and user-friendly, letting users submit text prompts to advanced GPTs and get replies back in turn. But then there would be authentication and security and privacy and compliance and other concerns to worry about.

So, in conclusion, it's possible to access OpenAI API endpoints from Visual Studio 2022, but it's not dead simple for "ordinary business users" or "citizen developers" armed with a smattering of coding knowledge.


With AI advances coming at a stunning pace, that might change soon, making low-code a relic of the past. Or the way of the future, obviating tools like Visual Studio. Or something between the two.

Interesting times indeed.


About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

Subscribe on YouTube