File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
libs/core/langchain_core/callbacks Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -965,11 +965,11 @@ def merge(self, other: BaseCallbackManager) -> Self:
965965 # ['tag2', 'tag1']
966966 ```
967967 """ # noqa: E501
968- # Directly combine the handler lists without using add_handler
969- # to preserve the distinction between handlers and inheritable_handlers
970- combined_handlers = list (self .handlers ) + list (other .handlers )
971- combined_inheritable = list (self . inheritable_handlers ) + list (
972- other .inheritable_handlers
968+ # Combine handlers and inheritable_handlers separately, using sets
969+ # to deduplicate (order not preserved)
970+ combined_handlers = list (set ( self .handlers ) | set (other .handlers ) )
971+ combined_inheritable = list (
972+ set ( self . inheritable_handlers ) | set ( other .inheritable_handlers )
973973 )
974974
975975 return self .__class__ (
You can’t perform that action at this time.
0 commit comments