@promptbook/google
Version:
Promptbook: Turn your company's scattered knowledge into AI ready books
68 lines (67 loc) • 2.2 kB
TypeScript
import type { string_book } from '../../../book-2.0/agent-source/string_book';
import type { ChatPromptResult } from '../../../execution/PromptResult';
import type { Prompt } from '../../../types/Prompt';
import type { SelfLearningTeacherSummary } from '../../../types/ToolCall';
/**
* Agent interface used for teacher-based self-learning calls.
*
* @private type of Agent
*/
type SelfLearningTeacherAgent = {
callChatModel(prompt: Prompt): Promise<ChatPromptResult>;
};
/**
* Options required to drive the self-learning workflow.
*
* @private type of Agent
*/
type SelfLearningManagerOptions = {
teacherAgent: SelfLearningTeacherAgent | null;
getAgentSource: () => string_book;
updateAgentSource: (source: string_book) => void;
};
/**
* Coordinates the Agent self-learning workflow that was extracted from the main class.
*
* @private helper for Agent
*/
export declare class SelfLearningManager {
private readonly options;
private readonly teacherAgent;
constructor(options: SelfLearningManagerOptions);
/**
* Runs nonce, sampling, and teacher steps for every interaction that should learn.
*
* @param prompt Received prompt for the interaction
* @param result Response produced by the agent
* @returns Teacher summary or null when no teacher is configured
* @private helper of Agent
*/
runSelfLearning(prompt: Prompt, result: ChatPromptResult): Promise<SelfLearningTeacherSummary | null>;
/**
* Appends the nonce section to the agent source with slight delay to avoid thundering herd lookups.
*
* @private helper of Agent
*/
private appendNonce;
/**
* Appends the recent user/agent exchange as a new sample.
*
* @private helper of Agent
*/
private appendSample;
/**
* Calls the teacher agent, appends its commitments, and summarizes the results.
*
* @private helper of Agent
*/
private callTeacher;
/**
* Appends a new fragment to the agent source and triggers normalization.
*
* @param section Fragment that should be appended
* @private helper of Agent
*/
private appendToAgentSource;
}
export {};