ChatAIze.Utilities
0.6.0
dotnet add package ChatAIze.Utilities --version 0.6.0
NuGet\Install-Package ChatAIze.Utilities -Version 0.6.0
<PackageReference Include="ChatAIze.Utilities" Version="0.6.0" />
<PackageVersion Include="ChatAIze.Utilities" Version="0.6.0" />
<PackageReference Include="ChatAIze.Utilities" />
paket add ChatAIze.Utilities --version 0.6.0
#r "nuget: ChatAIze.Utilities, 0.6.0"
#:package ChatAIze.Utilities@0.6.0
#addin nuget:?package=ChatAIze.Utilities&version=0.6.0
#tool nuget:?package=ChatAIze.Utilities&version=0.6.0
ChatAIze.Utilities
Shared helpers and extensions used across the ChatAIze stack. This package is intentionally small and focused: it provides string normalization, placeholder substitution, delegate invocation helpers for tool calls, and lightweight date parsing.
It is referenced by:
ChatAIze.Chatbot(host runtime and dashboard)ChatAIze.GenerativeCS(tool schema and provider integration)ChatAIze.PluginApi(plugin authoring helpers)- first-party plugins like
law-firm-plugin
Install
dotnet add package ChatAIze.Utilities
Target framework: net10.0. The package depends on ChatAIze.Abstractions for tool and workflow context types.
What this package contains
Namespaces:
ChatAIze.Utilitiesfor standalone helpers (for exampleDateTimeOffsetParser).ChatAIze.Utilities.Extensionsfor extension methods used across the host and plugins.
Key modules:
StringExtension: normalization, identifier casing, placeholder substitution.CharExtension: simple Latin transliteration for diacritics.DictionaryExtensions: tolerant JSON reads and placeholder expansion for dictionaries.DelegateExtensions: tool/action/condition invocation helpers with validation.DateTimeOffsetExtension: "natural" UI-friendly date formatting.DateTimeOffsetParser: small natural-language date/time parser.
Where it is used in ChatAIze
Concrete examples from the current codebase:
ToSnakeLoweris used to normalize database titles and properties inChatAIze.Chatbotand to generate tool schemas inChatAIze.GenerativeCS.NormalizedEqualsis used to match tool calls coming back from providers (OpenAI/Gemini) to registered functions.WithPlaceholderValuesis used to expand action settings and confirmation text in the workflow engine.TryGetSettingValueis used in the action/condition UI builders to read settings with safe defaults.ToNaturalStringis used in dashboard UI timestamps (chat cards, account metadata, backups).DateTimeOffsetParseris used inlaw-firm-pluginand in condition evaluation to parse date/time expressions.DelegateExtensionsis the standard path for invoking tool functions, workflow actions, and conditions.
Quick start
using ChatAIze.Utilities.Extensions;
var normalized = "My Project Name".ToSnakeLower(); // "my_project_name"
var equal = "Sao Paulo".NormalizedEquals("Sao-Paulo"); // true
var template = "Hello {user.name}, your order is {order_id}.";
var placeholders = new Dictionary<string, string>
{
["UserName"] = "Marcel",
["order_id"] = "A-123"
};
var message = template.WithPlaceholderValues(placeholders);
String and character normalization
StringExtension and CharExtension provide the normalization rules used throughout ChatAIze.
Highlights:
NormalizedEqualscompares strings by transliterating diacritics, ignoring punctuation/whitespace, and matching ASCII letters/digits case-insensitively.ToSeparated,ToSnakeLower,ToKebabLowernormalize identifiers for use in tool schemas and settings keys.ToAlphanumericstrips non-ASCII characters and optionally preserves-or_(whitespace normalizes to the chosen separator).ToLatinmaps a curated set of diacritics to ASCII-friendly characters.
Warnings:
- This is intentionally lossy. Do not use
NormalizedEqualsfor security-sensitive comparisons (passwords, tokens). - Strings containing only punctuation normalize to an empty value, so they compare equal.
ToSeparateddrops non-ASCII characters and splits on lower-to-upper transitions (for example "ChatBot" → "chat_bot").
Placeholder substitution
WithPlaceholderValues exists for string templates and for dictionaries that contain JSON values.
String templates:
- Placeholder keys are normalized to snake_case.
- Supported syntax includes
{key},{key.sub_property}, and{key:sub_property}. - Replacement is plain text, no escaping is performed.
Dictionary placeholders:
- For
IReadOnlyDictionary<string, JsonElement>, string values are replaced directly. - For JSON objects/arrays, substitution occurs on raw JSON and then the JSON is reparsed.
Warnings:
- Placeholder replacement is not JSON-escaped. Make sure your placeholder values produce valid JSON after replacement.
- Placeholders are simple and do not evaluate expressions; they just substitute strings.
Dictionary helpers
DictionaryExtensions is designed for settings dictionaries used by actions and conditions.
Key helpers:
TryGetSettingValue<T>: tolerant JSON read that returns a default value on deserialization errors.WithPlaceholderValuesoverloads: apply placeholder substitution to strings and JSON data.
Tip: TryGetSettingValue is used heavily in ChatAIze.Chatbot action/condition builders to keep UI logic resilient to
missing or invalid settings values.
Delegate invocation helpers
DelegateExtensions provides the standard binding and validation rules for ChatAIze tools and workflows.
Main features:
GetNormalizedMethodNameextracts stable names for delegates. Prefer named methods; lambdas can throw if the compiler name is not recognized.InvokeForStringResultAsyncbinds JSON arguments to function delegates, injectsIFunctionContext/CancellationToken, and serializes non-string results to snake_case JSON.- For actions, missing/invalid values mark the action as failed via
IActionContext.SetActionResult. - For conditions, missing required values throw; callers should validate settings before invocation.
Validation rules:
Required,MinLength,MaxLength,StringLengthattributes are enforced on string parameters.- Enum parameters are parsed case-insensitively and tolerate underscores.
Warnings:
- Delegate exceptions are not swallowed; they propagate to the caller.
- Tool invocation returns
"Error: ..."strings for validation failures (not exceptions).
Date and time helpers
DateTimeOffsetExtension.ToNaturalString
Formats timestamps for UI display:
- English output, 24-hour time.
- Uses a simple hour offset from UTC, not a time zone with DST rules.
- Returns values like
Today, 13:37,Yesterday,Mon, 15:00, or2025-01-31.
DateTimeOffsetParser.Parse
A lightweight parser for human-friendly date/time expressions.
Supported examples:
now,today,tomorrow,next monday at 14:302025-01-31,31.01.2025,12/31/2025utc+2,gmt-5,cest
Limitations and gotchas:
- It is not a general NLP parser. Catch exceptions for untrusted input.
- Parsing is anchored to
DateTimeOffset.UtcNowand uses fixed offsets for time zones (no DST). - Ambiguous formats like
01/02/2025are interpreted asmonth/day/year. - Day underflow (for example "yesterday" on the 1st) is not normalized and can throw.
- The
atkeyword is detected by substring and can match inside other words. - A small Polish-to-English keyword map is applied after
ToLatin()normalization.
Preview project
ChatAIze.Utilities.Preview is a tiny console app used to demo placeholder replacement with JsonElement values.
It is not published as a package.
Related packages
ChatAIze.Abstractions: base interfaces referenced byDelegateExtensions.ChatAIze.PluginApi: concrete helper implementations for plugin authors.ChatAIze.GenerativeCS: tool schema generation, usesToSnakeLowerandNormalizedEquals.
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
- ChatAIze.Abstractions (>= 0.14.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on ChatAIze.Utilities:
| 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.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.6.0 | 67 | 12/20/2025 |
| 0.5.12 | 323 | 11/14/2025 |
| 0.5.11 | 234 | 11/14/2025 |
| 0.5.10 | 552 | 9/18/2025 |
| 0.5.9 | 2,006 | 4/21/2025 |
| 0.5.8 | 231 | 4/21/2025 |
| 0.5.7 | 203 | 4/21/2025 |
| 0.5.6 | 278 | 4/15/2025 |
| 0.5.5 | 312 | 3/11/2025 |
| 0.5.4 | 172 | 2/10/2025 |
| 0.5.3 | 181 | 2/10/2025 |
| 0.5.2 | 262 | 2/3/2025 |
| 0.5.1 | 177 | 1/28/2025 |
| 0.5.0 | 155 | 1/27/2025 |
| 0.4.16 | 321 | 12/10/2024 |
| 0.4.15 | 179 | 12/6/2024 |
| 0.4.14 | 169 | 11/29/2024 |
| 0.4.13 | 144 | 11/29/2024 |
| 0.4.12 | 157 | 11/28/2024 |
| 0.4.11 | 171 | 11/28/2024 |
| 0.4.10 | 232 | 11/22/2024 |
| 0.4.9 | 159 | 11/21/2024 |
| 0.4.8 | 135 | 11/21/2024 |
| 0.4.7 | 166 | 11/20/2024 |
| 0.4.6 | 126 | 11/19/2024 |
| 0.4.5 | 157 | 11/19/2024 |
| 0.4.4 | 140 | 11/19/2024 |
| 0.4.3 | 139 | 11/19/2024 |
| 0.4.2 | 172 | 11/19/2024 |
| 0.4.1 | 158 | 11/19/2024 |
| 0.4.0 | 131 | 11/19/2024 |
| 0.3.17 | 193 | 11/17/2024 |
| 0.3.16 | 163 | 11/17/2024 |
| 0.3.15 | 175 | 11/16/2024 |
| 0.3.14 | 145 | 11/16/2024 |
| 0.3.13 | 196 | 11/16/2024 |
| 0.3.12 | 158 | 11/15/2024 |
| 0.3.11 | 173 | 11/15/2024 |
| 0.3.10 | 144 | 11/15/2024 |
| 0.3.9 | 150 | 11/15/2024 |
| 0.3.8 | 137 | 11/15/2024 |
| 0.3.7 | 140 | 11/15/2024 |
| 0.3.6 | 141 | 11/14/2024 |
| 0.3.5 | 176 | 11/14/2024 |
| 0.3.4 | 167 | 11/14/2024 |
| 0.3.3 | 170 | 11/13/2024 |
| 0.3.2 | 148 | 11/13/2024 |
| 0.3.1 | 172 | 11/13/2024 |
| 0.3.0 | 378 | 11/12/2024 |
| 0.2.0 | 307 | 11/10/2024 |
| 0.1.2 | 239 | 11/8/2024 |
| 0.1.1 | 297 | 10/30/2024 |
| 0.1.0 | 167 | 10/30/2024 |