langchain.retrievers.ensemble
.unique_by_key¶
- langchain.retrievers.ensemble.unique_by_key(iterable: Iterable[T], key: Callable[[T], H]) Iterator[T] [source]¶
Yield unique elements of an iterable based on a key function.
- Parameters
iterable (Iterable[T]) – The iterable to filter.
key (Callable[[T], H]) – A function that returns a hashable key for each element.
- Yields
Unique elements of the iterable based on the key function.
- Return type
Iterator[T]