Home / Function/ exists() — langchain Function Reference

exists() — langchain Function Reference

Architecture documentation for the exists() function in entity.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  51c4ff54_3688_e0d2_d041_9ea9d10b2773["exists()"]
  40387f29_12a3_f291_fc18_4ce17ac91db3["SQLiteEntityStore"]
  51c4ff54_3688_e0d2_d041_9ea9d10b2773 -->|defined in| 40387f29_12a3_f291_fc18_4ce17ac91db3
  bb3de870_d9a2_b2ef_b746_608a90b30ec8["_execute_query()"]
  51c4ff54_3688_e0d2_d041_9ea9d10b2773 -->|calls| bb3de870_d9a2_b2ef_b746_608a90b30ec8
  6c8d475b_0f36_5deb_090a_14caeed7002a["exists()"]
  51c4ff54_3688_e0d2_d041_9ea9d10b2773 -->|calls| 6c8d475b_0f36_5deb_090a_14caeed7002a
  style 51c4ff54_3688_e0d2_d041_9ea9d10b2773 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/memory/entity.py lines 440–445

    def exists(self, key: str) -> bool:
        """Checks for the existence of a key, safely quoting the table name."""
        # Ignore S608 since we validate for malicious table/session names in `__init__`
        query = f'SELECT 1 FROM "{self.full_table_name}" WHERE key = ? LIMIT 1'  # noqa: S608
        cursor = self._execute_query(query, (key,))
        return cursor.fetchone() is not None

Domain

Subdomains

Frequently Asked Questions

What does exists() do?
exists() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/memory/entity.py.
Where is exists() defined?
exists() is defined in libs/langchain/langchain_classic/memory/entity.py at line 440.
What does exists() call?
exists() calls 2 function(s): _execute_query, exists.

Analyze Your Own Codebase

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

Try Supermodel Free