LCEL streaming
Hi all, I'm using langchain LCEL + stream, so chain.stream...
But now the inputs at on_chain_start are initially empty {inputs:''}
Also in the traces the inputs are empty
14 Replies
Can you share more details on your implementation?
Happy to help debug this
Yea sure!
It starts with a "RunnableSequence" which is infact running in parralel
Is this on langfuse cloud?
Nope running locally
And the initial input chain is just gathering question, chathistory, docs and checking if the prompt is toxic
InputsRag is a wrapper class:
class InputsRag(RunnableParallel):
pass
Since langfuse does not parse the chain names from LCEL
Can you check whether it works without streaming? (this would confirm that it is a problem caaused by how the langfuse integration captures streamed lcel chains)
Yep it works with invoke
Since langfuse does not parse the chain names from LCELthere's an open PR for this and I'm keen to get this fixed soon, we're just putting all of our core effort into some big releases before
So this is the expected behavior, using .invoke instead of stream
Can you add an issue to track this feature request (LCEL streaming support)? Open to contributions on this and we'll see how we can prioritize this soon as well
Yea sure! Also happy to work on this, can you maybe give a quick insight how this could be fixed? I understand it's somewhere in the callbackhandler (on_chain_start)
Also isn't it something on langchain's side? Since the on_chain_start should receive the inputs no?
Happy to support on this as well if you run into questions while trying to fix this. I'd make the same assumption as you (on_chain_start should include this), however the implementation of these interfaces in the langchain library is sometimes not super stable so you'd need to try it locally to see where exactly it breaks currently
I'd just console.log all of the data to quickly investigate and fix
I think it's inside of langchain's code:
So for their runnableSequence invoke func they have:
Which invokes the callback_manager
But the stream function will eventually call this function:
Where they now just call on_chain_start with a empty string as value for input 💀
Thanks for the detail on this! Then we need to wait for a fix in langchain, maybe you can also just contribute a PR there to get this fixed