LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
    • Overview
    • Caches
    • Callbacks
    • Documents
    • Document loaders
    • Embeddings
    • Exceptions
    • Language models
    • Serialization
    • Output parsers
    • Prompts
    • Rate limiters
    • Retrievers
    • Runnables
    • Utilities
    • Vector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    ⌘I

    LangChain Assistant

    Ask a question to get started

    Enter to send•Shift+Enter new line

    Menu

    OverviewCachesCallbacksDocumentsDocument loadersEmbeddingsExceptionsLanguage modelsSerializationOutput parsersPromptsRate limitersRetrieversRunnablesUtilitiesVector stores
    MCP Adapters
    Standard Tests
    Text Splitters
    Language
    Theme
    Pythonlangchain-coreutils_mergemerge_dicts
    Functionā—Since v0.1

    merge_dicts

    Copy
    merge_dicts(
        left: dict[str, Any],
        *others: dict[str, 
    View source on GitHub
    Any
    ]
    =
    (
    )
    ,
    )
    ->
    dict
    [
    str
    ,
    Any
    ]

    Parameters

    NameTypeDescription
    left*dict[str, Any]
    othersdict[str, Any]
    Default:()

    Merge dictionaries.

    Merge many dicts, handling specific scenarios where a key exists in both dictionaries but has a value of None in 'left'. In such cases, the method uses the value from 'right' for that key in the merged dictionary.

    Example:

    If left = {"function_call": {"arguments": None}} and right = {"function_call": {"arguments": "{\n"}}, then, after merging, for the key 'function_call', the value from 'right' is used, resulting in merged = {"function_call": {"arguments": "{\n"}}.

    The first dictionary to merge.

    The other dictionaries to merge.