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-corelanguage_modelsllmsupdate_cache
    Functionā—Since v0.1

    update_cache

    Copy
    update_cache(
      cache: BaseCache | bool | None,
      existing_prompts: dict[int
    View source on GitHub
    ,
    list
    ]
    ,
    llm_string
    :
    str
    ,
    missing_prompt_idxs
    :
    list
    [
    int
    ]
    ,
    new_results
    :
    LLMResult
    ,
    prompts
    :
    list
    [
    str
    ]
    )
    ->
    dict
    |
    None

    Parameters

    NameTypeDescription
    cache*BaseCache | bool | None

    Cache object.

    existing_prompts*dict[int, list]

    Dictionary of existing prompts.

    llm_string*str
    missing_prompt_idxs*list[int]
    new_results*LLMResult
    prompts*list[str]

    Update the cache and get the LLM output.

    LLM string.

    List of missing prompt indexes.

    LLMResult object.

    List of prompts.