Runnable with_listeners only hits first LLM invoke/ainvoke call in StateGraph Node #29655
Unanswered
colintkyle
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked other resources
Commit to Help
Example Code
Description
You can see in the minimal example here I'm creating a StateGraph and attaching the listener which will print the input arguments. I attach the listener to a node that makes two invoke calls.
It's a bit confusing that it's not the inputs to the node (state) that are getting logged - it's only the invoke/ainvoke calls. However, I do see the advantage of being able to get the invoke calls, however...
My listener only gets called the first time invoke is called. So I'm not able to record details of the LLM call.
I get that I'm not really following the design pattern here and could add another node and edge, but the documentation doesn't explain that this way of building a StateGraph would be a problem. Unfortunately, I have a large amount of code written in this style, does anyone have any suggestions for getting listeners to work for multiple llm calls? I'm also wondering if I should raise an issue, or am just misunderstanding how StateGraph is supposed to work.
Thanks!
System Info
langchain==0.3.17
langchain-community==0.3.16
langchain-core==0.3.33
langchain-openai==0.2.14
langchain-text-splitters==0.3.5
Beta Was this translation helpful? Give feedback.
All reactions