Table of Contents

Class MiddlewareStreamingAgent

Namespace
AutoGen.Core
Assembly
AutoGen.Core.dll
public class MiddlewareStreamingAgent : IMiddlewareStreamAgent, IStreamingAgent, IAgent, IAgentMetaInformation
Inheritance
MiddlewareStreamingAgent
Implements
Derived
Inherited Members
Extension Methods

Constructors

MiddlewareStreamingAgent(IStreamingAgent, string?, IEnumerable<IStreamingMiddleware>?)

public MiddlewareStreamingAgent(IStreamingAgent agent, string? name = null, IEnumerable<IStreamingMiddleware>? streamingMiddlewares = null)

Parameters

agent IStreamingAgent
name string
streamingMiddlewares IEnumerable<IStreamingMiddleware>

Properties

Name

public string Name { get; }

Property Value

string

StreamingAgent

Get the inner agent.

public IStreamingAgent StreamingAgent { get; }

Property Value

IStreamingAgent

StreamingMiddlewares

Get the streaming middlewares.

public IEnumerable<IStreamingMiddleware> StreamingMiddlewares { get; }

Property Value

IEnumerable<IStreamingMiddleware>

Methods

GenerateReplyAsync(IEnumerable<IMessage>, GenerateReplyOptions?, CancellationToken)

Generate reply

public Task<IMessage> GenerateReplyAsync(IEnumerable<IMessage> messages, GenerateReplyOptions? options = null, CancellationToken cancellationToken = default)

Parameters

messages IEnumerable<IMessage>

conversation history

options GenerateReplyOptions

completion option. If provided, it should override existing option if there's any

cancellationToken CancellationToken

Returns

Task<IMessage>

GenerateStreamingReplyAsync(IEnumerable<IMessage>, GenerateReplyOptions?, CancellationToken)

public IAsyncEnumerable<IMessage> GenerateStreamingReplyAsync(IEnumerable<IMessage> messages, GenerateReplyOptions? options = null, CancellationToken cancellationToken = default)

Parameters

messages IEnumerable<IMessage>
options GenerateReplyOptions
cancellationToken CancellationToken

Returns

IAsyncEnumerable<IMessage>

UseStreaming(IStreamingMiddleware)

public void UseStreaming(IStreamingMiddleware middleware)

Parameters

middleware IStreamingMiddleware