Documentation
Table of Contents

Class AIExtensions

Namespace
IntentSharp.Extensions
Assembly
IntentSharp.dll

.AIAsync(client, intent) on any value. Every overload is a thin call into TransformAsync<T>(object?, string, AIRequestOptions?, CancellationToken); the client is always explicit, so there is no hidden global state. All operations are asynchronous. Synchronous wrappers were removed because they deadlock in UI and classic ASP.NET contexts.

public static class AIExtensions
Inheritance
object
AIExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()

Methods

AIAsync(object?, IntentClient, string, AIRequestOptions?, CancellationToken)

Applies the intent to the value and returns text.

AIAsync<T>(object?, IntentClient, string, AIRequestOptions?, CancellationToken)

Applies the intent to the value and returns a verified T.

AIClassifyAsync<TEnum>(object?, IntentClient, string?, AIRequestOptions?, CancellationToken)

Classifies the value into exactly one of the enum's members.

AIConvertAsync<T>(object?, IntentClient, AIRequestOptions?, CancellationToken)

Converts the value to T with a default conversion intent.

AIFilterAsync<T>(IEnumerable<T>, IntentClient, string, AIRequestOptions?, CancellationToken)

Keeps the elements that satisfy the intent. The model returns zero-based indices; the original objects are returned unchanged, so identity and unserialized state are preserved.

AIGroupAsync<T>(IEnumerable<T>, IntentClient, string, AIRequestOptions?, CancellationToken)

Groups the elements by the intent. Returns group labels chosen by the model mapped to the original objects.

AIMapAsync<TIn, TOut>(IEnumerable<TIn>, IntentClient, string, AIRequestOptions?, CancellationToken)

Transforms each element into a TOut. The result has the same length and order as the input; a length mismatch fails verification.

AIMapValuesAsync<TKey, TIn, TOut>(IDictionary<TKey, TIn>, IntentClient, string, AIRequestOptions?, CancellationToken)

Transforms a dictionary's values, keeping its keys. Missing or extra keys fail verification, and so does a null value unless TOut is a Nullable<T> value type.

AIReduceAsync<TIn, TOut>(IEnumerable<TIn>, IntentClient, string, AIRequestOptions?, CancellationToken)

Reduces the whole collection to a single TOut (a summary, a total, a verdict).

AISortAsync<T>(IEnumerable<T>, IntentClient, string, AIRequestOptions?, CancellationToken)

Orders the elements according to the intent. The model returns a permutation of indices; every element appears exactly once.

Project<TIn, TOut>(AIResult<TIn>, Func<TIn, TOut>)

Re-shapes a result's value while keeping every piece of metadata.