PRODUCTION SCENARIO
A Generative AI Engineer has LangChain autologging enabled, so retriever and LLM spans appear in MLflow traces. A custom Python function that deduplicates and reorders chunks between those calls is invisible in the trace, and it is the suspected cause of bad answers.
How should the engineer make that step visible in the same trace?
Answering here is anonymous. Nothing is saved unless you sign in.
Show answer and explanation
Answer: Decorate the custom function with @mlflow.trace and keep autologging on
Automatic tracing captures supported library calls and combines with the @mlflow.trace decorator, so custom logic between LLM calls appears in one unified trace. Disabling autologging or splitting the work into another experiment fragments the trace and loses the surrounding context.