Get started with OpenAI in .NET
Welcome to this blog series on OpenAI and .NET!
Artificial intelligence (AI) is changing the ways we live and work. Some early examples of how AI is being embedded into the applications you use today include search in Bing, office productivity in Microsoft 365, and developer productivity in GitHub.
As a developer, you might be thinking, “I want to use these same AI features in my own applications”. Although the technology used to train the underlying AI models can be complex, using these models in your applications doesn’t have to be.
Over the next few months, we plan on publishing a series of blog posts showcasing samples and discussing a series of AI-related building blocks to help you add OpenAI-powered AI capabilities to your .NET applications.
But first, an introduction.
What is OpenAI
OpenAI is a research and deployment company. They are the creators of the models powering experiences like ChatGPT and Bing Image Creator. These models include:
- Generative Pretrained Transformers (GPT) – A model that can understand and generate text or code.
- DALL-E – A model that can generate and edit images given a text description.
- Whisper – A model that can convert audio into text.
What can I do with models like GPT
While there are countless applications OpenAI models like GPT can be used for, the following are just a few examples:
- Create a chatbot to answer questions about your business
- Categorize the sentiment of a product review
- Extract keywords and entities from a document
- Translate text from one language to another
- Generate images for blog posts
How can I access OpenAI models
Access to models like GPT is available via REST APIs and libraries.
Additionally, Azure OpenAI Service provides Azure customers with access to OpenAI’s advanced language AI models such as OpenAI GPT-4 with the security and enterprise promise of Microsoft Azure.
The APIs are co-developed with OpenAI to ensure compatibility and a smooth transition between the two. Customers also benefit from private networking, regional availability, and responsible AI content filtering.
For more details, see the documentation on comparing Azure OpenAI Service and OpenAI.
How do I get started with OpenAI models and .NET
There’s a few options to get started using OpenAI models in .NET:
- REST API
- Azure OpenAI .NET SDK
NOTE: The Azure OpenAI .NET SDK is currently in preview.
We recommend using the Azure OpenAI .NET SDK which supports both OpenAI and Azure OpenAI Service.
To get started using OpenAI models with the Azure OpenAI .NET SDK:
- Sign up or request access with OpenAI or Azure OpenAI Service.
- Use your credentials to start experimenting with the OpenAI .NET samples.
In the next post, we’ll go into more detail on the topic of completions, which are the text and code generated by OpenAI models. Stay tuned!
We want to hear from you
Help us learn more about how you’re looking to use AI in your applications. Take a few minutes to complete this survey.
Hi Luis, wonder if you’ll cover how to associate database columns with AI ie user would ask “Sum sales by city”. On the sales table we have a CityId (or CityName) which we’d like to make sure is used for the sum. Same goes with SalesPersonId, ProductCategoryId, etc.
Is the output you’re looking to get a SQL query? If so, you might want to check out this sample.
What is finance
Hi Luis, Could you please help me to use open AI in Iran? as azure is not useable here