Gaunt Sloth Assistant - v1.4.0
    Preparing search index...

    Module middleware/binaryContentInjectionMiddleware

    Middleware to inject binary content (images, PDFs, audio) as HumanMessage.

    The gth_read_binary tool returns binary data as a special string format: gth_read_binary;type:${type};path:${encodedPath};data:${media_type};base64,${data} where path is URL-encoded to handle special characters like semicolons.

    This middleware:

    1. Detects the gth_read_binary tool calls
    2. Parses the special string format from ToolMessage content
    3. Injects HumanMessage with binary content blocks before next model call

    This works around LangChain's limitation where ToolMessage doesn't properly support binary content blocks for most providers.

    Interfaces

    BinaryContentInjectionMiddlewareSettings

    Functions

    createBinaryContentInjectionMiddleware