Skip to content

How do I pass data from middleware to runnable? #346

Closed Answered by eyurtsev
itok01 asked this question in Q&A
Discussion options

You must be logged in to vote

Two options at the moment:

  1. Specifying a per request modifier function. It gives you access to the raw request object and the config. You can then populate the 'configurable' field in config w/ appropriate information. This will work well in conjunction with configurable runnables.
    https://github.com/langchain-ai/langserve/blob/main/examples/configurable_chain/server.py

  2. If you want to do something else, you can use the underlying APIHandler; it'll require typing up a bit more code, but gives you more flexibility: https://github.com/langchain-ai/langserve/blob/main/examples/api_handler_examples/server.py

If you can give me a bit more about the information that you want to pass to the …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by itok01
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants