-
Hi, I'm new to langserve and I've set up a chain using the chat with persistence example. https://github.com/langchain-ai/langserve/blob/main/examples/chat_with_persistence/server.py. I have the per_request_config_modifier set up to extract the authenticated user id and set it into the configurable object. i.e. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @Chengdyc , Here's some code:
I hope it can be useful |
Beta Was this translation helpful? Give feedback.
-
Thanks! looks like the trick is to add a step in the LCEL chain to extract the user_id from configurable into the chain payload. |
Beta Was this translation helpful? Give feedback.
Hi @Chengdyc ,
after a few hours of head scratching and trial and error, I've been able to make it.
I'm not using a configurable field, but a prompt variable that is assigned in the chain's first step reading from config.
Here's some code: