update() — langchain Function Reference
Architecture documentation for the update() function in caches.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD d94616cb_4243_24aa_5cad_1bce1940f0b8["update()"] 374b7b0c_f4fd_ba00_b93d_1a3cbb3b05cb["BaseCache"] d94616cb_4243_24aa_5cad_1bce1940f0b8 -->|defined in| 374b7b0c_f4fd_ba00_b93d_1a3cbb3b05cb 5d456e9b_8125_c661_378a_257f7a88bcf3["update()"] 5d456e9b_8125_c661_378a_257f7a88bcf3 -->|calls| d94616cb_4243_24aa_5cad_1bce1940f0b8 ea890aa7_5e0f_70ac_d2f0_6bc39ac36227["aupdate()"] ea890aa7_5e0f_70ac_d2f0_6bc39ac36227 -->|calls| d94616cb_4243_24aa_5cad_1bce1940f0b8 5d456e9b_8125_c661_378a_257f7a88bcf3["update()"] d94616cb_4243_24aa_5cad_1bce1940f0b8 -->|calls| 5d456e9b_8125_c661_378a_257f7a88bcf3 style d94616cb_4243_24aa_5cad_1bce1940f0b8 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/caches.py lines 73–94
def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None:
"""Update cache based on `prompt` and `llm_string`.
The `prompt` and `llm_string` are used to generate a key for the cache. The key
should match that of the lookup method.
Args:
prompt: A string representation of the prompt.
In the case of a chat model, the prompt is a non-trivial
serialization of the prompt into the language model.
llm_string: A string representation of the LLM configuration.
This is used to capture the invocation parameters of the LLM
(e.g., model name, temperature, stop tokens, max tokens, etc.).
These invocation parameters are serialized into a string
representation.
return_val: The value to be cached.
The value is a list of `Generation` (or subclasses).
"""
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does update() do?
update() is a function in the langchain codebase, defined in libs/core/langchain_core/caches.py.
Where is update() defined?
update() is defined in libs/core/langchain_core/caches.py at line 73.
What does update() call?
update() calls 1 function(s): update.
What calls update()?
update() is called by 2 function(s): aupdate, update.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free