Documentation
Table of Contents

Method TransformAsync

Namespace
IntentSharp
Assembly
IntentSharp.dll

TransformAsync<T>(object?, string, AIRequestOptions?, CancellationToken)

Applies intent to input and returns a verified T.

public Task<AIResult<T>> TransformAsync<T>(object? input, string intent, AIRequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

input object
intent string
options AIRequestOptions
cancellationToken CancellationToken

Returns

Task<AIResult<T>>

Type Parameters

T

Exceptions

ArgumentOutOfRangeException

A per-request limit in options is out of range: MaxAttempts, MaxOutputTokens or MaxModelCalls below 1, Temperature outside 0 to 2, or Timeout not greater than zero.

TransformAsync(object?, string, JsonNode, AIRequestOptions?, CancellationToken)

Applies the intent to the input and returns JSON that conforms to outputSchema, a shape defined at run time rather than by a .NET type. A strict copy of the schema is sent to the provider as the shape of the result. The reply is checked to be well-formed JSON; the schema's own rules are enforced only by validators (for example those registered by the intent catalog). Result values are detached copies.

public Task<AIResult<JsonNode>> TransformAsync(object? input, string intent, JsonNode outputSchema, AIRequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

input object
intent string
outputSchema JsonNode
options AIRequestOptions
cancellationToken CancellationToken

Returns

Task<AIResult<JsonNode>>

Remarks

Callers who pass a literal null options argument must type it ((AIRequestOptions?)null) or omit it: an untyped null after the intent matches both this overload's outputSchema and the text overload's options, and the compiler reports the call as ambiguous.

TransformAsync(object?, string, AIRequestOptions?, CancellationToken)

Applies the intent to the input and returns text.

public Task<AIResult<string>> TransformAsync(object? input, string intent, AIRequestOptions? options = null, CancellationToken cancellationToken = default)

Parameters

input object
intent string
options AIRequestOptions
cancellationToken CancellationToken

Returns

Task<AIResult<string>>