Client
instance. This can be done by setting the hide_inputs
and hide_outputs
parameters on the Client
object (hideInputs
and hideOutputs
in TypeScript).
For the example below, we will simply return an empty object for both hide_inputs
and hide_outputs
, but you can customize this to your needs.
create_anonymizer
/ createAnonymizer
function and pass the newly created anonymizer when instantiating the client. The anonymizer can be either constructed from a list of regex patterns and the replacement values or from a function that accepts and returns a string value.
The anonymizer will be skipped for inputs if LANGSMITH_HIDE_INPUTS = true
. Same applies for outputs if LANGSMITH_HIDE_OUTPUTS = true
.
However, if inputs or outputs are to be sent to client, the anonymizer
method will take precedence over functions found in hide_inputs
and hide_outputs
. By default, the create_anonymizer
will only look at maximum of 10 nesting levels deep, which can be configured via the max_depth
parameter.
anonymizer
API is on our roadmap! If you are encountering performance issues, please contact us at support@langchain.dev.hide_inputs
and hide_outputs
parameters to achieve the same effect. You can also use these parameters to process the inputs and outputs more efficiently as well.
process_outputs
parameter is available in LangSmith SDK version 0.1.98 and above for Python.process_inputs
and process_outputs
parameters of the @traceable
decorator.
These parameters accept functions that allow you to transform the inputs and outputs of a specific function before they are logged to LangSmith. This is useful for reducing payload size, removing sensitive information, or customizing how an object should be serialized and represented in LangSmith for a particular function.
Here’s an example of how to use process_inputs
and process_outputs
:
process_inputs
creates a new dictionary with processed input data, and process_outputs
transforms the output into a specific format before logging to LangSmith.
hide_inputs
and hide_outputs
) when both are defined.