Home / File/ __init__.py — langchain Source File

__init__.py — langchain Source File

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

Entity Profile

Dependency Diagram

graph LR
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5["__init__.py"]
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  439a4142_6fa6_fe9a_2cba_7c9fb0cdceb7["langchain_classic._api"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> 439a4142_6fa6_fe9a_2cba_7c9fb0cdceb7
  fa7f5088_cc60_fc55_a885_6f490834689c["langchain_classic.memory.buffer"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> fa7f5088_cc60_fc55_a885_6f490834689c
  c452ca90_0427_5792_deed_8488d80fced5["langchain_classic.memory.buffer_window"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> c452ca90_0427_5792_deed_8488d80fced5
  30f886ad_0a43_3fe4_e6cb_ff6d543afda2["langchain_classic.memory.combined"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> 30f886ad_0a43_3fe4_e6cb_ff6d543afda2
  95c71c6c_a17a_e21d_30e9_763a9d973655["langchain_classic.memory.entity"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> 95c71c6c_a17a_e21d_30e9_763a9d973655
  e248d63a_8f3f_58a6_5510_70b58141a61e["langchain_classic.memory.readonly"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> e248d63a_8f3f_58a6_5510_70b58141a61e
  b5c49ee5_46c9_1ef1_fb67_2a1ae796aed8["langchain_classic.memory.simple"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> b5c49ee5_46c9_1ef1_fb67_2a1ae796aed8
  68580bf1_e2f3_15de_9d81_9a40ff9b227f["langchain_classic.memory.summary"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> 68580bf1_e2f3_15de_9d81_9a40ff9b227f
  83265fcb_f239_126b_4b58_47636471c382["langchain_classic.memory.summary_buffer"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> 83265fcb_f239_126b_4b58_47636471c382
  2b278813_0a37_c5e7_9f85_b24ab7ad09f2["langchain_classic.memory.token_buffer"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> 2b278813_0a37_c5e7_9f85_b24ab7ad09f2
  ed48ca7d_1be4_58a1_0e7c_4906e0ec9737["langchain_classic.memory.vectorstore"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> ed48ca7d_1be4_58a1_0e7c_4906e0ec9737
  7ea0a470_1477_1fc7_92f9_8ad5667716ca["langchain_classic.memory.vectorstore_token_buffer_memory"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> 7ea0a470_1477_1fc7_92f9_8ad5667716ca
  ac740465_f359_2ce3_b4da_0d97cde0f03a["langchain_community.chat_message_histories"]
  8324c868_8333_c4d7_16a2_7ed6ef68b3e5 --> ac740465_f359_2ce3_b4da_0d97cde0f03a
  style 8324c868_8333_c4d7_16a2_7ed6ef68b3e5 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"""**Memory** maintains Chain state, incorporating context from past runs."""

from typing import TYPE_CHECKING, Any

from langchain_classic._api import create_importer
from langchain_classic.memory.buffer import (
    ConversationBufferMemory,
    ConversationStringBufferMemory,
)
from langchain_classic.memory.buffer_window import ConversationBufferWindowMemory
from langchain_classic.memory.combined import CombinedMemory
from langchain_classic.memory.entity import (
    ConversationEntityMemory,
    InMemoryEntityStore,
    RedisEntityStore,
    SQLiteEntityStore,
    UpstashRedisEntityStore,
)
from langchain_classic.memory.readonly import ReadOnlySharedMemory
from langchain_classic.memory.simple import SimpleMemory
from langchain_classic.memory.summary import ConversationSummaryMemory
from langchain_classic.memory.summary_buffer import ConversationSummaryBufferMemory
from langchain_classic.memory.token_buffer import ConversationTokenBufferMemory
from langchain_classic.memory.vectorstore import VectorStoreRetrieverMemory
from langchain_classic.memory.vectorstore_token_buffer_memory import (
    ConversationVectorStoreTokenBufferMemory,  # avoid circular import
)

if TYPE_CHECKING:
    from langchain_community.chat_message_histories import (
        AstraDBChatMessageHistory,
        CassandraChatMessageHistory,
        ChatMessageHistory,
        CosmosDBChatMessageHistory,
        DynamoDBChatMessageHistory,
        ElasticsearchChatMessageHistory,
        FileChatMessageHistory,
        MomentoChatMessageHistory,
        MongoDBChatMessageHistory,
        PostgresChatMessageHistory,
        RedisChatMessageHistory,
        SingleStoreDBChatMessageHistory,
        SQLChatMessageHistory,
        StreamlitChatMessageHistory,
        UpstashRedisChatMessageHistory,
        XataChatMessageHistory,
        ZepChatMessageHistory,
    )
    from langchain_community.memory.kg import ConversationKGMemory
    from langchain_community.memory.motorhead_memory import MotorheadMemory
    from langchain_community.memory.zep_memory import ZepMemory


# Create a way to dynamically look up deprecated imports.
# Used to consolidate logic for raising deprecation warnings and
# handling optional imports.
DEPRECATED_LOOKUP = {
    "MotorheadMemory": "langchain_community.memory.motorhead_memory",
    "ConversationKGMemory": "langchain_community.memory.kg",
    "ZepMemory": "langchain_community.memory.zep_memory",
// ... (67 more lines)

Subdomains

Dependencies

  • langchain_classic._api
  • langchain_classic.memory.buffer
  • langchain_classic.memory.buffer_window
  • langchain_classic.memory.combined
  • langchain_classic.memory.entity
  • langchain_classic.memory.readonly
  • langchain_classic.memory.simple
  • langchain_classic.memory.summary
  • langchain_classic.memory.summary_buffer
  • langchain_classic.memory.token_buffer
  • langchain_classic.memory.vectorstore
  • langchain_classic.memory.vectorstore_token_buffer_memory
  • langchain_community.chat_message_histories
  • langchain_community.memory.kg
  • langchain_community.memory.motorhead_memory
  • langchain_community.memory.zep_memory
  • typing

Frequently Asked Questions

What does __init__.py do?
__init__.py is a source file in the langchain codebase, written in python. It belongs to the CoreAbstractions domain, RunnableInterface subdomain.
What functions are defined in __init__.py?
__init__.py defines 2 function(s): __getattr__, langchain_community.
What does __init__.py depend on?
__init__.py imports 17 module(s): langchain_classic._api, langchain_classic.memory.buffer, langchain_classic.memory.buffer_window, langchain_classic.memory.combined, langchain_classic.memory.entity, langchain_classic.memory.readonly, langchain_classic.memory.simple, langchain_classic.memory.summary, and 9 more.
Where is __init__.py in the architecture?
__init__.py is located at libs/langchain/langchain_classic/memory/__init__.py (domain: CoreAbstractions, subdomain: RunnableInterface, directory: libs/langchain/langchain_classic/memory).

Analyze Your Own Codebase

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

Try Supermodel Free