aiwrapper
Version:
A Universal AI Wrapper for JavaScript & TypeScript
27 lines (26 loc) • 1.02 kB
TypeScript
import { LangMessage, LangOptions } from "../language-provider.ts";
import { LangMessages } from "../messages.ts";
import { OpenAIChatCompletionsLang } from "../openai/openai-chat-completions-lang.ts";
export type MockOpenAILikeOptions = {
model?: string;
systemPrompt?: string;
mockResponseText?: string | (() => string);
mockResponseObject?: any;
stream?: boolean;
chunkSize?: number;
mockToolCalls?: Array<{
id?: string;
name: string;
argumentsChunks: string[];
}>;
};
/**
* Mock provider that behaves like an OpenAI-compatible API without network calls.
* It emits streaming deltas shaped as OpenAI chat completions SSE payloads.
*/
export declare class MockOpenAILikeLang extends OpenAIChatCompletionsLang {
private readonly mockConfig;
constructor(options?: MockOpenAILikeOptions);
ask(prompt: string, options?: LangOptions): Promise<LangMessages>;
chat(messages: LangMessage[] | LangMessages, options?: LangOptions): Promise<LangMessages>;
}