tinyagent-ts
Version:
Modern TypeScript framework for building AI agents with pluggable tools and ReAct reasoning
34 lines (33 loc) • 1.06 kB
TypeScript
import type { ActionStep, ScratchStep } from './steps';
import { LLMMessage } from '../model/types';
export declare class Scratchpad {
private task;
private steps;
setTask(text: string): void;
clear(): void;
addThought(text: string): void;
addAction(action: ActionStep): void;
addObservation(text: string): void;
addToolResult(tool: string, output: string): void;
addReflexion(text: string): void;
getLastObservation(): string | undefined;
/**
* Get all steps in the scratchpad
* @returns Array of all steps
*/
getSteps(): ScratchStep[];
/**
* Get the most recent output/result for a given tool name.
*/
getLastToolResult(toolName: string): string | undefined;
/**
* Get the last argument value used for a specific key in any tool call.
*/
getLastArgValue(argKey: string): any;
toMessages(systemPrompt: string): LLMMessage[];
}
export declare function parseThoughtAction(text: string): {
thought?: string;
action?: ActionStep;
reflexion?: string;
};