lookup() — langchain Function Reference
Architecture documentation for the lookup() function in caches.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 33992700_8660_279c_c076_25dbaf11d42e["lookup()"] 374b7b0c_f4fd_ba00_b93d_1a3cbb3b05cb["BaseCache"] 33992700_8660_279c_c076_25dbaf11d42e -->|defined in| 374b7b0c_f4fd_ba00_b93d_1a3cbb3b05cb 96f549f9_62d6_df34_85e0_52e9969a67d0["lookup()"] 96f549f9_62d6_df34_85e0_52e9969a67d0 -->|calls| 33992700_8660_279c_c076_25dbaf11d42e b409a2c7_b52c_d41d_bd46_dd9bf497c6c2["alookup()"] b409a2c7_b52c_d41d_bd46_dd9bf497c6c2 -->|calls| 33992700_8660_279c_c076_25dbaf11d42e 96f549f9_62d6_df34_85e0_52e9969a67d0["lookup()"] 33992700_8660_279c_c076_25dbaf11d42e -->|calls| 96f549f9_62d6_df34_85e0_52e9969a67d0 style 33992700_8660_279c_c076_25dbaf11d42e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/langchain_core/caches.py lines 49–70
def lookup(self, prompt: str, llm_string: str) -> RETURN_VAL_TYPE | None:
"""Look up based on `prompt` and `llm_string`.
A cache implementation is expected to generate a key from the 2-tuple
of `prompt` and `llm_string` (e.g., by concatenating them with a delimiter).
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.
Returns:
On a cache miss, return `None`. On a cache hit, return the cached value.
The cached value is a list of `Generation` (or subclasses).
"""
Domain
Subdomains
Defined In
Calls
Source
Frequently Asked Questions
What does lookup() do?
lookup() is a function in the langchain codebase, defined in libs/core/langchain_core/caches.py.
Where is lookup() defined?
lookup() is defined in libs/core/langchain_core/caches.py at line 49.
What does lookup() call?
lookup() calls 1 function(s): lookup.
What calls lookup()?
lookup() is called by 2 function(s): alookup, lookup.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free