langchain.js
    Preparing search index...

    Interface ContextEditingMiddlewareConfig

    Configuration for the Context Editing Middleware.

    interface ContextEditingMiddlewareConfig {
        edits?: ContextEdit[];
        tokenCountMethod?: "model" | "approx";
    }
    Index

    Properties

    edits?: ContextEdit[]

    Sequence of edit strategies to apply. Defaults to a single ClearToolUsesEdit mirroring Anthropic defaults.

    tokenCountMethod?: "model" | "approx"

    Whether to use approximate token counting (faster, less accurate) or exact counting implemented by the chat model (potentially slower, more accurate). Currently only OpenAI models support exact counting.

    "approx"