RunnableWithMessageHistory does not work for RemoteRunnable #100

Closed
opened 2026-02-16 00:18:47 -05:00 by yindo · 5 comments
Owner

Originally created by @rever1and on GitHub (Jan 24, 2024).

Hi, I tried to use RunnableWithMessageHistory around RemoteRunnalble, but it failed to work

    runnable = RemoteRunnable("http://xxxxxxx/chat/")                                    
    return RunnableWithMessageHistory(                                                            
        runnable,                                                                                 
        RedisChatMessageHistory,                                                     
        input_messages_key="question",                                                            
        history_messages_key="chat_history",                                                      
    ).with_config({"run_name": "app"}) 

failed with

TypeError: Object of type RedisChatMessageHistory is not JSON serializable  

I checked the source code and find the configurable is not serializable.

https://github.com/langchain-ai/langserve/blob/a7c2a94bb78bd1ac193a031143b95fb6bae0eae3/langserve/client.py#L278

which is inserted into configurable by RunnableWithMessageHistory

https://github.com/langchain-ai/langchain/blob/9e95699277fe0db3bfee1654276a43bfba9ecc64/libs/core/langchain_core/runnables/history.py#L320

Originally created by @rever1and on GitHub (Jan 24, 2024). Hi, I tried to use RunnableWithMessageHistory around RemoteRunnalble, but it failed to work ``` runnable = RemoteRunnable("http://xxxxxxx/chat/") return RunnableWithMessageHistory( runnable, RedisChatMessageHistory, input_messages_key="question", history_messages_key="chat_history", ).with_config({"run_name": "app"}) ``` failed with ``` TypeError: Object of type RedisChatMessageHistory is not JSON serializable ``` I checked the source code and find the configurable is not serializable. https://github.com/langchain-ai/langserve/blob/a7c2a94bb78bd1ac193a031143b95fb6bae0eae3/langserve/client.py#L278 which is inserted into configurable by RunnableWithMessageHistory https://github.com/langchain-ai/langchain/blob/9e95699277fe0db3bfee1654276a43bfba9ecc64/libs/core/langchain_core/runnables/history.py#L320
yindo closed this issue 2026-02-16 00:18:47 -05:00
Author
Owner

@eyurtsev commented on GitHub (Jan 25, 2024):

HI @rever1and, Would you be able to include a minimal reproducible example? (i.e., with all required imports etc) It'll make it easier for me to debug / and see how to resolve the issue.

@eyurtsev commented on GitHub (Jan 25, 2024): HI @rever1and, Would you be able to include a minimal reproducible example? (i.e., with all required imports etc) It'll make it easier for me to debug / and see how to resolve the issue.
Author
Owner

@eyurtsev commented on GitHub (Jan 25, 2024):

Actually I might know what this is, will update once resolved

@eyurtsev commented on GitHub (Jan 25, 2024): Actually I might know what this is, will update once resolved
Author
Owner

@rever1and commented on GitHub (Jan 25, 2024):

HI @rever1and, Would you be able to include a minimal reproducible example? (i.e., with all required imports etc) It'll make it easier for me to debug / and see how to resolve the issue.

ok, but looks like you've already reproduce that...do you still need that now?

@rever1and commented on GitHub (Jan 25, 2024): > HI @rever1and, Would you be able to include a minimal reproducible example? (i.e., with all required imports etc) It'll make it easier for me to debug / and see how to resolve the issue. ok, but looks like you've already reproduce that...do you still need that now?
Author
Owner

@eyurtsev commented on GitHub (Jan 26, 2024):

Thanks I'm all set will release fix in a few days

@eyurtsev commented on GitHub (Jan 26, 2024): Thanks I'm all set will release fix in a few days
Author
Owner

@eyurtsev commented on GitHub (Feb 1, 2024):

Closing issue as fix was merged and released.

@eyurtsev commented on GitHub (Feb 1, 2024): Closing issue as fix was merged and released.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langserve#100