This sample demonstrates how to use OpenAI with the gpt-3.5-turbo
model, from a .NET 8.0 console application. Use the AI model to summarize a page of text to a few words. It consists of a console application, running locally, that will read the file benefits.md
and send a request to the OpenAI service to summarize it.
If it's not already done, get an API key from OpenAI so you can run this sample.
-
From a terminal or command prompt, navigate to the
01-HikeBenefitsSummary
directory. -
Run the following commands to configure your OpenAI API key to run the sample, using the key you previously got from OpenAI.
dotnet user-secrets init dotnet user-secrets set OpenAIKey <your-openai-key>
-
It's now time to try the console application.
dotnet run
-
(Optional) Try to change the content of the file or the length of the summary to see the differences in the responses.
-
(Optional) Try another sample from the Getting-started: Trying the samples to experiment with different scenarios.