mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-08-21 23:22:27 +02:00
17 lines
338 B
Python
17 lines
338 B
Python
from permchain import Pregel, channels
|
|
|
|
grow_value = (
|
|
Pregel.subscribe_to("value")
|
|
| (lambda x: x + x)
|
|
| Pregel.send_to(value=lambda x: x if len(x) < 10 else None)
|
|
)
|
|
|
|
app = Pregel(
|
|
grow_value,
|
|
channels={"value": channels.LastValue(str)},
|
|
input="value",
|
|
output="value",
|
|
)
|
|
|
|
assert app.invoke("a") == "aaaaaaaa"
|