Table of Contents

Constructor DelegateStreamHandler

Namespace
LMKit.Agents.Streaming
Assembly
LM-Kit.NET.dll

DelegateStreamHandler(Func<AgentStreamToken, CancellationToken, Task>, Func<Agent, string, CancellationToken, Task>, Func<AgentExecutionResult, CancellationToken, Task>, Func<Exception, CancellationToken, Task>)

Initializes a new instance with async callbacks.

public DelegateStreamHandler(Func<AgentStreamToken, CancellationToken, Task> onTokenAsync = null, Func<Agent, string, CancellationToken, Task> onStartAsync = null, Func<AgentExecutionResult, CancellationToken, Task> onCompleteAsync = null, Func<Exception, CancellationToken, Task> onErrorAsync = null)

Parameters

onTokenAsync Func<AgentStreamToken, CancellationToken, Task>

Called for each token.

onStartAsync Func<Agent, string, CancellationToken, Task>

Called when streaming starts.

onCompleteAsync Func<AgentExecutionResult, CancellationToken, Task>

Called when streaming completes.

onErrorAsync Func<Exception, CancellationToken, Task>

Called on error.

DelegateStreamHandler(Action<AgentStreamToken>, Action<Agent, string>, Action<AgentExecutionResult>, Action<Exception>)

Initializes a new instance with synchronous callbacks.

public DelegateStreamHandler(Action<AgentStreamToken> onToken = null, Action<Agent, string> onStart = null, Action<AgentExecutionResult> onComplete = null, Action<Exception> onError = null)

Parameters

onToken Action<AgentStreamToken>

Called for each token.

onStart Action<Agent, string>

Called when streaming starts.

onComplete Action<AgentExecutionResult>

Called when streaming completes.

onError Action<Exception>

Called on error.