Ultra and Microids Announce Publishing Partnership for Available and Upcoming Titles

As part of the multi-year partnership, Ultra and Microids team up to provide users with available and upcoming titles and will explore the NFT space with Ultra’s technology Microids is a…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




ChatGPT APIs for .NET Developers

Large Language Model (LLM) generally, ChatGPT and Bard particularly are all the rage nowadays. The number of SDKs for different programming languages which can be integrated with ChatGPT APIs has been mushrooming.

However, in this article, I would like to specifically target .NET developers and how they can use .NET to develop systems which can integrate with ChatGPT APIs. Besides, I will provide more use cases and scenario which ChatGPT can be put in good use. I will not cover the topic of how to write a good prompt as internet articles sharing on good prompts are a dime a dozen. However, knowing how to write a good prompt is very important to get more accurate answers from ChatGPT APIs.

I will provide use cases which are categorized into 5 categories: Inferring, Summarizing, Transforming, Expanding and Chatbot. In most cases, the same source code can be reused. The difference is only how we write the prompt in each category.

Let’s give it a shot for the implementation by trying with a simple example, follow the following comments to replace some text in the above sample code.

We should get the similar result as following when we run the console application:

Again, in order to implement different use cases fall under the five categories, in most cases, we just need to tweak the values for “text” and “prompt” variables.

Sentiment Analysis is one of the scenarios which falls under the category of “Inferring”. The above given sample is one example of sentiment analysis. If we use the following prompt instead, which requests the ChatGPT to only provide one single word, then, it will provide single-word answer.

Result:

We can also request ChatGPT to return a list of emotions with a given prompt.

Result:

Topic categorization is part of the Inferring category which we can implement with following prompt

Result:

result from “topic categorization” implementation

With different “instruction”, we can request ChatGPT to format the answer in JSON object

Result:

Transforming is typically used for translation and it is more straightforward. We don’t need the “text” variable and can put all the request in “prompt” variable. We have to admit that it is not easy to get the “language translation” to translate perfectly in a very professional way, regardless which tools we are using.

Result:

We can use “tone transformation” to “guide” ChatGPT to provide answer which is more formal:

Result:

response with tone transformation

We can also implement data format conversion with following prompt:

Result:

We can use the following prompt for Spell check and Proofreading with ChatGPT API. In the following screenshot that shows the response of the ChatGPT API call, I have specifically highlighted the text that it has corrected.

Results:

Hope the article helps those who are interested to explore ChatGPT API with.NET platform.

Add a comment

Related posts:

Oliver Sacks and Desirable Disadvantages

Oliver Sacks sits calmly with a warm expression on his face. His wire glasses frame his soft eyes and a silver beard envelops his chin. A red felt-tip pen snuggles in the pocket of his baby blue…

The best destinations for a girlfriend getaway

Going on a vacation abroad with your best friends is one of the best adventures you can ever embark on. Whether you choose to pamper yourselves on a tropical beach or go on a camping excursion…

Money is Hppiness

Many people believe that having money can lead to happiness, but this belief is not entirely accurate. While money can provide individuals with access to material goods, experiences, and…