UNPKG

@convo-lang/convo-lang

Version:
60 lines (59 loc) 2.35 kB
import { Conversation, ConversationOptions, ConvoConversationCache, ConvoDocQuery, ConvoDocQueryResult, ConvoDocReaderFactory } from "@convo-lang/convo-lang"; import { Progress, ReadonlySubject } from '@iyio/common'; export declare const enableConvoDocRunnerLogging: (enable: boolean) => void; export interface ConvoDocQueryRunnerOptions { query: ConvoDocQuery; llmLock?: number; createConversation?: () => Conversation; conversationOptions?: ConversationOptions; cacheQueryResults?: boolean; cacheConversations?: boolean; conversationCache?: ConvoConversationCache; memoryCacheTtlMs?: number; cacheVisionPass?: boolean; cacheTextPass?: boolean; cacheDir?: string; outDir?: string; readerFactory?: ConvoDocReaderFactory | ConvoDocReaderFactory[]; log?: boolean; /** * If true the doc query runner will use the global doc runner lock that only allows one * doc query to execute at a time. In client applications the can be desired to prevent over * consumption of resources. */ useRunLock?: boolean; } export declare class ConvoDocQueryRunner { private readonly options; private readonly _result; get resultSubject(): ReadonlySubject<ConvoDocQueryResult | null>; get result(): ConvoDocQueryResult | null; private readonly outputs; private nextOutputId; private readonly llmLock; private readonly disposeToken; readonly progress: Progress; constructor({ query, llmLock, createConversation, cacheQueryResults, cacheVisionPass, cacheTextPass, cacheConversations, conversationCache, cacheDir, outDir, readerFactory, memoryCacheTtlMs, log, conversationOptions, useRunLock, }: ConvoDocQueryRunnerOptions); private _isDisposed; get isDisposed(): boolean; dispose(): void; private createConversation; private pageLock; private reader?; private readOpenCount; private getPageImageAsync; private getPageTextAsync; private getCachedPassAsync; private writeCachedPassAsync; private loadCached; private progressTotal; private progressStep; private updateProgress; private runPromise; runQueryAsync(): Promise<ConvoDocQueryResult>; private _runQueryAsync; private runPassAsync; private convertPageImageAsync; private selectAsync; private callAsync; }