Table of Contents

Class SemanticKernelAgent

Namespace
AutoGen.SemanticKernel
Assembly
AutoGen.SemanticKernel.dll

Semantic Kernel Agent Income message could be one of the following type:

  • IMessage<T> where T is Microsoft.SemanticKernel.ChatMessageContent
Return message could be one of the following type:
  • IMessage<T> where T is Microsoft.SemanticKernel.ChatMessageContent
  • (streaming) IMessage<T> where T is Microsoft.SemanticKernel.StreamingChatMessageContent

To support more AutoGen built-in IMessage, register with SemanticKernelChatMessageContentConnector.

public class SemanticKernelAgent : IStreamingAgent, IAgent, IAgentMetaInformation
Inheritance
SemanticKernelAgent
Implements
Inherited Members
Extension Methods

Constructors

SemanticKernelAgent(Kernel, string, string, PromptExecutionSettings?)

public SemanticKernelAgent(Kernel kernel, string name, string systemMessage = "You are a helpful AI assistant", PromptExecutionSettings? settings = null)

Parameters

kernel Kernel
name string
systemMessage string
settings PromptExecutionSettings

Properties

Name

public string Name { get; }

Property Value

string

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>