What is the source of NotImplementedError in LogStreamCallbackHandler.on_chain_end callback when using LangGraph? #17199
Replies: 6 comments 1 reply
-
🤖 Hey @adrian-kaehler, great to see you diving into another interesting issue! Hope you're doing well. Thank you for providing such a detailed description of your issue. The However, it's important to note that you, as a user of the LangChain library, should not need to modify the The error message you're seeing suggests that the library is trying to serialize an object that doesn't support serialization. This could be due to a variety of reasons, but it's difficult to pinpoint the exact cause without more information. One possible cause could be the data you're passing to the Another possible cause could be the To debug this issue, I would recommend adding print statements or using a debugger to inspect the values of If you're still unable to resolve the issue after trying these steps, please provide more information about the Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
@dosu-bot [aside intended for human reader: I posted the above but forgot to put @dosu-bot at the top. I used "edit" to add it, but it looks like this did not trigger the bot.] |
Beta Was this translation helpful? Give feedback.
-
🤖 The The error message suggests that the object causing the issue is of type Looking at your code, it seems that the To debug this issue, I would recommend adding some print statements or logging in your Here's an example of how you might modify your def node(context: Context):
...
try:
result = chain.invoke({
'question': context['question'],
})
print(f"Result: {result}")
except NotImplementedError as e:
print(f"Caught NotImplementedError: {e}")
print(f"Context: {context}")
... This should give you more information about what's causing the error and help you figure out how to fix it. If you're still having trouble, please provide the output of these print statements and I'll be happy to help further. Sources
|
Beta Was this translation helpful? Give feedback.
-
In all cases the error is not caught because it does not appear to have been raised as an exception. Note that I am using LangGraph and there are many invoke calls at various nodes in the graph. All of them appear to produce this message, but in none of the cases is there an actual exception to be caught. |
Beta Was this translation helpful? Give feedback.
-
🤖 The The error message indicates that the object causing the issue is of type To debug this issue, you could try the following steps:
async def event_processor():
graphx = build_graph()
try:
async for event in graphx.astream_events(
input={
'question': "what is the meaning of life?",
},
version="v1"
):
kind = event["event"]
if kind == 'on_chain_end':
print(f"on_chain_end event data: {event}")
except Exception as e:
print(f"Error: {e}")
I hope this helps! If you're still encountering the issue after trying these steps, please provide more information about the exact circumstances under which the error occurs, and I'll do my best to assist you further. Sources
|
Beta Was this translation helpful? Give feedback.
-
@adrian-kaehler Did you ever figure out what the source of NotImplemented was? Having the same issue. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
I have attached a very stripped down version of a LangGraph running on what is normally a FastAPI server. When I run the graph, I am streaming events using the astream_events interface. For some fraction of events, there is an error thrown that I do not understand the source of or how to fix. I do not know if this is a bug, or simply my own not knowing if something is needed that I am not doing.
The error is the following:
It occurs on the instance of only some of the on_chain_end events, but not all of them. Here is the output from the sample code provided:
Can someone help me understand what is happening here? I do not see that the unserializable object is something provided by me, and it is not clear to me how to interact with this on_chain_end callback, or even if that is expected. Is this a bug? If not, how do I resolve this error?
System Info
python3 -m langchain_core.sys_info
System Information
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found:
Beta Was this translation helpful? Give feedback.
All reactions