MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / get_final_output_messages

Method get_final_output_messages

workflow/graph.py:758–774  ·  view source on GitHub ↗

Return all messages from the final node.

(self)

Source from the content-addressed store, hash-verified

756 return None
757
758 def get_final_output_messages(self) -> List[Message]:
759 """Return all messages from the final node."""
760 if self.graph.is_majority_voting:
761 msg = self.get_final_output_message()
762 return [msg] if msg else []
763
764 final_node = self._get_final_node()
765 if not final_node:
766 return []
767
768 results = []
769 for value in final_node.output:
770 if isinstance(value, Message):
771 results.append(value.clone())
772 else:
773 results.append(self._create_message(MessageRole.ASSISTANT, str(value), final_node.id))
774 return results
775
776 def _get_final_node(self) -> Node:
777 """Return the explicitly configured end node, or sink node as fallback."""

Callers 1

executeMethod · 0.80

Calls 4

_get_final_nodeMethod · 0.95
_create_messageMethod · 0.95
cloneMethod · 0.80

Tested by

no test coverage detected