Home / Function/ lookup() — langchain Function Reference

lookup() — langchain Function Reference

Architecture documentation for the lookup() function in caches.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  96f549f9_62d6_df34_85e0_52e9969a67d0["lookup()"]
  4d0ff6e4_41b7_2651_42a4_d1f2735b32e1["InMemoryCache"]
  96f549f9_62d6_df34_85e0_52e9969a67d0 -->|defined in| 4d0ff6e4_41b7_2651_42a4_d1f2735b32e1
  33992700_8660_279c_c076_25dbaf11d42e["lookup()"]
  33992700_8660_279c_c076_25dbaf11d42e -->|calls| 96f549f9_62d6_df34_85e0_52e9969a67d0
  b409a2c7_b52c_d41d_bd46_dd9bf497c6c2["alookup()"]
  b409a2c7_b52c_d41d_bd46_dd9bf497c6c2 -->|calls| 96f549f9_62d6_df34_85e0_52e9969a67d0
  33992700_8660_279c_c076_25dbaf11d42e["lookup()"]
  96f549f9_62d6_df34_85e0_52e9969a67d0 -->|calls| 33992700_8660_279c_c076_25dbaf11d42e
  style 96f549f9_62d6_df34_85e0_52e9969a67d0 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/core/langchain_core/caches.py lines 201–214

    def lookup(self, prompt: str, llm_string: str) -> RETURN_VAL_TYPE | None:
        """Look up 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.

        Returns:
            On a cache miss, return `None`. On a cache hit, return the cached value.
        """
        return self._cache.get((prompt, llm_string), None)

Domain

Subdomains

Calls

Called By

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 201.
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