Microsoft Dev Blogs

Add AI to Your .NET Apps Easily with Prompty

thumbnail

Adding AI to Your .NET Apps Easily with Prompty

Description of a Typical Flow of a Developer Using Prompty in Visual Studio Code

Prompty is a Visual Studio Code extension that simplifies the integration of Large Language Models (LLMs) like GPT-4o into .NET applications. It provides commands and snippets to insert prompts, handle responses, generate code snippets, create documentation, and debug applications by asking specific questions to the LLM.

Step 1: Set up the WebAPI Project

  • Create a new WebAPI project using the .NET CLI.
  • Add necessary dependencies.
  • Run the project from Visual Studio Code.
  • Set up user secrets for security.

Step 2: Create a Prompty for a More Descriptive Summary for the Forecast

  • Define a new prompty file to generate a detailed summary for the weather forecast.
  • Use the LLM information to create the prompty file.
  • Allow generation of C# code using Semantic Kernel.

Step 3: Update the Endpoint Using Prompty for the Forecast Summary

  • Edit the endpoint file to add necessary usings.
  • Create a Semantic Kernel to generate forecast summaries.
  • Utilize the prompty file and weather information to generate a detailed summary.

By incorporating Prompty and Large Language Models like GPT-4o, developers can seamlessly enhance their .NET development workflows.