UNPKG

@promptbook/remote-server

Version:

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

76 lines (75 loc) 2.72 kB
import type OpenAI from 'openai'; import type { TODO_any } from '../../utils/organization/TODO_any'; /** * Metadata for uploaded knowledge source files used for vector store diagnostics. * * @private internal utility of `OpenAiVectorStoreFileBatchPoller` */ type KnowledgeSourceUploadMetadata = { readonly fileId: string; readonly filename: string; readonly sizeBytes?: number; }; /** * Polls one vector-store file batch until it settles. * * @private helper of `OpenAiVectorStoreHandler` */ export declare class OpenAiVectorStoreFileBatchPoller { private readonly options; /** * Creates one vector-store file-batch poller instance. */ constructor(options: { readonly isVerbose: boolean; readonly getVectorStoresApi: (client: OpenAI) => TODO_any; }); /** * Polls the created vector-store batch until ingestion completes, fails, or times out. */ pollVectorStoreFileBatchUntilSettled(options: { readonly client: OpenAI; readonly vectorStoreId: string; readonly batch: TODO_any; readonly expectedBatchId: string; readonly isExpectedBatchIdValid: boolean; readonly uploadedFiles: ReadonlyArray<KnowledgeSourceUploadMetadata>; readonly pollIntervalMs: number; readonly uploadTimeoutMs: number; readonly shouldContinueOnVectorStoreStall: boolean; readonly logLabel: string; }): Promise<TODO_any>; /** * Logs vector store file batch diagnostics to help trace ingestion stalls or failures. */ private logVectorStoreFileBatchDiagnostics; /** * Resolves the next batch id to poll and retrieves the freshest OpenAI batch snapshot. */ private retrieveVectorStoreFileBatchForPolling; /** * Normalizes the batch identifier returned by OpenAI and logs unusual id situations once. */ private resolveVectorStoreFileBatchId; /** * Tracks observed polling progress and emits throttled verbose status logs. */ private trackVectorStoreFileBatchProgress; /** * Emits deeper diagnostics when vector-store ingestion appears stalled for too long. */ private maybeLogStalledVectorStoreFileBatch; /** * Handles terminal vector-store batch states that do not require further polling. */ private handleVectorStoreFileBatchTerminalState; /** * Stops polling once the batch exceeds the configured timeout and handles optional cancellation. */ private handleVectorStoreFileBatchTimeout; /** * Attempts to cancel a timed-out vector-store batch and logs any unusual id situation. */ private cancelVectorStoreFileBatchAfterTimeout; } export {};