For some code paths currently, if you mutate inputs/outputs within Xs of invocation, langsmith will log the mutated value, which is confusing and the wrong behavior.
We can't naively use deepcopy, as many valid python objects cannot be copied.
This PR creates a compromise solution that attempts to deepcopy and then falls back to copying up to depth 4 while handling errors.
Will hopefully resolve #706 . Placed before the hide_* as well so that if people want to mutate the dict when filtering it doesn't impact the execution flow.
For some code paths currently, if you mutate inputs/outputs within Xs of invocation, langsmith will log the mutated value, which is confusing and the wrong behavior.
We can't naively use deepcopy, as many valid python objects cannot be copied.
This PR creates a compromise solution that attempts to deepcopy and then falls back to copying up to depth 4 while handling errors.
Will hopefully resolve #706 . Placed before the
hide_*
as well so that if people want to mutate the dict when filtering it doesn't impact the execution flow.