Relative Content

Tag Archive for pythonfastapilangchain

Returning a chain with a custom runnable in Langchain to use with Langserve

I am trying to create a custom chain that would be served via my langserve API and would accept configurable fields via the per_req_config_modifier that helps out in parsing headers from the API request and passing them on to the custom runnable class. I have defined the class like this so far which worked when I was using my own OpenAI API key to test. However, to enable passing the key from the request headers would require me to pass the key via config modifier as defined below. I have modified the class like so: