__init__() — langchain Function Reference
Architecture documentation for the __init__() function in entity.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 28535b08_6603_aa75_f05d_abb90636cd88["__init__()"] 40387f29_12a3_f291_fc18_4ce17ac91db3["SQLiteEntityStore"] 28535b08_6603_aa75_f05d_abb90636cd88 -->|defined in| 40387f29_12a3_f291_fc18_4ce17ac91db3 4913d94d_bd60_eefc_8e42_e5664da21e4e["_create_table_if_not_exists()"] 28535b08_6603_aa75_f05d_abb90636cd88 -->|calls| 4913d94d_bd60_eefc_8e42_e5664da21e4e style 28535b08_6603_aa75_f05d_abb90636cd88 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/langchain/langchain_classic/memory/entity.py lines 354–390
def __init__(
self,
session_id: str = "default",
db_file: str = "entities.db",
table_name: str = "memory_store",
*args: Any,
**kwargs: Any,
):
"""Initializes the SQLiteEntityStore.
Args:
session_id: Unique identifier for the session.
db_file: Path to the SQLite database file.
table_name: Name of the table to store entities.
*args: Additional positional arguments.
**kwargs: Additional keyword arguments.
"""
super().__init__(*args, **kwargs)
try:
import sqlite3
except ImportError as e:
msg = (
"Could not import sqlite3 python package. "
"Please install it with `pip install sqlite3`."
)
raise ImportError(msg) from e
# Basic validation to prevent obviously malicious table/session names
if not table_name.isidentifier() or not session_id.isidentifier():
# Since we validate here, we can safely suppress the S608 bandit warning
msg = "Table name and session ID must be valid Python identifiers."
raise ValueError(msg)
self.conn = sqlite3.connect(db_file)
self.session_id = session_id
self.table_name = table_name
self._create_table_if_not_exists()
Domain
Subdomains
Source
Frequently Asked Questions
What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/memory/entity.py.
Where is __init__() defined?
__init__() is defined in libs/langchain/langchain_classic/memory/entity.py at line 354.
What does __init__() call?
__init__() calls 1 function(s): _create_table_if_not_exists.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free