LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • MCP Adapters
    Standard Tests
    Text Splitters
    • Overview
    • Agents
    • Callbacks
    • Chains
    • Chat models
    • Embeddings
    • Evaluation
    • Globals
    • Hub
    • Memory
    • Output parsers
    • Retrievers
    • Runnables
    • LangSmith
    • Storage
    โŒ˜I

    Chat LangChain

    What can I help with?

    Enter to sendยทShift+Enter new line

    Menu

    MCP Adapters
    Standard Tests
    Text Splitters
    OverviewAgentsCallbacksChainsChat modelsEmbeddingsEvaluationGlobalsHubMemoryOutput parsersRetrieversRunnablesLangSmithStorage
    Language
    Theme
    Pythonlangchain-classicretrieversensembleunique_by_key
    Functionโ—Since v1.5

    unique_by_key

    Copy
    unique_by_key(
        iterable: Iterable[T],
        key: Callable[[T], H],
    View source on GitHub
    )
    ->
    Iterator
    [
    T
    ]

    Parameters

    NameTypeDescription
    iterable*Iterable[T]
    key*Callable[[T], H]

    Yield unique elements of an iterable based on a key function.

    The iterable to filter.

    A function that returns a hashable key for each element.