Open MartinoMensio opened 2 months ago
Could you verify with python 3.11? Quick glance doesn't look like a bug, but issue with user code not propagating callbacks. We can't do it automatically in versions prior to 3.11 since it's not supported by asyncio
Hi @eyurtsev , thank you for your response. I investigated with python3.11, and everything works as expected. The traces are now shown under the same root trace π I will now check with my project to make the python version requirement stricter.
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
The inner chain should be attached as child to the outer chain. Instead the async calls are shown as independent traces.
Arize-phoenix traces:
Langsmith traces:
Description
I am analysing the traces generated with
invoke
andainvoke
function on a chain that is innerly calling another chain.For the sync run, the inner chain is properly traced under the outer chain. Instead when the
ainvoke
is called on the outer chain, the inner chain is traced as separate. I would expect that bothinvoke
andainvoke
produce the same traces.I think the problem might be in the
run_in_executor
function that is called in theRunnable.ainvoke
, that may be missing some parameters to the self.invoke about the context of the parent chain.I tested it with two different tracing solutions:
Environment requirements:
Environment variables:
System Info
python -m langchain_core.sys_info
: