make streamable tags a thing

This commit is contained in:
2026-01-05 20:50:29 +08:00
parent 2814b3dabc
commit cdc30c3c32

View File

@@ -66,9 +66,10 @@ class RoutingGraph(GraphBase):
self.workflow = self._build_graph() self.workflow = self._build_graph()
self.streamable_tags:List[List[str]] = self.tool_node.get_streamable_tags() + [["route_chat_llm"]]
def _stream_result(self, *nargs, **kwargs): def _stream_result(self, *nargs, **kwargs):
streamable_tags = self.tool_node.get_streamable_tags() + [["route_chat_llm"]]
def text_iterator(): def text_iterator():
for chunk, metadata in self.workflow.stream({"inp": nargs}, for chunk, metadata in self.workflow.stream({"inp": nargs},
@@ -79,7 +80,7 @@ class RoutingGraph(GraphBase):
chunk, metadata = metadata chunk, metadata = metadata
tags = metadata.get("tags") tags = metadata.get("tags")
if not (tags in streamable_tags): if not (tags in self.streamable_tags):
continue continue
if isinstance(chunk, (BaseMessageChunk, BaseMessage)) and getattr(chunk, "content", None): if isinstance(chunk, (BaseMessageChunk, BaseMessage)) and getattr(chunk, "content", None):