-
Notifications
You must be signed in to change notification settings - Fork 218
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
Bug: TypeError: Type is not JSON serializable: Send #721
Comments
I've opened a PR to fix this. |
Is there any way to solve this without changing the code in python packages? For example, changing something from our side insted of changing in packages. |
Yes serialization issues should be solvable by suffixing a runnable generator or runnable lambda to dump the object into json. At the moment, langserve is not considered to be compatible with langgraph -- https://github.com/langchain-ai/langserve?tab=readme-ov-file#%EF%B8%8F-langgraph-compatibility The APIHandler itself has a serializer property that isn't exposed, but one solution would be to expose it to allow users to pass custom hooks for serde. |
A workaround which works is to apply monkey patch to the default function, very much like your PR @gcalabria:
|
Error:
TypeError: Type is not JSON serializable: Send
I am trying to replicate the langgraph map-reduce example using langserve and langgraph, but then I get the error
TypeError: Type is not JSON serializable: Send
.I only get this error when using langserve. If I run the code in the notebook, then everything is fine. Thus, I think that the problem lies with langserve and not langgraph.
Here is the code I am using:
graph.py
server.py
Here is the error message:
The text was updated successfully, but these errors were encountered: