Method ExecuteAsync
- Namespace
- LMKit.Agents.Orchestration
- Assembly
- LM-Kit.NET.dll
ExecuteAsync(string, CancellationToken)
Executes the orchestration with the given input.
Task<OrchestrationResult> ExecuteAsync(string input, CancellationToken cancellationToken = default)
Parameters
inputstringThe input task or query.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<OrchestrationResult>
The orchestration result.
Examples
Default options, abortable via the cancellation token:
using var cts = new CancellationTokenSource(TimeSpan.FromSeconds(30));
var result = await orchestrator.ExecuteAsync("Summarize the latest report.", cts.Token);
ExecuteAsync(string, OrchestrationOptions, CancellationToken)
Executes the orchestration with the given input and options.
Task<OrchestrationResult> ExecuteAsync(string input, OrchestrationOptions options, CancellationToken cancellationToken = default)
Parameters
inputstringThe input task or query.
optionsOrchestrationOptionsExecution options.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<OrchestrationResult>
The orchestration result.
Examples
Per-call options applied to every agent in the orchestration:
using LMKit.TextGeneration.Sampling;
using LMKit.TextGeneration.Chat;
using LMKit.Agents.Orchestration;
var options = new OrchestrationOptions
{
SamplingMode = new GreedyDecoding(),
MaxCompletionTokens = 256,
ReasoningLevel = ReasoningLevel.None
};
var result = await orchestrator.ExecuteAsync("Classify this customer email.", options);