swarmauri.experimental.conversations.ConsensusBuildingConversation module

class swarmauri.experimental.conversations.ConsensusBuildingConversation.ConsensusBuildingConversation(topic, participants)[source]

Bases: IConversation

add_comment(sender_id, comment)[source]

Adds a comment or feedback regarding a proposal.

add_message(message)[source]

Adds a message to the conversation history.

add_proposal(sender_id, proposal)[source]

Adds a proposal to the conversation.

as_dict()[source]
Return type:

list

check_agreement()[source]

Checks if there is a consensus on any proposal. A simple majority (>50% of the participants) is required for consensus.

clear_history()[source]

Clears the conversation history.

Return type:

None

get_last()[source]

Retrieves the latest message from the conversation history.

Return type:

IMessage

property history: list

Provides read-only access to the conversation history.

initiate_consensus(initiator_id, proposal=None)[source]

Starts the conversation with an initial proposal, if any.

vote(sender_id, vote)[source]

Registers a vote for a given proposal.

class swarmauri.experimental.conversations.ConsensusBuildingConversation.ConsensusBuildingMessage(sender_id, content, message_type)[source]

Bases: IMessage

as_dict()[source]
Return type:

dict

property content: str
property role: str