Skip to content

Passing RunnableConfig through invoke, stream method in request body for a chain exposed through add_route method [langserve,langchain] #25688

Answered by tyadav7
tyadav7 asked this question in Q&A
Discussion options

You must be logged in to vote

@dosu
After a lot of debugging I have finally figure out a way to work with it

So the add_routes takes an additional parameter called CONFIG_KEYS when passed it maps the body to the schema provided.

from langchain_core.runnables.config import COPIABLE_KEYS
add_routes(router, RunnableLambda(myfunc), config_keys=COPIABLE_KEYS , path='/agent')

But this still wont map the additional configurable fields needed to be set for the runnable function.

So I created a separate class which extends the RunnableLambda and overrides the method config_specs this override is needed so that the configurable parameters could be map so that FastAPI could then resolve this schema later when this lambda is called.

Replies: 2 comments 13 replies

Comment options

You must be logged in to vote
4 replies
@tyadav7
Comment options

@dosubot
Comment options

@tyadav7
Comment options

@dosubot
Comment options

Comment options

You must be logged in to vote
9 replies
@dosubot
Comment options

@tyadav7
Comment options

@dosubot
Comment options

@tyadav7
Comment options

Answer selected by tyadav7
@dosubot
Comment options

@tyadav7
Comment options

@dosubot
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant