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

39 lines (38 loc) 1.97 kB
import { GthConfig } from '#src/config.js'; import { GthAgentInterface, GthCommand, StatusLevel } from '#src/core/types.js'; import type { Message } from '#src/modules/types.js'; import { RunnableConfig } from '@langchain/core/runnables'; import { IterableReadableStream } from '@langchain/core/utils/stream'; import { BaseCheckpointSaver } from '@langchain/langgraph'; import type { Connection } from '@langchain/mcp-adapters'; import { MultiServerMCPClient } from '@langchain/mcp-adapters'; export type StatusUpdateCallback = (level: StatusLevel, message: string) => void; export declare class GthLangChainAgent implements GthAgentInterface { private statusUpdate; private mcpClient; private agent; private config; constructor(statusUpdate: StatusUpdateCallback); init(command: GthCommand | undefined, configIn: GthConfig, checkpointSaver?: BaseCheckpointSaver | undefined): Promise<void>; /** * Invoke LLM with a message and runnable config. * For streaming use {@link #stream} method, streaming is preferred if model API supports it. * Please note that this when tools are involved, this method will anyway do multiple LLM * calls within LangChain dependency. */ invoke(messages: Message[], runConfig: RunnableConfig): Promise<string>; /** * Induce LLM to stream AI messages with a user message and runnable config. * When stream is not appropriate use {@link invoke}. */ stream(messages: Message[], runConfig: RunnableConfig): Promise<IterableReadableStream<string>>; getMCPClient(): MultiServerMCPClient | null; cleanup(): Promise<void>; getEffectiveConfig(config: GthConfig, command: GthCommand | undefined): GthConfig; /** * Extract and flatten tools from toolkits */ private extractAndFlattenTools; protected getDefaultMcpServers(): Record<string, Connection>; protected getMcpClient(config: GthConfig): Promise<MultiServerMCPClient | null>; }