Home / File/ cache.py — langchain Source File

cache.py — langchain Source File

Architecture documentation for cache.py, a python file in the langchain codebase. 3 imports, 0 dependents.

File python CoreAbstractions Serialization 3 imports 2 functions

Entity Profile

Dependency Diagram

graph LR
  c4c3fa38_7310_8e56_8adc_81c7fe45e4dd["cache.py"]
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  c4c3fa38_7310_8e56_8adc_81c7fe45e4dd --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  439a4142_6fa6_fe9a_2cba_7c9fb0cdceb7["langchain_classic._api"]
  c4c3fa38_7310_8e56_8adc_81c7fe45e4dd --> 439a4142_6fa6_fe9a_2cba_7c9fb0cdceb7
  cb50aee0_49de_f2fb_b176_4a2cfcbfb66f["langchain_community.cache"]
  c4c3fa38_7310_8e56_8adc_81c7fe45e4dd --> cb50aee0_49de_f2fb_b176_4a2cfcbfb66f
  style c4c3fa38_7310_8e56_8adc_81c7fe45e4dd fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from typing import TYPE_CHECKING, Any

from langchain_classic._api import create_importer

if TYPE_CHECKING:
    from langchain_community.cache import (
        AstraDBCache,
        AstraDBSemanticCache,
        AzureCosmosDBSemanticCache,
        CassandraCache,
        CassandraSemanticCache,
        FullLLMCache,
        FullMd5LLMCache,
        GPTCache,
        InMemoryCache,
        MomentoCache,
        RedisCache,
        RedisSemanticCache,
        SQLAlchemyCache,
        SQLAlchemyMd5Cache,
        SQLiteCache,
        UpstashRedisCache,
    )

# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_LOOKUP = {
    "FullLLMCache": "langchain_community.cache",
    "SQLAlchemyCache": "langchain_community.cache",
    "SQLiteCache": "langchain_community.cache",
    "UpstashRedisCache": "langchain_community.cache",
    "RedisCache": "langchain_community.cache",
    "RedisSemanticCache": "langchain_community.cache",
    "GPTCache": "langchain_community.cache",
    "MomentoCache": "langchain_community.cache",
    "InMemoryCache": "langchain_community.cache",
    "CassandraCache": "langchain_community.cache",
    "CassandraSemanticCache": "langchain_community.cache",
    "FullMd5LLMCache": "langchain_community.cache",
    "SQLAlchemyMd5Cache": "langchain_community.cache",
    "AstraDBCache": "langchain_community.cache",
    "AstraDBSemanticCache": "langchain_community.cache",
    "AzureCosmosDBSemanticCache": "langchain_community.cache",
}

_import_attribute = create_importer(__package__, deprecated_lookups=DEPRECATED_LOOKUP)


def __getattr__(name: str) -> Any:
    """Look up attributes dynamically."""
    return _import_attribute(name)


__all__ = [
    "AstraDBCache",
    "AstraDBSemanticCache",
    "AzureCosmosDBSemanticCache",
    "CassandraCache",
    "CassandraSemanticCache",
    "FullLLMCache",
    "FullMd5LLMCache",
    "GPTCache",
    "InMemoryCache",
    "MomentoCache",
    "RedisCache",
    "RedisSemanticCache",
    "SQLAlchemyCache",
    "SQLAlchemyMd5Cache",
    "SQLiteCache",
    "UpstashRedisCache",
]

Subdomains

Dependencies

  • langchain_classic._api
  • langchain_community.cache
  • typing

Frequently Asked Questions

What does cache.py do?
cache.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, Serialization subdomain.
What functions are defined in cache.py?
cache.py defines 2 function(s): __getattr__, langchain_community.
What does cache.py depend on?
cache.py imports 3 module(s): langchain_classic._api, langchain_community.cache, typing.
Where is cache.py in the architecture?
cache.py is located at libs/langchain/langchain_classic/cache.py (domain: CoreAbstractions, subdomain: Serialization, directory: libs/langchain/langchain_classic).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free