Class GroupChat
public class GroupChat : IGroupChat
- Inheritance
-
GroupChat
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
GroupChat(IEnumerable<IAgent>, IAgent?, IEnumerable<IMessage>?, Graph?)
Create a group chat. The next speaker will be decided by a combination effort of the admin and the workflow.
public GroupChat(IEnumerable<IAgent> members, IAgent? admin = null, IEnumerable<IMessage>? initializeMessages = null, Graph? workflow = null)
Parameters
membersIEnumerable<IAgent>group members.
adminIAgentadmin agent. If provided, the admin will be invoked to decide the next speaker.
initializeMessagesIEnumerable<IMessage>workflowGraphworkflow of the group chat. If provided, the next speaker will be decided by the workflow.
GroupChat(IEnumerable<IAgent>, IOrchestrator, IEnumerable<IMessage>?)
Create a group chat which uses the orchestrator to decide the next speaker(s).
public GroupChat(IEnumerable<IAgent> members, IOrchestrator orchestrator, IEnumerable<IMessage>? initializeMessages = null)
Parameters
membersIEnumerable<IAgent>orchestratorIOrchestratorinitializeMessagesIEnumerable<IMessage>
Properties
Messages
public IEnumerable<IMessage>? Messages { get; }
Property Value
Methods
AddInitializeMessage(IMessage)
public void AddInitializeMessage(IMessage message)
Parameters
messageIMessage
CallAsync(IEnumerable<IMessage>?, int, CancellationToken)
public Task<IEnumerable<IMessage>> CallAsync(IEnumerable<IMessage>? chatHistory = null, int maxRound = 10, CancellationToken ct = default)
Parameters
chatHistoryIEnumerable<IMessage>maxRoundintctCancellationToken
Returns
SelectNextSpeakerAsync(IAgent, IEnumerable<IMessage>)
Select the next speaker based on the conversation history. The next speaker will be decided by a combination effort of the admin and the workflow. Firstly, a group of candidates will be selected by the workflow. If there's only one candidate, then that candidate will be the next speaker. Otherwise, the admin will be invoked to decide the next speaker using role-play prompt.
[Obsolete("Please use RolePlayOrchestrator or WorkflowOrchestrator")]
public Task<IAgent> SelectNextSpeakerAsync(IAgent currentSpeaker, IEnumerable<IMessage> conversationHistory)
Parameters
currentSpeakerIAgentcurrent speaker
conversationHistoryIEnumerable<IMessage>conversation history
Returns
SendIntroduction(IMessage)
Send an introduction message to the group chat.
public void SendIntroduction(IMessage message)
Parameters
messageIMessage