Mnemon moth — LangChain integration. System 2 EME via per-step patching: RunnableSequence.invoke is patched to iterate each step individually. Each step is a segment. If a step's output is cached (same input hash), it is returned directly and the LLM is not called for that step.
# Source: https://github.com/smartass-4ever/Mnemon | License: MIT | Copyright 2026 Mahika Jadhav # Provided via justclaw.it.com; keep this notice with the code. """ Mnemon moth — LangChain integration. System 2 EME via per-step patching: RunnableSequence.invoke is patched to iterate each step individually. Each step is a segment. If a step's output is cached (same input hash), it is returned directly and the LLM is not called for that step. Only changed steps call the LLM. BaseChatModel.invoke / ainvoke: LLM-step caching for all providers (Groq, Anthropic, OpenAI, etc.) Cache keyed on original input — never patched versions. Legacy Chain.__call__ (LangChain v0.1) gets chain-level System 1 cache. """ from __future__ import annotations import importlib.util import logging fr ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key