aiwrapper
Version:
A Universal AI Wrapper for JavaScript & TypeScript
44 lines (43 loc) • 1.38 kB
TypeScript
import { LangOptions, LanguageProvider } from "../language-provider.ts";
import { LangMessage, LangMessageItem, LangMessageRole, LangMessages } from "../messages.ts";
type MessageFactory = string | (() => string);
export type MockResponseStreamOptions = {
/**
* Deterministic message to emit every time. Overrides `messages` rotation.
*/
message?: MessageFactory;
/**
* Pool of pre-written answers that the mock will rotate through.
*/
messages?: string[];
/**
* Characters per streamed chunk.
*/
chunkSize?: number;
/**
* Delay in milliseconds between chunks.
*/
speedMs?: number;
/**
* Optional custom provider name for debugging.
*/
name?: string;
};
export declare class MockResponseStreamLang extends LanguageProvider {
private readonly config;
private presetIndex;
constructor(options?: MockResponseStreamOptions);
ask(prompt: string, options?: LangOptions): Promise<LangMessages>;
chat(messages: {
role: LangMessageRole;
items: LangMessageItem[];
}[] | LangMessage[] | LangMessages, options?: LangOptions): Promise<LangMessages>;
private resolveOverrides;
private pickMessage;
private resolveMessageList;
private resolveChunkSize;
private resolveSpeed;
private chunkText;
private streamMockResponse;
}
export {};