ChatAIze.Abstractions
0.14.0
dotnet add package ChatAIze.Abstractions --version 0.14.0
NuGet\Install-Package ChatAIze.Abstractions -Version 0.14.0
<PackageReference Include="ChatAIze.Abstractions" Version="0.14.0" />
<PackageVersion Include="ChatAIze.Abstractions" Version="0.14.0" />
<PackageReference Include="ChatAIze.Abstractions" />
paket add ChatAIze.Abstractions --version 0.14.0
#r "nuget: ChatAIze.Abstractions, 0.14.0"
#:package ChatAIze.Abstractions@0.14.0
#addin nuget:?package=ChatAIze.Abstractions&version=0.14.0
#tool nuget:?package=ChatAIze.Abstractions&version=0.14.0
ChatAIze.Abstractions
Contracts shared across the ChatAIze ecosystem. This package is intentionally implementation-free: it defines interfaces, enums, and conventions that let hosts, plugins, and tooling interoperate without taking direct dependencies on each other.
It is used in:
ChatAIze.Chatbot(the host)ChatAIze.GenerativeCS(LLM/tool schema + execution)ChatAIze.PluginApi(concrete implementations for plugin authors)- first-party plugins such as
law-firm-plugin
If you are building a ChatAIze host, plugin, or integration, this is the set of contracts you implement and/or consume.
Install
dotnet add package ChatAIze.Abstractions
Target framework: net10.0. If your project targets an earlier runtime, reference the project directly or multi-target accordingly.
Concepts at a glance
- Chat transcripts:
IChat,IChatMessage,IFunctionCall,IFunctionResult,ChatRole,PinLocation - Runtime context:
IChatbotContext,IChatContext,IUserContext,IFunctionContext,IActionContext,IConditionContext - Plugins and loaders:
IChatbotPlugin,IPluginLoader,IAsyncPluginLoader,IPluginSettings - Settings UI:
ISettingand specific setting types plusUIenums for style - Databases:
IDatabaseManager,IDatabase,IDatabaseItem, filtering/sorting + exceptions - Retrieval:
IRetrievalItem,IRetrievalResult - Localization + security:
TranslationLanguage,SecurityRole
Chat transcripts and tool calls
The chat interfaces model a provider-agnostic transcript with support for tool calls.
IChat<TMessage, TFunctionCall, TFunctionResult>defines the collection plusFromXxxAsynchelpers to construct messages. InChatAIze.Chatbot, these methods create messages but do not persist them, so callers still add them to storage.IChatMessage<TFunctionCall, TFunctionResult>represents a single turn. A message can hold text, tool calls, or a tool result.ChatRolemirrors common LLM roles: system, user, assistant, tool.PinLocationhints how a host should keep messages when trimming context for token budgets.
Tips:
- Do not put PII in
IChat.UserTrackingId. InChatAIze.Chatbotit is forwarded to providers for abuse monitoring. - Use
PinLocation.Beginfor long-lived system rules andPinLocation.Endfor "latest state" that should stay near the end. - If you attach
ImageUrls, make sure they are accessible to the provider and do not contain secrets.
Context interfaces
Contexts are the "ambient services" a host provides to plugins and workflow callbacks.
IChatbotContext: host services outside a specific chat (settings + databases + logging).IChatContext: adds chat-specific fields such asChatId,User,IsPreview,IsDebugModeOn, andIsCommunicationSandboxed. Use these flags to guard side effects.IUserContext: identity, locale, and per-user storage (GetPropertyAsync/SetPropertyAsync).IFunctionContext: adds prompt/quick replies, knowledge search, status/progress, and UI prompts.IActionContext: extendsIFunctionContextwith action execution state, placeholders, and early-exit control.IConditionContext: intentionally adds no extra APIs; use it only for checks.
Warnings and limitations:
- Some
IFunctionContextAPIs are best-effort and may be no-ops or throw. InChatAIze.Chatbot,SetIntelligenceLevelcurrently throwsNotImplementedException. ShowCaptchaAsync,ShowFeedbackAsync, andVerifyEmailAsyncare host features; always handle failures gracefully.- Values returned by
ShowFormAsyncare JSON and must be treated as untrusted input.
Plugins and loading
Plugins implement IChatbotPlugin and are discovered via loader interfaces.
Discovery order in ChatAIze.Chatbot (actual host behavior):
IAsyncPluginLoader.LoadAsyncIPluginLoader.Load- First concrete
IChatbotPluginin the assembly (viaActivator.CreateInstance)
Important behavior in ChatAIze.Chatbot:
- Plugin types and loaders must have a public parameterless constructor (no DI at creation time).
- Plugins are loaded in an isolated
AssemblyLoadContext; only a set of shared assemblies are loaded from the default context (includingChatAIze.Abstractions,ChatAIze.PluginApi,ChatAIze.GenerativeCS,ChatAIze.Utilities, andMicrosoft.Extensions.*). Other dependencies are private to the plugin. - Plugin DLLs are copied to a temporary folder to enable hot reload/unload. Implement
IDisposable/IAsyncDisposableand avoid static event handlers to keep the load context unloadable.
Plugin authoring example (using ChatAIze.PluginApi)
using ChatAIze.Abstractions.Chat;
using ChatAIze.Abstractions.Plugins;
using ChatAIze.PluginApi;
using ChatAIze.PluginApi.Settings;
public sealed class Loader : IPluginLoader
{
public IChatbotPlugin Load()
{
var plugin = new ChatbotPlugin
{
Id = "acme:orders",
Title = "Orders",
Version = new Version(1, 0, 0),
};
plugin.AddFunction(new ChatFunction("get_order_status")
{
Description = "Returns the status of an order by id.",
Callback = GetOrderStatusAsync
});
var action = new FunctionAction(
id: "acme:actions.create_order",
title: "Create Order",
callback: CreateOrderAsync);
action.AddStringSetting(id: "customer_email", title: "Customer Email");
action.AddStringSetting(id: "sku", title: "SKU");
plugin.AddAction(action);
return plugin;
}
private static Task<string> GetOrderStatusAsync(IFunctionContext ctx, string orderId, CancellationToken ct)
=> Task.FromResult($"Order {orderId}: shipped");
private static async Task CreateOrderAsync(IActionContext ctx, string customerEmail, string sku, CancellationToken ct)
{
if (ctx.IsPreview || ctx.IsCommunicationSandboxed)
{
ctx.SetActionResult(isSuccess: true, "Simulated order creation.");
return;
}
// Real side effect here.
ctx.SetActionResult(isSuccess: true, "Order created.");
ctx.SetPlaceholder("order_id", "1234");
}
}
Functions, actions, and conditions
IChatFunction (LLM tools)
Functions are surfaced to the model through ChatAIze.GenerativeCS and can also power workflows.
Key behaviors (from the contracts and host usage):
- Names are normalized to snake_case when sent to providers.
- If
Parametersisnull, hosts often infer a schema fromCallbackvia reflection. RequiresDoubleCheckis a safety flag;ChatAIze.GenerativeCSimplements it by forcing a double tool call.
Tips:
- Keep function names globally unique across plugins to avoid ambiguity.
- Avoid lambdas if you rely on auto-naming; compiler-generated method names can be unstable.
- Prefer simple parameter types; complex graphs do not map cleanly to provider schemas.
IFunctionAction (workflow steps)
Actions are used in the ChatAIze dashboard function builder to compose workflows. The host binds action settings into the callback parameters.
Binding rules in the default host (ChatAIze.Utilities.Extensions.DelegateExtensions):
IActionContextandCancellationTokenparameters are injected by type.- Other parameters are bound by exact name or snake_case.
- Missing/invalid values mark the action as failed.
Tips:
- For action/condition settings IDs, use identifier-like keys (
customer_email,timeout_seconds). Avoid:or-because they cannot map to C# parameter names. - Keep
SettingsCallbackdeterministic and fast; it is called frequently by the dashboard. - Use
PlaceholdersCallbackto declare outputs. InChatAIze.Chatbotplaceholder ids are normalized to snake_case and duplicates are suffixed (order_id,order_id_2, ...).
IFunctionCondition (guards)
Conditions are evaluated before running a workflow. The callback may return:
trueto allow executionfalseto deny without a message- a string/object to deny with a reason (host may surface it to admins)
Settings and UI abstractions
Settings shape the dashboard UI and provide config values to plugins and workflows.
Core types:
ISetting: stableIdused for persistence and value binding.- Containers:
ISettingsSection,ISettingsGroup,ISettingsContainer. - Inputs:
IStringSetting,IBooleanSetting,IIntegerSetting,IDecimalSetting,ISelectionSetting,IListSetting,IMapSetting,IDateTimeSetting. - UI hints:
TextFieldType,SelectionSettingStyle,IntegerSettingStyle,BooleanSettingStyle,DateTimeSettingStyle.
Conventions used in ChatAIze.Chatbot:
- Settings values are stored as JSON under the setting
Id. IDefaultValueObject.DefaultValueObjectis used to fill missing values in action/condition placements.- Styles are best-effort; hosts may ignore or downgrade them.
Tips:
- Use namespacing for plugin-level settings (
myplugin:api_key) to avoid collisions. - Changing a setting
Idis a breaking change for persisted data. - Use
IsDisabledto gray out settings, but do not rely on it for security. ISettingsButton.Callbackruns on the server; keep it idempotent and respect cancellation tokens.
Databases
ChatAIze includes a lightweight, host-managed database abstraction for structured records.
Key contracts:
IDatabaseManagerprovides CRUD, querying, and filtering.IDatabaseandIDatabaseItemare the records.IDatabaseFilter+IDatabaseSortingprovide query shaping.- Exceptions (for host validation):
DuplicateTitleException,InvalidTitleException,PropertyException.
Actual behavior in ChatAIze.Chatbot (important for plugin authors):
- Titles and property names are normalized to snake_case for comparisons (
ToSnakeLower). - Properties are stored as strings; numeric/date comparisons parse from string values.
FilterOptions.IgnoreCaseandFilterOptions.IgnoreDiacriticsare supported.- Sorting expects the property to exist; missing properties can throw.
- Delete semantics can be soft or hard depending on host settings (
EnableTrash).
Example query:
var db = await context.Databases.FindDatabaseByTitleAsync("Contacts", ct);
if (db is null) return;
var filter = new DatabaseFilter("email", FilterType.Equal, "user@example.com", FilterOptions.IgnoreCase);
var contact = await context.Databases.GetFirstItemAsync(db, sorting: null, cancellationToken: ct, filters: filter);
Warnings:
- Do not construct your own
IDatabaseorIDatabaseItemimplementations and pass them into a host manager. InChatAIze.Chatbot, the manager expects its ownCustomDatabaseandDatabaseItemtypes and will throw otherwise. - When using numeric comparisons (
GreaterThan,LessThan, ...), ensure values are parseable as numbers or dates.
Retrieval and knowledge search
IRetrievalResult and IRetrievalItem model semantic search hits.
In ChatAIze.Chatbot, IFunctionContext.SearchKnowledgeAsync returns both:
Items: displayable snippets (title, description, content, optional source URL).ChunkIds: internal identifiers for the exact chunks used. Pass them back asignoredChunkIdsto avoid repeats.
Tips:
IRetrievalItem.Contentis often truncated. CallGetDocumentContentAsyncfor the full content.- Use
TranslationLanguageto scope search results by language.
Localization and security
TranslationLanguageis a ChatAIze-specific enum (not BCP-47). Hosts typically provide mapping from locale codes.ChatAIze.Chatbotuses a dedicated converter to mapen-US,fr-CA, etc. to enum values.SecurityRolecontrols dashboard access levels and can be used in conditions/actions to gate admin-only operations.
Tips, warnings, and limitations (real-world notes)
- Side effects: Always honor
IChatContext.IsPreviewandIsCommunicationSandboxedwhen doing external IO (emails, HTTP calls, payments). Return simulated results in preview mode. - Schema binding: Action and function parameters are bound by name, usually in snake_case. Mismatched names lead to
missing-parameter errors. Keep parameter names aligned with setting
Ids. - Plugin isolation: Plugins are loaded in an isolated
AssemblyLoadContext. Sharing types across host and plugin requires a shared assembly (such asChatAIze.AbstractionsorChatAIze.PluginApi). - Thread safety: Plugins are effectively singletons; callbacks may execute concurrently for multiple chats. Store per-chat state in the provided context objects, not on the plugin instance.
- Not all hosts implement everything: The abstractions expose optional capabilities. Expect no-ops or exceptions for features like CAPTCHA, feedback UI, and intelligence level switching.
- Untrusted input: Settings values, form submissions, and user properties are JSON persisted data. Validate and sanitize before use.
Related projects
ChatAIze.Chatbot: reference host implementation of these interfaces.ChatAIze.PluginApi: convenient concrete implementations for plugin authors.ChatAIze.GenerativeCS: tool schema generation and provider integration.ChatAIze.Utilities: argument binding helpers (DelegateExtensions) used by the host.
License
GPL-3.0-or-later. See LICENSE for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.1)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on ChatAIze.Abstractions:
| Package | Downloads |
|---|---|
|
ChatAIze.GenerativeCS
Generative AI library for .NET 10.0 with built-in OpenAI ChatGPT and Google Gemini API clients and support for C# function calling via reflection. Features: - Chat Completion - Response Streaming - Text Embedding - Text-to-Speech - Speech-to-Text - Moderation - Configurable Token Limit - Configurable Character Limit - Configurable Message Limit - Message Pinning - Function Calling - Support for Dependency Injection - Automatic Reattempt on Failure - Advanced Customization |
|
|
ChatAIze.Utilities
Extensions and helper methods for ChatAIze projects. |
|
|
ChatAIze.DopamineUI
Aesthetic C# .NET Blazor component library that makes the UI seamless and entertaining to use. |
|
|
ChatAIze.PluginApi
Official library for building ChatAIze chatbot add-ons. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.14.0 | 144 | 12/20/2025 |
| 0.13.0 | 240 | 12/14/2025 |
| 0.12.20 | 397 | 11/18/2025 |
| 0.12.19 | 305 | 11/14/2025 |
| 0.12.18 | 604 | 9/18/2025 |
| 0.12.17 | 2,085 | 4/21/2025 |
| 0.12.16 | 253 | 4/21/2025 |
| 0.12.15 | 189 | 4/21/2025 |
| 0.12.14 | 203 | 4/21/2025 |
| 0.12.13 | 280 | 4/15/2025 |
| 0.12.12 | 241 | 4/15/2025 |
| 0.12.11 | 252 | 4/15/2025 |
| 0.12.10 | 352 | 3/11/2025 |
| 0.12.9 | 374 | 1/28/2025 |
| 0.12.8 | 183 | 1/20/2025 |
| 0.12.7 | 168 | 1/20/2025 |
| 0.12.6 | 165 | 1/20/2025 |
| 0.12.5 | 165 | 1/19/2025 |
| 0.12.3 | 168 | 1/11/2025 |
| 0.12.2 | 176 | 1/10/2025 |
| 0.12.1 | 175 | 1/8/2025 |
| 0.12.0 | 164 | 1/7/2025 |
| 0.11.12 | 374 | 12/4/2024 |
| 0.11.11 | 155 | 12/2/2024 |
| 0.11.10 | 172 | 12/2/2024 |
| 0.11.9 | 213 | 11/28/2024 |
| 0.11.8 | 160 | 11/28/2024 |
| 0.11.7 | 205 | 11/24/2024 |
| 0.11.6 | 171 | 11/23/2024 |
| 0.11.5 | 169 | 11/23/2024 |
| 0.11.4 | 160 | 11/23/2024 |
| 0.11.3 | 143 | 11/22/2024 |
| 0.11.2 | 213 | 11/22/2024 |
| 0.11.1 | 152 | 11/22/2024 |
| 0.11.0 | 190 | 11/21/2024 |
| 0.10.7 | 179 | 11/20/2024 |
| 0.10.6 | 191 | 11/19/2024 |
| 0.10.5 | 204 | 11/18/2024 |
| 0.10.4 | 179 | 11/17/2024 |
| 0.10.3 | 168 | 11/17/2024 |
| 0.10.2 | 266 | 11/16/2024 |
| 0.10.1 | 181 | 11/16/2024 |
| 0.10.0 | 148 | 11/16/2024 |
| 0.9.3 | 173 | 11/16/2024 |
| 0.9.2 | 325 | 11/14/2024 |
| 0.9.1 | 188 | 11/13/2024 |
| 0.9.0 | 152 | 11/13/2024 |
| 0.8.4 | 219 | 11/13/2024 |
| 0.8.3 | 432 | 11/12/2024 |
| 0.8.2 | 163 | 11/12/2024 |
| 0.8.1 | 178 | 11/11/2024 |
| 0.8.0 | 195 | 11/11/2024 |
| 0.7.2 | 155 | 11/10/2024 |
| 0.7.1 | 232 | 11/10/2024 |
| 0.7.0 | 165 | 11/10/2024 |
| 0.6.2 | 200 | 11/10/2024 |
| 0.6.1 | 226 | 11/10/2024 |
| 0.6.0 | 184 | 11/10/2024 |
| 0.5.8 | 195 | 11/9/2024 |
| 0.5.7 | 146 | 11/9/2024 |
| 0.5.6 | 195 | 11/9/2024 |
| 0.5.5 | 204 | 11/9/2024 |
| 0.5.4 | 199 | 11/8/2024 |
| 0.5.3 | 225 | 11/8/2024 |
| 0.5.2 | 165 | 11/7/2024 |
| 0.5.1 | 161 | 11/7/2024 |
| 0.5.0 | 163 | 11/7/2024 |
| 0.4.7 | 190 | 11/7/2024 |
| 0.4.6 | 153 | 11/7/2024 |
| 0.4.5 | 166 | 11/6/2024 |
| 0.4.4 | 168 | 11/6/2024 |
| 0.4.3 | 156 | 11/6/2024 |
| 0.4.2 | 153 | 11/4/2024 |
| 0.4.1 | 169 | 11/4/2024 |
| 0.4.0 | 186 | 11/4/2024 |
| 0.3.4 | 154 | 11/4/2024 |
| 0.3.3 | 195 | 11/3/2024 |
| 0.3.2 | 177 | 11/3/2024 |
| 0.3.1 | 162 | 11/3/2024 |
| 0.3.0 | 165 | 11/3/2024 |
| 0.2.2 | 222 | 11/2/2024 |
| 0.2.1 | 225 | 11/1/2024 |
| 0.2.0 | 149 | 11/1/2024 |
| 0.1.1 | 172 | 11/1/2024 |
| 0.1.0 | 166 | 11/1/2024 |