UNPKG

gaunt-sloth-assistant

Version:

[![Tests and Lint](https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/actions/workflows/unit-tests.yml/badge.svg)](https://github.com/Galvanized-Pukeko/gaunt-sloth-assistant/actions/workflows/unit-tests.yml) [![Integration Tests](https://github.co

38 lines (37 loc) 1.71 kB
/** * @packageDocumentation * Middleware registry for Gaunt Sloth Assistant. * * This module provides factory functions for creating predefined middleware instances * and a resolver to convert middleware configurations into middleware objects. */ import type { GthConfig } from '#src/config.js'; import type { AnthropicPromptCachingConfig, MiddlewareConfig, SummarizationConfig } from '#src/middleware/types.js'; import { type AgentMiddleware } from 'langchain'; /** * Create Anthropic prompt caching middleware. * This middleware adds cache control headers to reduce API costs. * * @param config - Configuration for the middleware * @param gthConfig - Full Gaunt Sloth configuration * @returns Middleware object */ export declare function createAnthropicPromptCachingMiddleware(config: AnthropicPromptCachingConfig, _: GthConfig): Promise<AgentMiddleware>; /** * Create summarization middleware. * This middleware automatically condenses conversation history when approaching token limits. * * @param config - Configuration for the middleware * @param gthConfig - Full Gaunt Sloth configuration * @returns Middleware object */ export declare function createSummarizationMiddleware(config: SummarizationConfig, gthConfig: GthConfig): Promise<AgentMiddleware>; /** * Resolve middleware configuration into middleware instances. * Converts string identifiers and config objects into actual middleware. * * @param configs - Array of middleware configurations * @param gthConfig - Full Gaunt Sloth configuration * @returns Array of middleware instances */ export declare function resolveMiddleware(configs: MiddlewareConfig[] | undefined, gthConfig: GthConfig): Promise<AgentMiddleware[]>;