UNPKG

@promptbook/remote-server

Version:

Promptbook: Create persistent AI agents that turn your company's scattered knowledge into action

52 lines (51 loc) 2.25 kB
import type { CallChatModelStreamOptions } from '../../execution/LlmExecutionTools'; import type { ChatPromptResult, CommonPromptResult } from '../../execution/PromptResult'; import type { Prompt } from '../../types/Prompt'; import type { string_model_name } from '../../types/string_model_name'; import type { string_title } from '../../types/string_title'; import { OpenAiAgentKitExecutionTools } from '../openai/OpenAiAgentKitExecutionTools'; import type { AgentLlmExecutionToolsPromptPreparer } from './AgentLlmExecutionToolsPromptPreparer'; /** * Handles OpenAI AgentKit-backed executions for `AgentLlmExecutionTools`. * * @private internal utility of `AgentLlmExecutionTools` */ export declare class AgentLlmExecutionToolsAgentKitRunner { private readonly context; /** * Cached AgentKit agents to avoid rebuilding identical instances. */ private static agentKitAgentCache; /** * Cache of OpenAI vector stores to avoid creating duplicates. */ private static vectorStoreCache; constructor(context: { readonly getTitle: () => string_title; readonly getModelName: () => string_model_name; readonly isVerbose?: boolean; readonly assistantPreparationMode?: 'internal' | 'external'; }); /** * Runs one prepared prompt through the OpenAI AgentKit backend. */ callChatModelStream(options: { readonly llmTools: OpenAiAgentKitExecutionTools; readonly originalPrompt: Prompt; readonly preparedChatPrompt: Awaited<ReturnType<AgentLlmExecutionToolsPromptPreparer['prepareChatPrompt']>>; readonly onProgress: (chunk: ChatPromptResult) => void; readonly streamOptions?: CallChatModelStreamOptions; }): Promise<CommonPromptResult>; /** * Resolves the AgentKit cache state for the current prompt, including external and in-memory caches. */ private resolveAgentKitCacheState; /** * Returns a prepared AgentKit agent, creating one only when the cache could not satisfy the request. */ private getOrPrepareAgentKitAgent; /** * Stores freshly prepared AgentKit resources back into the in-memory caches when caching is allowed. */ private storeAgentKitCache; }