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

Method _ensure_source_output

workflow/graph.py:853–860  ·  view source on GitHub ↗
(self, message: Any, node_id: str)

Source from the content-addressed store, hash-verified

851 return Message(role=role, content=content, metadata={"source": source})
852
853 def _ensure_source_output(self, message: Any, node_id: str) -> Message:
854 if not isinstance(message, Message):
855 return self._create_message(MessageRole.ASSISTANT, str(message), node_id)
856 cloned = message.clone()
857 metadata = dict(message.metadata)
858 metadata.setdefault("source", node_id)
859 cloned.metadata = metadata
860 return cloned

Callers 1

_execute_nodeMethod · 0.95

Calls 2

_create_messageMethod · 0.95
cloneMethod · 0.80

Tested by

no test coverage detected