Documentation
Table of Contents

Method RunAsync

Namespace
IntentSharp.Catalog
Assembly
IntentSharp.Catalog.dll

RunAsync<T>(string, object?, CancellationToken)

Runs the intent and returns a verified T. The shape must be able to produce T: string for text; the primitive's type (date also as DateTime, datetime as DateTime or DateTimeOffset, lists as arrays or list interfaces); the registered type or a base of it for clr shapes; JsonNode (or JsonObject/JsonArray) for schema shapes. Any shape can be run as JsonNode. Otherwise IntentShapeMismatchException is thrown before any model call. A date or datetime asked for as DateTime still runs as its declared type (DateOnly or DateTimeOffset), so the model is asked for that format and the rules check its text; the verified value is then read as DateTime with SerializerOptions.

public Task<AIResult<T>> RunAsync<T>(string name, object? input, CancellationToken cancellationToken = default)

Parameters

name string
input object
cancellationToken CancellationToken

Returns

Task<AIResult<T>>

Type Parameters

T

RunAsync(string, object?, CancellationToken)

Runs the intent and returns the verified result as JSON, whatever its shape (typed shapes are serialized with SerializerOptions).

public Task<AIResult<JsonNode>> RunAsync(string name, object? input, CancellationToken cancellationToken = default)

Parameters

name string
input object
cancellationToken CancellationToken

Returns

Task<AIResult<JsonNode>>