Table of Contents

Class HumanInputMiddleware

Namespace
AutoGen
Assembly
AutoGen.dll

the middleware to get human input

public class HumanInputMiddleware : IMiddleware
Inheritance
HumanInputMiddleware
Implements
Inherited Members

Constructors

HumanInputMiddleware(string, string, HumanInputMode, Func<IEnumerable<IMessage>, CancellationToken, Task<bool>>?, Func<string?>?, Action<string>?)

public HumanInputMiddleware(string prompt = "Please give feedback: Press enter or type 'exit' to stop the conversation.", string exitKeyword = "exit", HumanInputMode mode = HumanInputMode.AUTO, Func<IEnumerable<IMessage>, CancellationToken, Task<bool>>? isTermination = null, Func<string?>? getInput = null, Action<string>? writeLine = null)

Parameters

prompt string
exitKeyword string
mode HumanInputMode
isTermination Func<IEnumerable<IMessage>, CancellationToken, Task<bool>>
getInput Func<string>
writeLine Action<string>

Properties

Name

the name of the middleware

public string? Name { get; }

Property Value

string

Methods

InvokeAsync(MiddlewareContext, IAgent, CancellationToken)

The method to invoke the middleware

public Task<IMessage> InvokeAsync(MiddlewareContext context, IAgent agent, CancellationToken cancellationToken = default)

Parameters

context MiddlewareContext
agent IAgent
cancellationToken CancellationToken

Returns

Task<IMessage>