Documentation
Table of Contents

Method RunAsync

Namespace
IntentSharp.Specialist
Assembly
IntentSharp.Specialist.dll

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

Runs the intent on its specialist and returns a verified T. Under IntentCall it first ensures a specialist as EnsureAsync(string, CancellationToken) does, and the call waits for it; under Explicit it needs one already in use for the current definition. Then the definition the service returned runs through the normal pipeline, as RunAsync<T>(string, object?, CancellationToken) runs a catalog definition.

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

Parameters

name string

The intent's name in Catalog.

input object

The input value.

cancellationToken CancellationToken

Cancels the call.

Returns

Task<AIResult<T>>

Type Parameters

T

Exceptions

IntentNotFoundException

The catalog has no intent with that name.

SpecialistNotEnsuredException

Under Explicit, no specialist is in use for the current definition.

SpecialistWaitTimeoutException

Every wait ended without an offer.

SpecialistNotFitException

The offer did not fit and nothing requested another.

SpecialistRequestLimitException

A request was needed but the hourly limit was reached.

SpecialistOfferException

The service returned an offer the runtime cannot use.

SpecialistGuardrailException

A request was needed and the guardrail check at the specialist checkpoint refused it.

RunAsync(string, object?, CancellationToken)

Runs the intent on its specialist and returns the verified result as JSON, whatever its shape. Waits and fails before the run as RunAsync<T>(string, object?, CancellationToken) does.

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

Parameters

name string

The intent's name in Catalog.

input object

The input value.

cancellationToken CancellationToken

Cancels the call.

Returns

Task<AIResult<JsonNode>>

Exceptions

IntentNotFoundException

The catalog has no intent with that name.

SpecialistNotEnsuredException

Under Explicit, no specialist is in use for the current definition.

SpecialistWaitTimeoutException

Every wait ended without an offer.

SpecialistNotFitException

The offer did not fit and nothing requested another.

SpecialistRequestLimitException

A request was needed but the hourly limit was reached.

SpecialistOfferException

The service returned an offer the runtime cannot use.

SpecialistGuardrailException

A request was needed and the guardrail check at the specialist checkpoint refused it.