UNPKG

adk-typescript

Version:

TypeScript port of Google's Agent Development Kit (ADK)

69 lines (68 loc) 2.09 kB
import { BaseTool } from './BaseTool'; import { ToolContext } from './ToolContext'; /** * Interface for an example */ export interface Example { /** The user input in the example */ input: string; /** The expected output in the example */ output: string; } /** * Interface for an example provider */ export interface BaseExampleProvider { /** Get examples based on a query */ getExamples(query: string, model?: string): Example[]; } /** * Utility to build example instructions * * @param examples The examples to use * @param query The user query * @param model The model being used (optional) * @returns Formatted examples as a string */ export declare function buildExampleInstructions(examples: Example[] | BaseExampleProvider, query: string, model?: string): string; /** * A tool that adds (few-shot) examples to the LLM request */ export declare class ExampleTool extends BaseTool { /** * The examples to add to the LLM request */ private examples; /** * Create a new example tool * * @param examples The examples to use */ constructor(examples: Example[] | BaseExampleProvider); /** * Process the LLM request to add examples * * @param params The parameters for processing * @param params.toolContext The tool context * @param params.llmRequest The LLM request to process */ processLlmRequest({ toolContext, llmRequest }: { toolContext: ToolContext; llmRequest: any; }): Promise<void>; /** * Execute the example tool - not meant to be called directly * * @param params The parameters for execution * @param context The tool context * @returns A message indicating this tool is not meant to be called directly */ execute(params: Record<string, any>, context: ToolContext): Promise<any>; } /** * Creates a new example tool * * @param examples The examples to use * @returns A new ExampleTool instance */ export declare function createExampleTool(examples: Example[] | BaseExampleProvider): ExampleTool;