UNPKG

adk-typescript

Version:

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

48 lines (47 loc) 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseCodeExecutor = void 0; /** * Abstract base class for all code executors. * * The code executor allows the agent to execute code blocks from model responses * and incorporate the execution results into the final response. */ class BaseCodeExecutor { constructor() { /** * If true, extract and process data files from the model request * and attach them to the code executor. * Supported data file MimeTypes are [text/csv]. * * Default to false. */ this.optimizeDataFile = false; /** * Whether the code executor is stateful. Default to false. */ this.stateful = false; /** * The number of attempts to retry on consecutive code execution errors. Default to 2. */ this.errorRetryAttempts = 2; /** * The list of the enclosing delimiters to identify the code blocks. * For example, the delimiter ['```python\n', '\n```'] can be * used to identify code blocks with the following format: * * ```python * print("hello") * ``` */ this.codeBlockDelimiters = [ ['```tool_code\n', '\n```'], ['```python\n', '\n```'], ]; /** * The delimiters to format the code execution result. */ this.executionResultDelimiters = ['```tool_output\n', '\n```']; } } exports.BaseCodeExecutor = BaseCodeExecutor;