CEBot.Ai 1.0.0

dotnet add package CEBot.Ai --version 1.0.0
                    
NuGet\Install-Package CEBot.Ai -Version 1.0.0
                    
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="CEBot.Ai" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CEBot.Ai" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="CEBot.Ai" />
                    
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 CEBot.Ai --version 1.0.0
                    
#r "nuget: CEBot.Ai, 1.0.0"
                    
#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.
#addin nuget:?package=CEBot.Ai&version=1.0.0
                    
Install CEBot.Ai as a Cake Addin
#tool nuget:?package=CEBot.Ai&version=1.0.0
                    
Install CEBot.Ai as a Cake Tool

CEBot.Ai

A cost-efficient, privacy-focused Razor Component for integrating AI chatbots into your Blazor Web Apps.

Overview

CEBot.Ai is a Razor Class Library (RCL) that enables AI-powered chatbot functionality for Blazor web applications. By leveraging Jan.AI’s server running on the user’s local machine, CEBot.Ai provides a secure, high-performance, and cost-efficient solution for integrating AI models into your applications.

This component is ideal for developers looking to: • Prioritize Privacy: AI models operate locally on the user’s machine, ensuring sensitive data never leaves their system. • Reduce Costs: Offload AI operations to users’ local resources, drastically reducing server costs for developers. • Maintain Flexibility: Supports multiple AI models and seamlessly integrates into Blazor web apps.

Features • Privacy-First: Keeps all data processing on the user’s local machine. • Cost-Efficient: Eliminates cloud hosting fees for AI operations. • Customizable: Configure the chatbot’s expertise and behavior using developer-provided parameters. • Interactive Blazor Support: Compatible with both InteractiveAuto and InteractiveWebAssembly render modes. • Flexible AI Models: Specify your preferred AI model, such as "llama3.2-3b-instruct".

Getting Started

Installation

Install the library from NuGet:

dotnet add package CEBot.Ai

Usage

Import the component in your Blazor app: @using CEBot.Ai.Components

In program.cs: (InteractiveAuto add to both program.cs. InteractiveWebassembly add to program.cs)

using FDP.CEBot.Ai.Services;

Make sure you have a HttpClient: builder.Services.AddScoped(sp ⇒ new HttpClient { BaseAddress = new Uri("http://localhost:1337/") });

Make sure you add CEBot service: builder.Services.AddScoped<CEBotService>();

Add the CEBot component to your page: <CEBot SystemContent="Define your AI expert context here" AiModel="llama3.2-3b-instruct" UserData="Provide additional data for the AI model here" />

Parameters:
SystemContent	string	Defines the context or expertise of the AI agent.
AiModel	string	Specifies the AI model to use (e.g., "llama3.2-3b-instruct"). (NOTE: as of now, only llama3.2-3b-instruct is used. change this param doesn't change the model)
UserData	string	Data passed from your application to the AI model for customized behavior.

Example Here’s an example of a basic AI chatbot integration:

<CEBot SystemContent="You are a financial advisor expert in long-term investments." AiModel="llama3.2-3b-instruct" UserData="@JsonSerializer.Serialize(new { userPortfolio = portfolioData })" />

Expected Output

The component will provide a responsive chatbot interface for users to engage in back-and-forth conversations with the AI agent.

Sample page: (this uses MudBlazor for UI)

@page "/cebot/demo"

@using FDP.CEBot.Ai.Components @using FDP.CEBot.Ai.Data @using System.Text.Json

<MudContainer class="my-8 py-8 px-4" MaxWidth="MaxWidth.Large"> <MudText Class="my-4" Align="Align.Center" Typo="Typo.h2">CEBot.Ai Demo (Experimental) </MudText>

<MudDivider Class="my-16" />

<CEBot systemContent=@systemContent aiModel=@aiModel userData=@userDataStr/>

</MudContainer>

@code{

public string systemContent {get;set;} = "You are a useful AI assistant. When a user asks Apple, you respond with Orange.";
public string aiModel {get;set;} = "llama3.2-3b-instruct";
public string userDataStr {get;set;} = "";

public class Person {
    public string Name {get;set;} = "";
    public int Age {get;set;} = 0;
}

protected override async Task OnInitializedAsync()
{
    List<Person> People = new List<Person>(){
        new Person(){Name = "Jason", Age = 44}
        };

    var contextData = new
    {
        People = People
    }; 

    // Serialize to JSON
    userDataStr = JsonSerializer.Serialize(contextData);
}

}

Requirements • Jan.AI Server: Ensure Jan.AI’s server is running locally on the user’s machine to host the AI model. • Blazor Framework: Designed for Blazor Server and WebAssembly applications.

Key Benefits 1. Privacy: User data is processed locally, ensuring compliance with data protection regulations. 2. Performance: Leverages the computing power of the user’s machine for seamless interactions. 3. Scalability: Developers can serve unlimited users without incurring additional server costs.

Technical Details • Framework: .NET 9+ • Supported Render Modes: • InteractiveAuto • InteractiveWebAssembly • Dependency: Requires Jan.AI or similar server that hosts OpenAI-compatible models locally.

Contributing

Contributions are welcome! If you have suggestions, feature requests, or bug reports, feel free to open an issue

License

This project is licensed under the MIT License.

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
1.0.0 76 1/9/2025

Initial release with support for AI chatbot integration, including Jan.AI server compatibility and customizable parameters.