dotnet-ai
0.0.2
dotnet tool install --global dotnet-ai --version 0.0.2
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local dotnet-ai --version 0.0.2
#tool dotnet:?package=dotnet-ai&version=0.0.2
nuke :add-package dotnet-ai --version 0.0.2
dotnet-ai: Leveraging LLMs to Create and Run dotnet Projects Faster and Easier.
This tool leverages Large Language Models (LLMs) to convert a user query into a series of steps for the dotnet SDK that can be optionally executed. To be put simply: The tool takes a user query of an intended action, an optional argument to execute the steps and responds with a series of steps.
The main purpose is to streamline and simplify the process of using the dotnet SDK to create projects by simply specifying instructions and optionally invoking them.
Prerequisites
Getting Started
- Install the dotnet-ai tool by invoking the following on your terminal:
dotnet tool install dotnet-ai -g
. - Set the OpenAI API Key as an environment variable.
- If you are using Powershell, use:
$env:OPENAI_API_KEY='Add Your OpenAI API Key Here'
- If you are using Command Prompt, use:
set OPENAI_API_KEY=Add Your OPEN API KEY Without Quotations.
- If you are using Powershell, use:
- Invoke the tool:
dotnet-ai --query "Add your query here"
: This will list the steps required.dotnet-ai --query "Add your query here" --execute
: This will list the steps required and then execute them.
Examples:
dotnet-ai --query "Create and run an application that'll print all the planets of the solar system.
dotnet-ai --query "Create and run an application that'll generate the first 20 Fibonacci numbers in F# in a project called 'Fib'" --execute
Getting Started With Development and Running Locally
- Clone the repo:
git clone https://github.com/MokoSan/dotnet-ai.git
. - cd into the folder:
cd dotnet-ai
. - Build the repo:
cd dotnet-ai
.dotnet build
. Usedotnet build -c Release
to build in Release mode.
- Run the code:
- Running using the dotnet SDK:
dotnet run -- --query "Create an application that prints the planets of the solar system."
.
- Running from the binary:
cd bin
.cd Debug
orcd Release
.cd net6.0
..\dotnet-ai.exe --query "Create an application that prints the planets of the solar system."
.
- Running using the dotnet SDK:
Example Response
dotnet-ai --query "create a program that'll generate the first 30 prime numbers and also add the newtonsoft json nuget package"
Response:
To create a program that generates the first 30 prime numbers and add the Newtonsoft.Json NuGet package, you can follow these steps:
Create a new .NET project:
dotnet new console -n PrimeNumberGenerator
Change to the project directory:
cd PrimeNumberGenerator
Add the Newtonsoft.Json NuGet package:
dotnet add package Newtonsoft.Json
Open the Program.cs file in a text editor and replace the existing code with the following code:
using System; using Newtonsoft.Json; namespace PrimeNumberGenerator { class Program { static void Main(string[] args) { int count = 0; int number = 2; while (count < 30) { if (IsPrime(number)) { Console.WriteLine(number); count++; } number++; } } static bool IsPrime(int number) { if (number < 2) return false; for (int i = 2; i <= Math.Sqrt(number); i++) { if (number % i == 0) return false; } return true; } } }
Save the changes to the Program.cs file.
Build the project:
dotnet build
Run the program:
dotnet run
This will generate and display the first 30 prime numbers. The Newtonsoft.Json NuGet package has been added to the project to enable JSON serialization and deserialization capabilities.
License
This project is licensed under the MIT License.
Contributions and Issues
Contributions are most welcome! If you encounter any issues or have suggestions for improvements, please feel free to open an issue or submit a pull request.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.