In langserve, how to pass a configurable param to a langchain LLM chain using curl?

156 Views Asked by At

I have a langchain LLM chain linked to a route of a FastAPI server. I used langserve add_route() method. As I have session_id passed as "configurable" param and everything works when I invoke the chain directly like: chain.invoke({"question":user_input},config={"configurable": {"session_id": SESSIONID}})

But if I want to use curl or RemoteRunnable I tried:

curl --no-buffer -X 'POST' 'http://0.0.0.0:8000/chainroute/invoke' -H 'accept: text/plain' -H 'Content-Type: application/json' -d '{"input":{"question": "....", "session_id": "1234567890" }}'

curl --no-buffer -X 'POST' 'http://0.0.0.0:8000/chainroute/invoke' -H 'accept: text/plain' -H 'Content-Type: application/json' -d '{"input":{"question": "....",{"configurable":{"session_id":"1234567890"}}}}'

curl --no-buffer -X 'POST' 'http://0.0.0.0:8000/chainroute/stream' -H 'accept: text/plain' -H 'Content-Type: application/json' -d '{"input":{"question":"...."},"config":{"configurable":{"session_id":"1234567890"}}}'

chat = RemoteRunnable("http://0.0.0.0:8000/chainroute") chat.invoke({"question":"......"},config={"configurable": {"session_id": 1234567890}})

But none is working, it never recognizes the session_id param. Is there a way to do that? I've searched online but haven't find anything.

0

There are 0 best solutions below