langfuse-python icon indicating copy to clipboard operation
langfuse-python copied to clipboard

Add support langchain stream

Open wodadehencou opened this issue 1 year ago • 1 comments

When calling the stream method in LangChain, the on_chain_start method takes a dummy input: {"input":""}. This is because if the input is a streaming data, it needs to collect all the streaming data completely before executing the update operation in the on_chain_end or on_chain_error callback methods.

In the on_chain_end and on_chain_error methods, when determining if the input kwargs has the inputs parameter, if it does, the inputs parameter is passed during the update trace execution to achieve the effect of updating the span's input.

The same issue is in langchain repo: https://github.com/langchain-ai/langchain/issues/18567

wodadehencou avatar Mar 19 '24 02:03 wodadehencou

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Mar 19 '24 02:03 CLAassistant

Thanks a lot for your contribution - this is support on main by now! 🙏🏾

hassiebp avatar Oct 10 '24 16:10 hassiebp