Method RunManyAsync
- Namespace
- IntentSharp.Specialist
- Assembly
- IntentSharp.Specialist.dll
RunManyAsync<T>(string, IEnumerable<object?>, int, CancellationToken)
Runs the intent on its specialist once for each input, with at most maxConcurrency runs at a
time, and returns one verified result per input, in the order of the inputs. The specialist is ensured once, as
RunAsync<T>(string, object?, CancellationToken) ensures it, before the first run; a failure before
the runs throws and runs nothing. Each run is its own call through the normal pipeline, with its own
AIResult<T>, so one input that fails does not stop the others.
public Task<IReadOnlyList<AIResult<T>>> RunManyAsync<T>(string name, IEnumerable<object?> inputs, int maxConcurrency = 1, CancellationToken cancellationToken = default)
Parameters
namestringThe intent's name in Catalog.
inputsIEnumerable<object>The input values, in order.
maxConcurrencyintThe most runs at a time, at least 1. Default 1: one after another.
cancellationTokenCancellationTokenCancels the runs; a run that has not started does not start.
Returns
- Task<IReadOnlyList<AIResult<T>>>
Type Parameters
T
Exceptions
- ArgumentNullException
inputsis null.- ArgumentOutOfRangeException
maxConcurrencyis less than 1.- 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.
RunManyAsync(string, IEnumerable<object?>, int, CancellationToken)
Runs the intent on its specialist once for each input and returns one verified result as JSON per input, in the order of the inputs, as RunManyAsync<T>(string, IEnumerable<object?>, int, CancellationToken) does.
public Task<IReadOnlyList<AIResult<JsonNode>>> RunManyAsync(string name, IEnumerable<object?> inputs, int maxConcurrency = 1, CancellationToken cancellationToken = default)
Parameters
namestringThe intent's name in Catalog.
inputsIEnumerable<object>The input values, in order.
maxConcurrencyintThe most runs at a time, at least 1. Default 1: one after another.
cancellationTokenCancellationTokenCancels the runs; a run that has not started does not start.
Returns
- Task<IReadOnlyList<AIResult<JsonNode>>>
Exceptions
- ArgumentNullException
inputsis null.- ArgumentOutOfRangeException
maxConcurrencyis less than 1.- 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.