update() — langchain Function Reference
Architecture documentation for the update() function in caches.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 5d456e9b_8125_c661_378a_257f7a88bcf3["update()"] 4d0ff6e4_41b7_2651_42a4_d1f2735b32e1["InMemoryCache"] 5d456e9b_8125_c661_378a_257f7a88bcf3 -->|defined in| 4d0ff6e4_41b7_2651_42a4_d1f2735b32e1 d94616cb_4243_24aa_5cad_1bce1940f0b8["update()"] d94616cb_4243_24aa_5cad_1bce1940f0b8 -->|calls| 5d456e9b_8125_c661_378a_257f7a88bcf3 ea890aa7_5e0f_70ac_d2f0_6bc39ac36227["aupdate()"] ea890aa7_5e0f_70ac_d2f0_6bc39ac36227 -->|calls| 5d456e9b_8125_c661_378a_257f7a88bcf3 d94616cb_4243_24aa_5cad_1bce1940f0b8["update()"] 5d456e9b_8125_c661_378a_257f7a88bcf3 -->|calls| d94616cb_4243_24aa_5cad_1bce1940f0b8 style 5d456e9b_8125_c661_378a_257f7a88bcf3 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/caches.py lines 216–231
def update(self, prompt: str, llm_string: str, return_val: RETURN_VAL_TYPE) -> None:
"""Update cache based on `prompt` and `llm_string`.
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.
return_val: The value to be cached.
The value is a list of `Generation` (or subclasses).
"""
if self._maxsize is not None and len(self._cache) == self._maxsize:
del self._cache[next(iter(self._cache))]
self._cache[prompt, llm_string] = return_val
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 216.
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