Skip to content

This project is a port of the ChatGPT Prompt Engineering for Developers samples from OpenAI / Python to C# / Azure-OpenAI. It uses Interactive Notebooks for C#, Azure OpenAI service, and the Azure OpenAI client library for .NET.

Notifications You must be signed in to change notification settings

mjfusa/azure-openai-csharp-prompt-engineering-samples

Repository files navigation

Azure OpenAI C# Prompt Engineering Samples

This project is a port of the ChatGPT Prompt Engineering for Developers samples from OpenAI / Python to C# / Azure-OpenAI. It uses Interactive Notebooks for C#, Azure OpenAI service, and the Azure OpenAI client library for .NET.

Prerequisites

  1. Clone this repo locally

  2. In Azure, create Azure OpenAI Service resource. After deploying the model, note the model name, you'll need it for the AOAI_DEPLOYMENTID environment variable below.

  3. Install the Polyglot Notebooks extension in Visual Studio Code.

  4. Configure environment variables

    For more details on how to get the values for the variables, see the Azure OpenAI documentation.

    Set the following environment variables with the required values. (Tip: Create an .env file):

    AOAI_ENDPOINT - The endpoint for your Azure OpenAI Service resource.

    AOAI_KEY - The access key for your Azure OpenAI Service resource.

    AOAI_DEPLOYMENTID - The name of your model deployment (e.g. my-davinci-003-deployment)

Running the Notebooks

Open a Jupyter Notebook file (links below) in VS Code. You can run and change the code.

Prompt Types

Iterative: Modifying the prompt until it gives you the correct output

Summarizing: Providing summarized output

Inferring: Sentiment Analysis, Emotion detection, Entity Extraction

Transforming: Language translation and detecting

Expanding: Generate text based on tone and sentiment of input

Chatbot: Chat using system, user, and assistant message roles.

Orderbot: Interactive chat using turn-based input to add to context

References

https://learn.deeplearning.ai/chatgpt-prompt-eng

https://github.com/Azure-Samples/openai-dotnet-samples

https://learn.microsoft.com/en-us/dotnet/api/overview/azure/ai.openai-readme?view=azure-dotnet-preview

https://learn.microsoft.com/en-us/dotnet/api/azure.ai.openai?view=azure-dotnet-preview

https://www.nuget.org/packages/Azure.AI.OpenAI

https://github.com/dotnet/interactive

https://github.com/dotnet/csharp-notebooks

About

This project is a port of the ChatGPT Prompt Engineering for Developers samples from OpenAI / Python to C# / Azure-OpenAI. It uses Interactive Notebooks for C#, Azure OpenAI service, and the Azure OpenAI client library for .NET.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published