Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support sending "null" message to LangGraph stream #1229

Open
lkrzyzanek opened this issue Nov 28, 2024 · 0 comments
Open

Support sending "null" message to LangGraph stream #1229

lkrzyzanek opened this issue Nov 28, 2024 · 0 comments

Comments

@lkrzyzanek
Copy link

I'm trying to do pause-resume scenario with LangGraph and works very nicely but I had to tweak chatApi.ts
https://github.com/Yonom/assistant-ui/blob/main/examples/with-langgraph/lib/chatApi.ts#L44

So it would be cool to have more "native" support for it.
The trick here is that after sending an update the status of specific node sendUpdate like this

            await updateState(threadId, {
              newState: { messages: [tool_message] },
              asNode: "humanInput",
            })

It's important to send message that "continue" the workflow from THAT node. And it's done via

    // passing null means "continue"
    const stream = await app.stream(null,  config);

It's crucial to pass "null" and not "toolMessage with empty content".

The issue with current implementation is when I'm calling addResult(null); in my component it sends ToolMessage with content='' which sends an empty message.
So I tweaked the chatApi.ts to ignore that and send "null" to continue the workflow. Then workflow nicely continued on "humanInput" node as expected and is not going through START node.

Could you please add some better support to sending "null" into the stream?

Langgraph docs for reference: https://langchain-ai.github.io/langgraph/cloud/how-tos/human_in_the_loop_user_input/#invoking-after-receiving-human-input

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant