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
members
IEnumerable<IAgent>group members.
admin
IAgentadmin agent. If provided, the admin will be invoked to decide the next speaker.
initializeMessages
IEnumerable<IMessage>workflow
Graphworkflow 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
members
IEnumerable<IAgent>orchestrator
IOrchestratorinitializeMessages
IEnumerable<IMessage>
Properties
Messages
public IEnumerable<IMessage>? Messages { get; }
Property Value
Methods
AddInitializeMessage(IMessage)
public void AddInitializeMessage(IMessage message)
Parameters
message
IMessage
CallAsync(IEnumerable<IMessage>?, int, CancellationToken)
public Task<IEnumerable<IMessage>> CallAsync(IEnumerable<IMessage>? chatHistory = null, int maxRound = 10, CancellationToken ct = default)
Parameters
chatHistory
IEnumerable<IMessage>maxRound
intct
CancellationToken
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
currentSpeaker
IAgentcurrent speaker
conversationHistory
IEnumerable<IMessage>conversation history
Returns
SendIntroduction(IMessage)
Send an introduction message to the group chat.
public void SendIntroduction(IMessage message)
Parameters
message
IMessage