import { PreviewConfig, Prompt, PromptElement, RenderOutput, SynchronousPreviewConfig, SynchronousPrompt } from './types'; import { StreamChatCompletionResponse } from './openai'; import { UsableTokenizer } from './tokenizer'; import { ChatCompletionResponseMessage, CreateChatCompletionResponse } from 'openai'; import { OutputCatcher } from './outputCatcher.ai'; export type PreviewManagerGetPromptQuery = { promptId: string; propsId: string; tokenLimit: number; tokenizer: UsableTokenizer; shouldBuildSourceMap: boolean; }; export type PreviewManagerGetRemotePromptQuery = { promptId: string; promptDump: string; tokenLimit: number; tokenizer: UsableTokenizer; }; export type PreviewManagerGetRemotePropsQuery = { promptId: string; promptDump: string; }; export type PreviewManagerGetPromptOutputQuery = { promptId: string; propsId: string; tokenLimit: number; tokenizer: UsableTokenizer; completion: ChatCompletionResponseMessage | ChatCompletionResponseMessage[]; stream: boolean; shouldBuildSourceMap: boolean; }; export type PreviewManagerLiveModeQuery = { alreadySeenLiveModeId?: string; }; export type PreviewManagerLiveModeResultQuery = { output: string; }; export interface IPreviewManager { registerConfig(config: PreviewConfig): void; dump(config: PreviewConfig, props: T): void; getPreviews(): Record; getPrompt(query: PreviewManagerGetPromptQuery): Promise; getPromptFromRemote(query: PreviewManagerGetRemotePromptQuery): Promise; } type LiveModeOutput = { liveModeId: string; }; export declare function configFromPrompt(prompt: Prompt): PreviewConfig; export declare function configFromSynchronousPrompt(prompt: SynchronousPrompt, options?: { protoProps?: ProtoPropsType; }): SynchronousPreviewConfig; export declare function dumpProps(config: PreviewConfig, props: Omit): string; export declare function defaultYamlDump(props: T): string; export declare function defaultYamlLoad(dump: string): T; export type ProtoPropsType = { fromJsonString(jsonString: string): T; }; export type ProtoProps = { toJsonString(): string; }; declare class PreviewManagerImpl implements IPreviewManager { private _shouldDump; get shouldDump(): boolean; set shouldDump(value: boolean); private readonly previews; getConfig(promptId: string): PreviewConfig; getPreviews(): { [x: string]: { dumps: string[]; saved: string[]; } | { dumps: string[]; saved: string[]; }; }; getPrompt(query: PreviewManagerGetPromptQuery): Promise; getPromptOutput(query: PreviewManagerGetPromptOutputQuery): Promise; getPromptFromRemote(query: PreviewManagerGetRemotePromptQuery): Promise; getPropsFromRemote(query: PreviewManagerGetRemotePropsQuery): Promise; getPromptFunctionFromRemote(query: PreviewManagerGetRemotePropsQuery): Prompt; getPromptFromRemoteElement(query: Omit, element: PromptElement): Promise; getRemoteElement(promptId: string, promptDump: string): PromptElement | Promise; getElement(promptId: string, propsId: string, outputCatcher?: OutputCatcher): PromptElement | Promise; registerConfig(config: PreviewConfig): void; register(prompt: Prompt): void; registerProtoPrompt(prompt: Prompt, protoProps: ProtoPropsType): void; configFromSynchronousPrompt(prompt: SynchronousPrompt): SynchronousPreviewConfig; hydrate(config: PreviewConfig, dump: string): T; maybeDump(prompt: Prompt, props: Omit): void; dump(config: PreviewConfig, props: T): void; private lastLiveModeData; private lastLiveModeOutputPromise; private resolveLastLiveModeOutputPromise; private liveModeResultPromise; private resolveLiveModeResult; constructor(); getLiveModePromptCompletion(promptElement: PromptElement, options: { model: string; abortSignal?: AbortSignal; }): Promise; streamLiveModePromptCompletion(promptElement: PromptElement, options: { model: string; abortSignal?: AbortSignal; }): AsyncGenerator; liveMode(query: PreviewManagerLiveModeQuery, abortSignal?: AbortSignal): Promise; liveModeResult(query: PreviewManagerLiveModeResultQuery): void; private getDump; } export declare const PreviewManager: PreviewManagerImpl; export declare function register(): (target: any, propertyKey: string, descriptor: TypedPropertyDescriptor>) => void; export {}; //# sourceMappingURL=preview.d.ts.map