AiAssistant 0.0.3

dotnet add package AiAssistant --version 0.0.3
                    
NuGet\Install-Package AiAssistant -Version 0.0.3
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AiAssistant" Version="0.0.3" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AiAssistant" Version="0.0.3" />
                    
Directory.Packages.props
<PackageReference Include="AiAssistant" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AiAssistant --version 0.0.3
                    
#r "nuget: AiAssistant, 0.0.3"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AiAssistant@0.0.3
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AiAssistant&version=0.0.3
                    
Install as a Cake Addin
#tool nuget:?package=AiAssistant&version=0.0.3
                    
Install as a Cake Tool

AiAssistant

NuGet

AiAssistant — This is a lightweight and extensible library for integrating AI assistants into .NET applications. The library allows you to process user requests, register commands, work with various AI engines (Groq, OpenAI), and centrally generate prompts.


Features

  • Registration of user commands and handling of their execution via delegates.
  • Support for multiple AI engines:
  • Groq API
  • OpenAI GPT
  • Prompt generation with centralized logic via IPromptBuilder.
  • Extensions for convenient command parameter extraction.
  • Full support for asynchronous interaction.
  • Easy integration via Dependency Injection (Microsoft.Extensions.DependencyInjection).

Installation

Install via NuGet:

dotnet add package AiAssistant --version 0.0.3

Usage

  1. Register the service in your DI container
    using Microsoft.Extensions.DependencyInjection;
    using AiAssistant.DependencyInjection;
    
    var services = new ServiceCollection();
    
    // Register AI Assistant services in DI container
    services.AddAiAssistant();
    
    var serviceProvider = services.BuildServiceProvider();
    
  2. How to use
     using AiAssistant.Core;
    
     var assistantService = provider.GetRequiredService<IAiAssistantService>();
    
     // Select the desired engine and submit the API key
     assistantService.UseGroqEngine(groqApiKey);
     // Or
     assistantService.UseOpenAIEngine(openAI-ApiKey);
    
     // Example of command registration
     // Registration of the “openpage” command with action
     _assistantService.RegisterCommand("openpage", async cmd =>
     {
         Console.WriteLine($"Opening page: {cmd.Target}");
         return await Task.FromResult(true);
     });
    
     // Provide additional prompt instructions for the "openpage" command
     _assistantService.AddCommandPrompt("openpage", "Available pages: Print - PrintPage, Home - HomePage");
    
     // Registration of the “find” command with action
     _assistantService.RegisterCommand("find", async cmd =>
     {
         Console.WriteLine($"Searching for: {cmd.Parameters}");
         return true;
     });
    
     // Registration of the “exit” command with action
     _assistantService.RegisterCommand("exit", async cmd =>
     {
         Environment.Exit(0);
         return true;
     });
    
     // Call
     Console.Write("Enter a message for the AI Assistant (or 'exit' to quit): ");
    
     var msg = Console.ReadLine();
    
     // Process the input using the AI Assistant service
     var response = await _assistantService!.ProcessAsync(msg!);
    

API

IAiAssistantService

Main library interface:

  • RegisterCommand(string commandName, CommandDelegate action) — command registration.
  • AddCommandPrompt(string commandName, string prompt) — adding additional instructions for a command.
  • ProcessAsync(string query) — processing a user request.
  • GetAvailableCommands() — getting a list of available commands.
  • UseGroqEngine(string apiKey) — connecting the Groq AI engine.
  • UseOpenAIEngine(string apiKey) — connecting OpenAI GPT.

AssistantCommandExtensions Extensions for conveniently obtaining command parameters:

var value = command.GetParameter<int>("count", 0);

Supported Platforms

  • .NET 9.0

License

MIT License. See LICENSE for details.

Contributors

See all contributors

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.3 197 11/9/2025
0.0.2 186 11/6/2025
0.0.1 191 11/6/2025