mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-06 01:37:49 +02:00
14 lines
319 B
Python
14 lines
319 B
Python
from permchain import Pregel, channels
|
|
|
|
value = channels.LastValue[str]("value")
|
|
|
|
grow_value = (
|
|
Pregel.subscribe_to(value)
|
|
| (lambda x: x + x)
|
|
| Pregel.send_to({value: lambda x: x if len(x) < 10 else None})
|
|
)
|
|
|
|
pubsub = Pregel(grow_value, input=value, output=value)
|
|
|
|
assert pubsub.invoke("a") == "aaaaaaaa"
|