adk-typescript
Version:
TypeScript port of Google's Agent Development Kit (ADK)
50 lines (49 loc) • 1.76 kB
TypeScript
import { Part } from '../models/types';
import { ReadonlyContext } from '../agents/ReadonlyContext';
import { CallbackContext } from '../agents/CallbackContext';
import { LlmRequest } from '../models/LlmRequest';
import { BasePlanner } from './BasePlanner';
/**
* Plan-Re-Act planner that constrains the LLM response to generate a plan before any action/observation.
*
* Note: this planner does not require the model to support built-in thinking
* features or setting the thinking config.
*/
export declare class PlanReActPlanner extends BasePlanner {
/**
* @inheritdoc
*/
buildPlanningInstruction(readonlyContext: ReadonlyContext, llmRequest: LlmRequest): string;
/**
* @inheritdoc
*/
processPlanningResponse(callbackContext: CallbackContext, responseParts: Part[]): Part[] | undefined;
/**
* Splits the text by the last occurrence of the separator.
*
* @param text The text to split.
* @param separator The separator to split on.
* @returns A tuple containing the text before the last separator and the text after
* the last separator.
*/
private splitByLastPattern;
/**
* Handles non-function-call parts of the response.
*
* @param responsePart The response part to handle.
* @param preservedParts The mutable list of parts to store the processed parts in.
*/
private handleNonFunctionCallParts;
/**
* Marks the response part as thought.
*
* @param responsePart The mutable response part to mark as thought.
*/
private markAsThought;
/**
* Builds the NL planner instruction for the Plan-Re-Act planner.
*
* @returns NL planner system instruction.
*/
private buildNlPlannerInstruction;
}