Home / Function/ __init__() — langchain Function Reference

__init__() — langchain Function Reference

Architecture documentation for the __init__() function in anthropic_tools.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  2cdff0a9_3f29_f41b_4898_ee04344e99d7["__init__()"]
  8768005e_527e_3f44_6a66_95c45357772f["StateClaudeMemoryMiddleware"]
  2cdff0a9_3f29_f41b_4898_ee04344e99d7 -->|defined in| 8768005e_527e_3f44_6a66_95c45357772f
  style 2cdff0a9_3f29_f41b_4898_ee04344e99d7 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py lines 632–654

    def __init__(
        self,
        *,
        allowed_path_prefixes: Sequence[str] | None = None,
        system_prompt: str = MEMORY_SYSTEM_PROMPT,
    ) -> None:
        """Initialize the memory middleware.

        Args:
            allowed_path_prefixes: Optional list of allowed path prefixes.

                Defaults to `['/memories']`.
            system_prompt: System prompt to inject.

                Defaults to Anthropic's recommended memory prompt.
        """
        super().__init__(
            tool_type=MEMORY_TOOL_TYPE,
            tool_name=MEMORY_TOOL_NAME,
            state_key="memory_files",
            allowed_path_prefixes=allowed_path_prefixes or ["/memories"],
            system_prompt=system_prompt,
        )

Domain

Subdomains

Frequently Asked Questions

What does __init__() do?
__init__() is a function in the langchain codebase, defined in libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py.
Where is __init__() defined?
__init__() is defined in libs/partners/anthropic/langchain_anthropic/middleware/anthropic_tools.py at line 632.

Analyze Your Own Codebase

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

Try Supermodel Free