ChatAIze.Utilities 0.6.0

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

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.Utilities for standalone helpers (for example DateTimeOffsetParser).
  • ChatAIze.Utilities.Extensions for 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:

  • ToSnakeLower is used to normalize database titles and properties in ChatAIze.Chatbot and to generate tool schemas in ChatAIze.GenerativeCS.
  • NormalizedEquals is used to match tool calls coming back from providers (OpenAI/Gemini) to registered functions.
  • WithPlaceholderValues is used to expand action settings and confirmation text in the workflow engine.
  • TryGetSettingValue is used in the action/condition UI builders to read settings with safe defaults.
  • ToNaturalString is used in dashboard UI timestamps (chat cards, account metadata, backups).
  • DateTimeOffsetParser is used in law-firm-plugin and in condition evaluation to parse date/time expressions.
  • DelegateExtensions is 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:

  • NormalizedEquals compares strings by transliterating diacritics, ignoring punctuation/whitespace, and matching ASCII letters/digits case-insensitively.
  • ToSeparated, ToSnakeLower, ToKebabLower normalize identifiers for use in tool schemas and settings keys.
  • ToAlphanumeric strips non-ASCII characters and optionally preserves - or _ (whitespace normalizes to the chosen separator).
  • ToLatin maps a curated set of diacritics to ASCII-friendly characters.

Warnings:

  • This is intentionally lossy. Do not use NormalizedEquals for security-sensitive comparisons (passwords, tokens).
  • Strings containing only punctuation normalize to an empty value, so they compare equal.
  • ToSeparated drops 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.
  • WithPlaceholderValues overloads: 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:

  • GetNormalizedMethodName extracts stable names for delegates. Prefer named methods; lambdas can throw if the compiler name is not recognized.
  • InvokeForStringResultAsync binds JSON arguments to function delegates, injects IFunctionContext/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, StringLength attributes 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, or 2025-01-31.

DateTimeOffsetParser.Parse

A lightweight parser for human-friendly date/time expressions.

Supported examples:

  • now, today, tomorrow, next monday at 14:30
  • 2025-01-31, 31.01.2025, 12/31/2025
  • utc+2, gmt-5, cest

Limitations and gotchas:

  • It is not a general NLP parser. Catch exceptions for untrusted input.
  • Parsing is anchored to DateTimeOffset.UtcNow and uses fixed offsets for time zones (no DST).
  • Ambiguous formats like 01/02/2025 are interpreted as month/day/year.
  • Day underflow (for example "yesterday" on the 1st) is not normalized and can throw.
  • The at keyword 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.

  • ChatAIze.Abstractions: base interfaces referenced by DelegateExtensions.
  • ChatAIze.PluginApi: concrete helper implementations for plugin authors.
  • ChatAIze.GenerativeCS: tool schema generation, uses ToSnakeLower and NormalizedEquals.

License

GPL-3.0-or-later. See LICENSE for details.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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