demo.mp4
This project aims to facilitate the creation of a new type of user interface for line of business applications. It will allow users to query data in their application using natural language and lower the barrier of accessing and analyzing data. This is similar to how most applications let users export data as excel files to do further analysis on their own.
-
Install the NuGet package
-
In the
Program.cs
, register the Aiui.
using Aiui;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddAiui(new AiuiOptions
{
Client = new OpenAIClient(builder.Configuration.GetValue<string>("OpenApiKey")),
Plugins =
[
new SqlListPlugin(builder.Configuration.GetConnectionString("SqlServer")!, ["Categories", "Products"]
new ChartJsPlugin(),
]
});
- Pass user's prompt and chat history to the
BotService
.
[HttpPost("")]
public async Task<IActionResult> Index(string prompt, List<string> chatHistory)
{
var executionResult = await _botService.ExecutePromptAsync(prompt, chatHistory, null);
return View(executionResult);
}
- You can optionally use the Chart.js plugin to draw charts.
[HttpPost("")]
public async Task<IActionResult> Chart(string prompt, List<string> chatHistory, List<dynamic> rows)
{
var executionResult = await _botService.ExecutePromptAsync(prompt, chatHistory, rows);
return View(executionResult);
}
Install the required .NET SDK.
Run:
$ dotnet build