CallableNodeProcessor#

class langsmith.anonymizer.CallableNodeProcessor(func: Callable[[str], str] | Callable[[str, List[str | int]], str])[source]#

String node processor that uses a callable function to replace sensitive data.

Initialize the processor with a callable function.

Attributes

Methods

__init__(func)

Initialize the processor with a callable function.

mask_nodes(nodes)

Mask nodes using the callable function.

Parameters:

func (Callable[[str], str] | Callable[[str, List[str | int]], str])

__init__(func: Callable[[str], str] | Callable[[str, List[str | int]], str])[source]#

Initialize the processor with a callable function.

Parameters:

func (Callable[[str], str] | Callable[[str, List[str | int]], str])

mask_nodes(nodes: List[StringNode]) List[StringNode][source]#

Mask nodes using the callable function.

Parameters:

nodes (List[StringNode])

Return type:

List[StringNode]